system won't suspend if pulseaudio is running as user "pulse"

Bug #476505 reported by LarryGrover
36
This bug affects 8 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Fix Released
Low
Daniel T Chen

Bug Description

Binary package hint: pulseaudio

After upgrading from 9.04 to 9.10, suspend is broken on my laptop (suspend worked fine on 9.04):
*closing the lid fails to suspend
*clicking on indicator-applet-session in the panel and selecting "suspend" fails
*running "sudo pm-suspend" fails

However, running
echo "mem" | sudo tee /sys/power/state
does suspend my laptop

The pm-suspend log file, /var/log/pm-suspend.log, shows:

/usr/lib/pm-utils/sleep.d/00powersave suspend suspend: success.
/usr/lib/pm-utils/sleep.d/01PulseAudio suspend suspend: No PulseAudio daemon running, or not running as session daemon.
No PulseAudio daemon running, or not running as session daemon.
Returned exit code 1.
Fri Nov 6 09:07:03 EST 2009: Inhibit found, will not perform suspend
Fri Nov 6 09:07:03 EST 2009: Running hooks for resume
/usr/lib/pm-utils/sleep.d/00powersave resume suspend: success.
/usr/lib/pm-utils/sleep.d/00logging resume suspend: success.
/usr/lib/pm-utils/sleep.d/00auto-quirk resume suspend: success.
/usr/lib/pm-utils/sleep.d/000record resume suspend: success.

And sure enough, the problem is in the file /usr/lib/pm-utils/sleep.d/01PulseAudio. If I make 01PulseAudio non-executable, then my laptop can suspend normally. On my system, pulseaudio is running as user "pulse" (UID 119). If I kill all pulseaudio processes, then suspend works normally. Also, if pulseaudio is running as my regular user (UDI 1000), then suspend works normally.

ProblemType: Bug
Architecture: i386
ArecordDevices:
 **** List of CAPTURE Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/dsp', '/dev/snd/by-path', '/dev/snd/controlC0', '/dev/snd/pcmC0D1p', '/dev/snd/pcmC0D0c', '/dev/snd/pcmC0D0p', '/dev/snd/hwC0D0', '/dev/snd/hwC0D1', '/dev/snd/seq', '/dev/snd/timer', '/dev/sequencer', '/dev/sequencer2'] failed with exit code 1:
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xb0000000 irq 22'
   Mixer name : 'Analog Devices AD1986A'
   Components : 'HDA:11d41986,17aa2066,00100500 HDA:11c11040,11c10001,00100200'
   Controls : 21
   Simple ctrls : 12
Date: Fri Nov 6 08:43:09 2009
DistroRelease: Ubuntu 9.10
Package: pulseaudio 1:0.9.19-0ubuntu4
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-14.48-generic
SourcePackage: pulseaudio
Uname: Linux 2.6.31-14-generic i686
mtime.conffile..etc.default.pulseaudio: 2009-05-28T01:14:44.950410

Related branches

Revision history for this message
LarryGrover (lgrover) wrote :
Revision history for this message
Daniel T Chen (crimsun) wrote : Re: [Bug 476505] Re: system won't suspend if pulseaudio is running as user "pulse"

Are you using a system-wide instance of PA, and why?

On Nov 6, 2009 9:20 AM, "LarryGrover" <email address hidden> wrote:

** Attachment added: "AlsaDevices.txt"
  http://launchpadlibrarian.net/35247694/AlsaDevices.txt

** Attachment added: "AplayDevices.txt"
  http://launchpadlibrarian.net/35247697/AplayDevices.txt

** Attachment added: "BootDmesg.txt"
  http://launchpadlibrarian.net/35247698/BootDmesg.txt

** Attachment added: "Card0.Amixer.values.txt"
  http://launchpadlibrarian.net/35247699/Card0.Amixer.values.txt

** Attachment added: "Card0.Codecs.codec.0.txt"
  http://launchpadlibrarian.net/35247700/Card0.Codecs.codec.0.txt

** Attachment added: "Card0.Codecs.codec.1.txt"
  http://launchpadlibrarian.net/35247701/Card0.Codecs.codec.1.txt

** Attachment added: "CurrentDmesg.txt"
  http://launchpadlibrarian.net/35247702/CurrentDmesg.txt

** Attachment added: "Dependencies.txt"
  http://launchpadlibrarian.net/35247703/Dependencies.txt

** Attachment added: "PciMultimedia.txt"
  http://launchpadlibrarian.net/35247704/PciMultimedia.txt

** Attachment added: "XsessionErrors.txt"
  http://launchpadlibrarian.net/35247705/XsessionErrors.txt

** Attachment added: "modified.conffile..etc.default.pulseaudio.txt"

http://launchpadlibrarian.net/35247706/modified.conffile..etc.default.pulseaudio.txt

-- system won't suspend if pulseaudio is running as user "pulse"
https://bugs.launchpad.net/bugs/4...

Revision history for this message
LarryGrover (lgrover) wrote :

Yes, as you can see in the attached file (modified.conffile..etc.default.pulseaudio.txt), pulseaudio was set to start in system mode (I have changed this setting back to the default). I don't remember why I set this option, but it was probably an attempt work around some problem I was having with pulseaudio in 9.04.

Even if this configuration is not recommended, the suspend scripts should be robust enough to handle it (or else this configuration should not be possible).

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

Sure, there's a bug in the pm-utils script. On the other hand, don't blindly
assume that I can read attachments. This device doesn't allow me to. ;-)

On Nov 6, 2009 10:25 AM, "LarryGrover" <email address hidden> wrote:

Yes, as you can see in the attached file
(modified.conffile..etc.default.pulseaudio.txt), pulseaudio was set to
start in system mode (I have changed this setting back to the default).
I don't remember why I set this option, but it was probably an attempt
work around some problem I was having with pulseaudio in 9.04.

Even if this configuration is not recommended, the suspend scripts
should be robust enough to handle it (or else this configuration should
not be possible).

-- system won't suspend if pulseaudio is running as user "pulse"
https://bugs.launchpad.net/bugs/4...

Revision history for this message
LarryGrover (lgrover) wrote :

If my previous comment about the attached file sounded snotty, sorry, I didn't intend it that way. I was just trying to point to relevant information in the original bug report.

After reading some more, and comparing the 01PulseAudio scripts in 9.04 and 9.10, it seems that the pacmd command used in the newer script does not work when pulseaudio is run in system mode. Perhaps the get_pulse_users function in the script should just ignore the pulse user? Something like this:

get_pulse_users() {
    ps -C pulseaudio -o uid= | tr -d ' ' | sed s/119//
}

This change seems to work on my system: I can suspend and resume with pulseaudio running in system mode, and sound works after resuming.

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

On Fri, Nov 6, 2009 at 2:20 PM, LarryGrover <email address hidden> wrote:
> ps -C pulseaudio -o uid= | tr -d ' ' | sed s/119//

Hmm, but (getent group pulse) is preferable. Does the following for
the function work for you?

ps -C pulseaudio -o uid= | tr -d ' ' | sed s/$(getent group pulse |
awk -F: '{print $3}')//

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

A more robust version has been pushed to lp:~crimsun/pulseaudio/lucid

Daniel T Chen (crimsun)
Changed in pulseaudio (Ubuntu):
status: New → In Progress
assignee: nobody → Daniel T Chen (crimsun)
importance: Undecided → Low
Revision history for this message
LarryGrover (lgrover) wrote :

The following works (use getent passwd, not getent group):
ps -C pulseaudio -o uid= | tr -d ' ' | sed s/$(getent passwd pulse | awk -F: '{print $3}')//

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

True, passwd is semantically the correct one. I wonder, though, that we
shouldn't bail on the sed expression, so I've done a bit of sanity-checking
in the pm-utils script (you can double-check via loggerhead).

On Nov 6, 2009 11:20 PM, "LarryGrover" <email address hidden> wrote:

The following works (use getent passwd, not getent group):
ps -C pulseaudio -o uid= | tr -d ' ' | sed s/$(getent passwd pulse | awk -F:
'{print $3}')//

-- system won't suspend if pulseaudio is running as user "pulse"
https://bugs.launchpad.net/bugs/4...
Status in “pulseaudio” package in Ubuntu: In Progress

Bug description: Binary package hint: pulseaudio After upgrading from 9.04
to 9.10, suspend is bro...

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:0.9.19-2ubuntu2

---------------
pulseaudio (1:0.9.19-2ubuntu2) lucid; urgency=low

  * debian/control:
    + Promote pulseaudio-utils to Depends for pulseaudio so that the
      pm-utils script is present (LP: #478182)
    - Drop obsolete Depends on pulseaudio-module-udev for pulseaudio
      (LP: #477382)
  * debian/01PulseAudio: Don't fail suspend/resume when system-wide
    daemon is running (LP: #476505)
 -- Daniel T Chen <email address hidden> Fri, 06 Nov 2009 18:37:36 -0500

Changed in pulseaudio (Ubuntu):
status: In Progress → 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.