Comment 5 for bug 557421

Revision history for this message
Daniel T Chen (crimsun) wrote : Re: [USB-Audio - Sound Blaster MP3+] pactl stat failed to find default card

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 ubuntu pulseaudio[4049]: sink.c: Created sink 0 "auto_null" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
Apr 7 17:29:14 ubuntu pulseaudio[4049]: sink.c: device.description = "Dummy Output"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: sink.c: device.class = "abstract"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: sink.c: device.icon_name = "audio-card"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: source.c: Created source 0 "auto_null.monitor" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
Apr 7 17:29:14 ubuntu pulseaudio[4049]: source.c: device.description = "Monitor of Dummy Output"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: source.c: device.class = "monitor"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: source.c: device.icon_name = "audio-input-microphone"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-null-sink" (index: #11; argument: "sink_name=auto_null sink_properties='device.description="Dummy Output"'").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-always-sink" (index: #12; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-intended-roles" (index: #13; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-suspend-on-idle" (index: #14; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: client.c: Created 0 "ConsoleKit Session /org/freedesktop/ConsoleKit/Session1"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: client.c: Created 1 "ConsoleKit Session /org/freedesktop/ConsoleKit/Session2"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: client.c: Created 2 "ConsoleKit Session /org/freedesktop/ConsoleKit/Session3"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: client.c: Created 3 "ConsoleKit Session /org/freedesktop/ConsoleKit/Session4"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: client.c: Created 4 "ConsoleKit Session /org/freedesktop/ConsoleKit/Session5"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: client.c: Created 5 "ConsoleKit Session /org/freedesktop/ConsoleKit/Session6"
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-console-kit" (index: #15; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4049]: module.c: Loaded "module-position-event-sounds" (index: #16; argument: "").
Apr 7 17:29:14 ubuntu pulseaudio[4047]: main.c: Daemon startup successful.
Apr 7 17:29:14 ubuntu pulseaudio[4049]: main.c: Daemon startup complete.
...
Apr 7 17:30:36 ubuntu pulseaudio[4049]: module-card-restore.c: Restoring profile for card alsa_card.usb-041e_USB_Audio-00-MP3.
Apr 7 17:30:36 ubuntu pulseaudio[4049]: card.c: Created 0 "alsa_card.usb-041e_USB_Audio-00-MP3"
Apr 7 17:30:36 ubuntu pulseaudio[4049]: module.c: Loaded "module-alsa-card" (index: #17; argument: "device_id="1" name="usb-041e_USB_Audio-00-MP3" card_name="alsa_card.usb-041e_USB_Audio-00-MP3" tsched=yes ignore_dB=no card_properties="module-udev-detect.discovered=1"").
Apr 7 17:30:36 ubuntu pulseaudio[4049]: module-udev-detect.c: Card /devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1:1.0/sound/card1 (alsa_card.usb-041e_USB_Audio-00-MP3) module loaded.

So, this is a bit tricky. We at least need to move the module-udev-detect earlier than the module-*-restore, but it will still be racy.