module-udev-detect races with module-default-device-restore

Bug #557421 reported by muszek
124
This bug affects 26 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Fix Released
Medium
Daniel T Chen
Nominated for Lucid by Brian Knoll

Bug Description

Binary package hint: pulseaudio

Running a live-usb. My sound card is external, connected via usb. A built-in card is physically broken (cracked audio-out jack), so after an installation, I added these lines to /etc/modprobe.d/blacklist.conf .
blacklist snd_hda_intel
blacklist pcspkr

The same setup works fine in Karmic (and before).

In my "sound preferences" "hardware" tab I can see my sound card. It is selected and "analog stereo duplex" profile is selected in settings (just as in karmic). However, "input" and "output" tabs don't have a correct content. In the output tab, there's only "Dummy Output, Stereo" option. In the "input" tab, input volume is greyed out and there's nothing in "choose a device for sound input" section.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: pulseaudio 1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu14
ProcVersionSignature: Ubuntu 2.6.32-19.28-generic 2.6.32.10+drm33.1
Uname: Linux 2.6.32-19-generic x86_64
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.21.
AplayDevices:
 **** List of PLAYBACK Hardware Devices ****
 card 1: MP3 [Sound Blaster MP3+], device 0: USB Audio [USB Audio]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
Architecture: amd64
ArecordDevices:
 **** List of CAPTURE Hardware Devices ****
 card 1: MP3 [Sound Blaster MP3+], device 0: USB Audio [USB Audio]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/dsp1', '/dev/snd/by-path', '/dev/snd/by-id', '/dev/snd/controlC1', '/dev/snd/pcmC1D0c', '/dev/snd/pcmC1D0p', '/dev/snd/seq', '/dev/snd/timer', '/dev/sequencer2', '/dev/sequencer'] failed with exit code 1:
Card1.Amixer.info:
 Card hw:1 'MP3'/'Creative Labs Sound Blaster MP3+ at usb-0000:00:1d.0-1, full speed'
   Mixer name : 'USB Mixer'
   Components : 'USB041e:3010'
   Controls : 13
   Simple ctrls : 6
Date: Wed Apr 7 16:34:49 2010
LiveMediaBuild: Ubuntu 10.04 "Lucid Lynx" - Beta amd64 (20100406.1)
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SelectedCard: 1 MP3 USB-Audio - Sound Blaster MP3+
SourcePackage: pulseaudio
Symptom: audio
Title: [USB-Audio - Sound Blaster MP3+] pactl stat failed to find default card
dmi.bios.date: 05/16/2007
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A00
dmi.board.name: 0UW524
dmi.board.vendor: Dell Inc.
dmi.chassis.type: 8
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvrA00:bd05/16/2007:svnDellInc.:pnInspiron1720:pvr:rvnDellInc.:rn0UW524:rvr:cvnDellInc.:ct8:cvr:
dmi.product.name: Inspiron 1720
dmi.sys.vendor: Dell Inc.

Revision history for this message
muszek (muszek) wrote :
Revision history for this message
muszek (muszek) wrote :

I looked around and found https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/550350
"pulseaudio -k && pulseaudio" fixes the problem for me.

Michalxo (#550350 bug reporter) claims the problem has been fixed in livecd from 29.03.2010. I've installed from a fresh image downloaded a few hours ago.

Revision history for this message
Daniel T Chen (crimsun) wrote :

I'm fairly certain that the rash of dummy/null outputs on login are caused by some other app having grabbed the sound device when PA initializes.

Please increase the verboseness of logging level in /etc/pulse/daemon.conf (or ~/.pulse/daemon.conf), log out, and log in.

Changed in pulseaudio (Ubuntu):
status: New → Incomplete
Revision history for this message
muszek (muszek) wrote :
Daniel T Chen (crimsun)
Changed in pulseaudio (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Daniel T Chen (crimsun) wrote :
Download full text (6.3 KiB)

Ok, so it appears that module-device-restore is attempting to use a nonexistent sink/source, so it falls back to dummy/null. This is caused by module-udev-detect not having loaded by the time module-device-restore is loaded, as can be seen in /etc/pulse/default.pa (I'm including the snippet from the source):

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
...
### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect@PA_SOEXT@
load-module module-udev-detect
.else
### Alternatively use the static hardware detection module (for systems that
### lack udev support)
load-module module-detect
.endif

From your log:
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module-device-restore.c: Sucessfully opened database file '/home/ubuntu/.pulse/edb88c50b54cfd6a9837a2474bbca403-device-volumes'.
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-device-restore" (index: #0; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module-stream-restore.c: Sucessfully opened database file '/home/ubuntu/.pulse/edb88c50b54cfd6a9837a2474bbca403-stream-volumes'.
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-stream-restore" (index: #1; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module-card-restore.c: Sucessfully opened database file '/home/ubuntu/.pulse/edb88c50b54cfd6a9837a2474bbca403-card-database'.
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-card-restore" (index: #2; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-augment-properties" (index: #3; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module-udev-detect.c: Found 1 cards.
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-udev-detect" (index: #4; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-bluetooth-discover" (index: #5; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-esound-protocol-unix" (index: #6; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-native-protocol-unix" (index: #7; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-gconf" (index: #8; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module-default-device-restore.c: Saved default sink 'alsa_output.usb-041e_USB_Audio-00-MP3.analog-stereo' not existant, not restoring default sink setting.
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module-default-device-restore.c: Saved default source 'alsa_input.usb-041e_USB_Audio-00-MP3.analog-stereo' not existant, not restoring default source setting.
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-default-device-restore" (index: #9; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-rescue-streams" (index: #10; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module-device-restore.c: Restoring volume for sink auto_null.
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module-device-restore.c: Restoring mute state for sink auto_null.
Apr 7 17:29:14 ubun...

Read more...

Revision history for this message
Daniel T Chen (crimsun) wrote :

Sorry, I was a bit unclear in the previous comment. The actual cause of the failure is correct, but the named module is module-default-device-restore.

Daniel T Chen (crimsun)
summary: - [USB-Audio - Sound Blaster MP3+] pactl stat failed to find default card
+ module-udev-detect races with module-default-device-restore
Revision history for this message
Daniel T Chen (crimsun) wrote :

I've uploaded a test package for lucid to ppa:ubuntu-audio-dev. Please test when built.

Changed in pulseaudio (Ubuntu):
status: Confirmed → Triaged
Daniel T Chen (crimsun)
Changed in pulseaudio (Ubuntu):
importance: Undecided → High
assignee: nobody → Daniel T Chen (crimsun)
Revision history for this message
Daniel T Chen (crimsun) wrote :

For everyone joining via duplicates, please read comment 7.

muszek (muszek)
description: updated
Revision history for this message
muszek (muszek) wrote :

Daniel T Chen: I've just added your repo and upgraded the packages. Rebooted. Nothing's change. Dummy output after boot, 'pulseaudio -k' fixes the sound.

Revision history for this message
Daniel T Chen (crimsun) wrote :

muszek, please edit /etc/pulse/daemon.conf and uncomment and change log-level to debug, logout, and login.

Revision history for this message
Daniel T Chen (crimsun) wrote :

Afterward, attach the results from grep pulseaudio\\[ /var/log/user.log

Revision history for this message
Martin Pitt (pitti) wrote :

Daniel,

just for the record, if the postponing of the PA startup causes such trouble, please feel free to revert it or lower the delay. That will cause a few extra PA instances to get launched during boot, but it's not that much boot speed difference (0.1 s or less).

Revision history for this message
Derek Holdaway (derek-holdaway) wrote :

After updating using the PPA I still have the problem that I reported in bug 558820 until I run the pulseaudio -k command.

I have attached the debug output that you had asked from muszek in case it helps.

Revision history for this message
Daniel T Chen (crimsun) wrote : Re: [Bug 557421] Re: module-udev-detect races with module-default-device-restore

Derek, your user.log reports only the older (not newer) PA config. Can you reproduce the symptom using a new user? Also, please attach output from "apt-cache policy pulseaudio".

Revision history for this message
Derek Holdaway (derek-holdaway) wrote :

Switching to a new user solves the problem on my system. With the PPA or straight from the live beta2.

--Output from "apt-cache policy pulseaudio"
pulseaudio:
  Installed: 1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu15~~lucid~ubuntuaudiodev2
  Candidate: 1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu15~~lucid~ubuntuaudiodev2
  Version table:
 *** 1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu15~~lucid~ubuntuaudiodev2 0
        500 http://ppa.launchpad.net/ubuntu-audio-dev/ppa/ubuntu/ lucid/main Packages
        100 /var/lib/dpkg/status
     1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu14 0
        500 http://archive.ubuntu.com/ubuntu/ lucid/main Packages

Daniel T Chen (crimsun)
Changed in pulseaudio (Ubuntu):
importance: High → Medium
Revision history for this message
muszek (muszek) wrote :

Used the same USB Live as before (the same PA packages, haven't upgraded anything at all). No sound. Created a new user, logged in as him and the sound worked.

Sorry for not replying sooner, haven't been around much lately.

Revision history for this message
Brian Knoll (brianknoll) wrote :

I just tried removing pulseaudio completely (which unfortunately does remove the "ubuntu-desktop" package as a dependency, but that's okay for my purposes) and I got my sound back. I have done this twice now and it worked both times. If I put pulseaudio back in, I lose sound.

Revision history for this message
Nicola Jelmorini (jelmorini) wrote :

I have tried just now the new Ubuntu 10.04 RC with a Live-USB pen session and now the sound function well from the login, without the need of commands like 'pulseaudio -k'.

Revision history for this message
Brian Knoll (brianknoll) wrote :

I just reinstalled from the Alternate Release Candidate ISO image, and my desktop installation worked fine for a few hours, then I noticed that I didn't get sound any more. I'm not sure if I rebooted before the sound went away, or what, but it had worked right from the install, then went away. So even if you get sound right at first, there is something that can trigger the sound to go away later on.

I did check the properties of the hardware, and now all I see is my "Dummy Output", just like I always see when the sound goes away. Right after the install it was showing the Intel audio device, and the sound was working then of course.

Revision history for this message
Brian Knoll (brianknoll) wrote :

Daniel, I tried to test your PPA package on my AMD64 system, but after adding your PPA to my Software Sources, I got the following error:

Failed to fetch http://ppa.launchpad.net/crimsun/ppa/ubuntu/dists/lucid/main/binary-amd64/Packages.gz 404 Not Found
Some index files failed to download, they have been ignored, or old ones used instead.

How can I help test this package?

Revision history for this message
Javier Zumbado (roqz) wrote :

I'm having this issue too, if I start or reboot this computer 10 times, 5 times I will get sound, and the other 5 times I won't. This is with the official Lucid Lynx / 10.4 release.

What is even weirder is that when I can't get sound, I can't shutdown or reboot either! If I select those options in GNOME, then I will be thrown out to GDM, and not even there I can shutdown or restart this PC. I have to go to a terminal and issue a shutdown command.

Also, sometimes when I restart the computer, I get the preferred resolution and refresh rate, and sometimes I get another random screen configuration (I installed the 195.53 nvidia driver from the ubuntu drivers application).

In other problem, I was unable to watch a movie with Totem without missing the sound every 30 seconds, I had to set up the ALSA sink in gstreamer-properties. Pulseaudio seems to be adding more problems than solutions.

This is a very recent computer, AMD Athlon X2, 4GB RAM, SATA hard drive, NVIDIA GeForce 8200 chipset. Everything worked fine and happy with Ubuntu 9.04.

It's impossible to use a PC that has such random behavior. I have just upgraded from 9.04 to 10.04 and I get only problems, so far this has been the most unstable and headache-inducing Ubuntu release, it is incredible that it is a LTS release.

Tell me what can I do, what I need to report, or whatever. I promised to deliver this computer tomorrow to my father with the latest and shiniest Ubuntu (He actually likes the updates every year and asked me to upgrade as soon as he read in the news of this new release), but I think I will need to rollback to 9.04 in such short notice. I'm really frustrated, it's 1am and I have been dealing with this for the whole night.

Have sweet dreams.

Revision history for this message
psidrum (flexsonic) wrote :

I have the same problem, i am using ALSA on Karmic 9.10, started to happen after upgrading to the latest kernel for Karmic kernel 2.6.31-21-generic

when i boot up, the audio sometimes starts, then it doesnt work , some of my applets are also not loaded, it is as if it is booting too fast and audio drivers are not loaded

when i had compiz off, the audio loaded every boot, once i have it on, it stops loading again,

Alsa driver is 1.20
i am on AMD64

Revision history for this message
psidrum (flexsonic) wrote :

Reverted back to kernel 2.6.31-20-generic just to see if audio works, = audio works fine, i rebooted to see if it will load and it loaded fine

Revision history for this message
Brian Knoll (brianknoll) wrote :

I think I might have found something: For me, this failure to detect my audio hardware seems to occur much more frequently when I have a bridged network set up on my eth0 device. If I don't do that, my audio is usually fine. If I DO set up a bridge on my eth0, however, then when I reboot I almost never have audio, and I have to run "alsa force-reload" to get audio.

Revision history for this message
Reptile (achapman) wrote :

This is still a problem with pulse reporting dummy output. Sometimes it can happen during a session even if the card was detected on boot up.

The kill trick works all the time in getting pulse to play nice but it's not exactly convenient.

Revision history for this message
Hairboy (tonycarbone) wrote :

Seconded - same issue for me, inconsistent detection of sound card.
AMD64, Realtek ALC883 card, Ubuntu 10.04 upgraded thru Update Manager yesterday.

Also, not sure if this is relevant but I can predict when there will be problems as the volume mixer fails to appear in the Panel on boot..... killall pulseaudio and then alsa force-reload works every time.

The only thing I've changed from the auto updates in the upgrade was
- remove "wins" from nsswitch.conf, as a fix to Rhythmbox crashing on launch; and
- sudo ln -s compiz compiz.real which was a fix to all windows/apps having no display style or borders on boot

Everything else is straight "out of the box" from update manager

Revision history for this message
linuxgeoff (linuxgeoff) wrote :

I have a similar problem. Since upgrading to 10.04, sometimes my USB SB MP3 external card is recognized and sometimes not. It was always fine up to 9.07, or maybe 9.04 - not sure. When the device is not recognized as present, I can see the card in lsusb, but not in aplay and It does not appear as an option in Pulse. If I run "alsa force-reload", it appears but does not function. I have set the USB device to 0 in /etc/modprobe.d/alsa.conf.

I have a suspicion that it's to do with timing - maybe pulse / alsa trying to install the card before it's fully woken up from being booted through the USB, or something like that. Clue. If I hold a key down during boot (after grun), then it loads the sound OK more often than if I don't.

Anyone know how to introduce a delay at the right point (i.e. after USB is initialized and before the audio system starts), so I can test this hypothesis?

Thanks, geoff

Revision history for this message
linuxgeoff (linuxgeoff) wrote :

bumpity bump. Can anyone help please? I can't used my music player (that's the machine's sole purpose). All I can think of doing is rolling back to 9.04 (which I'd really rather not)

Thanks, geoff

Revision history for this message
Mike Goldberg (gdimike-gmail) wrote :

Sorry for your problem.

In my case, removing the Timidity daemon solved the problem. (Silly of me to install it.) I have on board sound hardware. lspci found the hardware, ALSA found the hardware, but Pulseaudio (often) insisted that I had no sound card... until I purged the timidity daemon. After that, no problems. (Knocking wood...)

While I had this problem, I could always get audio by plugging in one of those inexpensive Chinese usb audio devices, both the cheap Tenx TP6911 devices or the more expensive C-Media guys. I would just plug them in after my computer finished booting.

Before you try a downrev to 9.04, try eliminating all the pulseaudio from your system, and see what happens. If that doesn't work, I wouldn't install 9.04, I'd install Debian squeeze.

Just my 2 cents.

Revision history for this message
David Henningsson (diwic) wrote :

I believe this is fixed in the upcoming version of Ubuntu, 12.04. Please reopen the bug if you can reproduce it in 12.04. Thanks!

Changed in pulseaudio (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.