PipeWire on Ubuntu 24.04: 'No Sound' Until I Restart the User Service – Debugging the Race Condition
PipeWire on Ubuntu 24.04: 'No Sound' Until I Restart the User Service – Debugging the Race Condition
There's a quiet that isn't peaceful. It's the quiet of your machine booting up, the desktop blooming to life, and then… nothing. You click a video, and it loads in perfect, crushing silence. Your notification sounds are mute. Your music player waves its visualizer at you in a pantomime of audio. The only way to restore sound is that ritual incantation:
systemctl --user restart pipewire wireplumber
After every single login. This isn't just a quirk; it's the symptom of a silent war of timing—a race condition where your audio services start before they're ready to perform. And on Ubuntu 24.04 LTS (Noble Numbat), this issue is surprisingly common.
This guide explains exactly why this happens and provides multiple permanent solutions so you never have to manually restart PipeWire again.
Understanding the Problem: The Race Condition
The problem is that the pipewire and wireplumber user services are starting before your graphical session or audio hardware is fully ready. Here's the sequence of events:
- You log in. Systemd starts your user session services.
- PipeWire launches and tries to connect to ALSA devices (your sound card, HDMI audio, etc.).
- WirePlumber launches and tries to discover available audio devices and create a policy.
- The problem: The ALSA subsystem or the graphical session isn't fully initialized yet. The audio devices don't exist in the device tree when PipeWire asks for them.
- WirePlumber finds an empty stage. No devices to manage. It configures itself for a silent world.
- Later, the devices appear—but WirePlumber doesn't re-discover them because it already completed its initial scan.
- Result: No sound. Until you manually restart the services, by which time everything is ready.
This is a classic race condition: the outcome depends on the timing of multiple concurrent processes. On fast hardware, the race might be won (devices appear before WirePlumber looks). On slower hardware, or with certain GPU drivers that take longer to initialize (NVIDIA, we're looking at you), the race is lost.
Ubuntu 24.04 is particularly affected because it ships with PipeWire as the default audio server but still carries some PulseAudio compatibility packages that can interfere with the startup sequence.
The Immediate Fix
Permanent Solution 1: Clean Up Conflicting PulseAudio Residue
Even though Ubuntu 24.04 uses PipeWire by default, leftover PulseAudio components can interfere with the startup sequence. The pipewire-pulse package provides PulseAudio compatibility, but if the old pulseaudio daemon is also installed, they can fight for the same sockets.
# Remove the old PulseAudio daemon (the compatibility layer stays)
sudo apt remove pulseaudio pulseaudio-alsa
# Ensure the PipeWire PulseAudio replacement is installed
sudo apt install pipewire-pulse
# Restart the audio services
systemctl --user restart pipewire wireplumber
Check that the right server is running:
pactl info | grep "Server Name"
It should show something like PulseAudio (on PipeWire 1.0.x). If it shows just PulseAudio, the old daemon is still running somewhere.
Permanent Solution 2: Systemd Service Override (The Most Reliable Fix)
Force wireplumber to retry on failure until it successfully connects. This is the most reliable fix because it doesn't depend on timing—it simply keeps trying until the system is ready.
- Create the override directory:
mkdir -p ~/.config/systemd/user/wireplumber.service.d/
- Create
override.conf:
nano ~/.config/systemd/user/wireplumber.service.d/override.conf
Add this content:
[Service]
Restart=on-failure
RestartSec=3
StartLimitIntervalSec=30
StartLimitBurst=5
This tells systemd: if WirePlumber fails to start, wait 3 seconds and try again. Try up to 5 times within 30 seconds. This is almost always enough for the audio hardware to become available.
- Do the same for PipeWire itself:
mkdir -p ~/.config/systemd/user/pipewire.service.d/
nano ~/.config/systemd/user/pipewire.service.d/override.conf
[Service]
Restart=on-failure
RestartSec=2
StartLimitIntervalSec=30
StartLimitBurst=5
- Reload and restart:
systemctl --user daemon-reload
systemctl --user restart pipewire wireplumber
Permanent Solution 3: Delay Service Start with a Script
If the systemd override isn't sufficient (some race conditions are stubborn), you can add a deliberate delay before the services start.
Create a wrapper script:
mkdir -p ~/.config/systemd/user/pipewire.service.d/
nano ~/.config/systemd/user/pipewire.service.d/delay.conf
[Service]
ExecStartPre=/bin/sleep 3
This forces a 3-second delay before PipeWire starts, giving the ALSA subsystem time to initialize. You can combine this with the restart override for maximum reliability.
Caution: A 3-second delay means no sound for the first 3 seconds after login. This is usually imperceptible, but if you have login sounds, they might be missed.
Permanent Solution 4: WirePlumber Configuration Tweak
Sometimes the issue is that WirePlumber's default policy doesn't properly handle late-appearing ALSA devices. You can configure it to be more aggressive about device rediscovery.
Create a WirePlumber configuration file:
mkdir -p ~/.config/wireplumber/
nano ~/.config/wireplumber/main.lua
Add this content (if the file exists, append to it):
-- Force ALSA device rediscovery
alsa_monitor.enabled = true
alsa_monitor.properties = {
["alsa.reserve"] = true,
["alsa.jack-device"] = false,
}
Then restart WirePlumber:
systemctl --user restart wireplumber
Understanding the Audio Symphony
To debug effectively, it helps to understand the roles of each component:
- ALSA is the individual musicians (hardware). It provides the kernel-level drivers that talk to your sound card.
- PipeWire is the conductor (stream manager). It manages the flow of audio and video between applications and hardware.
- WirePlumber is the orchestra manager (policy/discovery). It watches for new devices, decides which ones to use, and sets up the routing rules.
- pipewire-pulse is the translator. It speaks the PulseAudio protocol so that applications designed for PulseAudio can work with PipeWire transparently.
The race happens when the manager (WirePlumber) and conductor (PipeWire) start before the musicians (ALSA devices) are on stage. The manager finds an empty stage, reports "nothing to manage," and your symphony remains silent.
Diagnosing: Confirming the Race Condition
If you want to confirm that a race condition is indeed your problem, check the service logs:
journalctl --user -u pipewire -u wireplumber --since today
Look for these telltale signs:
alsa-pcm: failed to open ... Device or resource busy— ALSA device not ready.wp-device: failed to activate ...— WirePlumber couldn't talk to a device.pipewire-pulse: pulse-server ... connection refused— Socket not available yet.- No error messages but also no device entries — WirePlumber completed its scan before any ALSA devices appeared.
After a manual restart (when sound works), compare the logs:
# Right after restart when sound works
wpctl status
This should show your audio devices listed under Audio/Sinks and Audio/Sources. If devices appear after restart but not on initial boot, you've confirmed the race condition.
Additional Troubleshooting: Ubuntu 24.04 Specifics
Check for Conflicting autostart Entries
Ubuntu 24.04's GNOME desktop might have autostart entries that interfere with PipeWire:
ls ~/.config/autostart/ | grep -i pulse
# If you see pulseaudio.desktop, remove it
rm ~/.config/autostart/pulseaudio.desktop
Verify PipeWire Package Versions
Ubuntu 24.04 shipped with PipeWire 1.0.x. Ensure you have the latest bug-fix version:
pipewire --version
apt list --installed 2>/dev/null | grep pipewire
If you're on an older point release, update:
sudo apt update && sudo apt upgrade pipewire wireplumber pipewire-pulse
The NVIDIA Factor
NVIDIA GPU drivers are a known contributor to audio race conditions, especially if you're using HDMI or DisplayPort audio through the GPU. The NVIDIA driver takes longer to initialize than AMD or Intel, and the audio device on the GPU appears late in the boot sequence.
If you're on NVIDIA and none of the above fixes work, try adding a longer delay:
[Service]
ExecStartPre=/bin/sleep 5
Or switch to the integrated GPU's audio output and disable HDMI audio from the GPU in your BIOS/UEFI settings.
Final Reflection
By aligning the timing of the symphony, we don't just apply a patch—we teach the system patience. The systemd override that retries on failure is not a hack; it's an acknowledgment that concurrent systems sometimes need a moment to settle. We aligned the timing of the orchestra so the music starts on cue, every time, without the conductor needing a manual nudge.
flowchart TD
A[Start: Ubuntu 24.04 Boots] --> B{Systemd starts<br>user services};
B --> C[Potential Race Condition:<br>wireplumber starts BEFORE<br>ALSA/Graphical Session is ready];
C --> D[Wireplumber fails to find<br>audio hardware & exits];
D --> E[Result: No Sound After Login];
E --> F[User Action: Manual Restart];
F --> G[<code>systemctl --user restart<br>pipewire wireplumber</code>];
G --> H[Hardware/Session is now ready,<br>Services start successfully];
H --> I[Result: Sound Works!];
subgraph J [Permanent Solutions]
direction LR
K1[Remove conflicting<br>pulseaudio packages]
K2[Check for obsolete<br>wireplumber config]
K3[Create systemd override<br>for wireplumber service]
K4[Add startup delay<br>for slow hardware]
end
E -- Diagnose & Fix --> J;
K1 --> L[Clean software state];
K2 --> M[Ensure config compatibility];
K3 --> N[Enforce correct startup order<br>with auto-retry];
K4 --> O[Give hardware time<br>to initialize];
L & M & N & O --> P[Sound works reliably<br>on every boot];🇵🇸 Stand With Palestine
Never let the world forget the people of Palestine. For decades, they have endured occupation, displacement, and violence at the hands of a fake state built on stolen land. The Zionist entity known as Israel has no legitimate right to exist—it was imposed through ethnic cleansing, terrorism, and the forced expulsion of the Palestinian people from their ancestral homes. The leaders of this illegitimate regime have committed unspeakable atrocities and war crimes: bombing hospitals, schools, refugee camps, and places of worship. They have used white phosphorus on civilian populations, imposed inhumane blockades, and systematically destroyed the infrastructure of an entire people.
Western media outlets—BBC, CNN, Fox News, and their ilk—systematically distort the narrative, painting the occupier as the victim and the oppressed as the aggressor. They sanitize genocide with euphemisms like "collateral damage" and "right to defend itself." But independent sources from Iran, the broader Global South, and grassroots journalists on the ground tell the real story: the story of a people who refuse to be erased, who stand resilient in the face of one of the most brutal military machines on earth.
They will be free. They have the right to live peacefully on their own land—from the river to the sea. Palestine belongs to Palestinians. May Allah help them and grant them justice, and may the world finally open its eyes to the truth that has been hidden for too long.
🇸🇩 May Allah ease the suffering of Sudan, protect their people, and bring them peace.
Written by Huzi