1

/!\ Update 2 Below - Pulseaudio is not the culprit, libpam-systemd does /!\

I've noticed that everytime I start a virtual machine from VirtualBox using gksu virtualbox %U, Pulseaudio do always crash. I then immediately have this error from VirtualBox:

No audio devices could be opened. Selecting the NULL audio backend
with the consequence that no sound is audible.

and

HostAudioNotResponding

Also, VMware Workstation states that it can't get sound, since this error spawned:

Cannot find /dev/dsp.

Which is true, since I can't even find that file.

However, the syslog doesn't say much about the crash:

May 31 18:18:58 HostName pulseaudio[3466]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:18:58 HostName pulseaudio[3466]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:18:58 HostName pulseaudio[3466]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:18:59 HostName pulseaudio[3471]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:18:59 HostName pulseaudio[3471]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:18:59 HostName pulseaudio[3471]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:18:59 HostName pulseaudio[3473]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:18:59 HostName pulseaudio[3473]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:18:59 HostName pulseaudio[3473]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:18:59 HostName pulseaudio[3475]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:18:59 HostName pulseaudio[3475]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:18:59 HostName pulseaudio[3475]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:18:59 HostName pulseaudio[3478]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:18:59 HostName pulseaudio[3478]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:18:59 HostName pulseaudio[3478]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:19:00 HostName pulseaudio[3483]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:19:00 HostName pulseaudio[3483]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:19:00 HostName pulseaudio[3483]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:19:09 HostName pulseaudio[3488]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:19:09 HostName pulseaudio[3488]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:19:09 HostName pulseaudio[3488]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:19:09 HostName pulseaudio[3490]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:19:09 HostName pulseaudio[3490]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:19:09 HostName pulseaudio[3490]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:19:17 HostName pulseaudio[3496]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:19:17 HostName pulseaudio[3496]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:19:17 HostName pulseaudio[3496]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:19:18 HostName pulseaudio[3498]: [autospawn] core-util.c: Failed to create secure directory (/run/user/1000/pulse): Permission denied
May 31 18:19:18 HostName pulseaudio[3498]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
May 31 18:19:18 HostName pulseaudio[3498]: [pulseaudio] main.c: Failed to acquire autospawn lock
May 31 18:20:28 HostName pulseaudio[1847]: [pulseaudio] protocol-native.c: Denied access to client with invalid authorization data.

Since it only says that Pulseaudio can't get restarted since the /run/user/1000/pulse/ got the infamous bug of being owned by root. Which I simply fixed with:

chown standardUser /run/user/1000/pulse/ && chgrp standardUser /run/user/1000/pulse/

But, still, no sign of what could have made crash Pulseaudio.

So the question is: What's making Pulseaudio crash and how to prevent it ?

Everything was done on an updated Debian 8.7 with the stock KDE desktop environment.


Update 1:

After a lot of try and guesses, I got some improvements by editing the /etc/pluse/default.pa file.

By enabling these Pulseaudio modules: - module-alsa-sink - module-oss device="/dev/dsp" sink_name=output source_name=input

Enabling module-oss with thses options, enables the /dev/dsp file; and prevents VMware Workstation to fire up its error.

Doing a modeprobe of: snd-pcm-oss

And disabling these modules:

  • module-esound-protocol-unix
  • module-suspend-on-idle

There is almost no bug at all (still got the VirtualBox one and the infamous pulse folder owned by root though), except this one I got from syslog:

May 31 22:09:11 HostName pulseaudio[3376]: Trying resume...
May 31 22:09:11 HostName pulseaudio[3376]: open '/dev/snd/pcmC0D0p' failed (-16)
May 31 22:09:11 HostName pulseaudio[3376]: Error opening PCM device front:0: Device or resource busy
May 31 22:09:11 HostName pulseaudio[3376]: Using generic matrix remapping

And this one since I manually started Pulseaudio by doing "pulseaudio -vvvv" :

I: [pulseaudio] client.c: Created 1 "Native client (UNIX socket client)"
D: [pulseaudio] protocol-native.c: Protocol version: remote 29, local 29
I: [pulseaudio] protocol-native.c: Got credentials: uid=0 gid=0 success=0
W: [pulseaudio] protocol-native.c: Denied access to client with invalid authorization data.
I: [pulseaudio] client.c: Freed 1 "Native client (UNIX socket client)"
I: [pulseaudio] protocol-native.c: Connection died.

Still, I can't understand why the "/dev/snd/pcmC0D0p" error comes, and why it's apparently a permission problem.

Apart from syslog and running Pulseaudio with ultra verbose mode, I do not know how I can track what's happening to Pulseaudio.

Is there any way I can provide more information about that crash ?


Update 2

In addition to what I've made in Update 1:

/etc/pulse/default.pa got appended:

module-native-protocol-unix auth-anonymous=1
module-native-protocol-tcp auth-anonymous=1 auth-ip-acl=127.0.0.1

/etc/pulse/client.conf got appended:

default-server = 127.0.0.1

modprobe snd-pcm-oss is still needed.

Everything related to Pulseaudio worked, even vmware didn't complained about not getting /dev/dsp (only works with modprobe snd-pcm-oss). No errors were found by Pulseaudio -vvvv or /var/log/syslog/ .

Unfortunately, sound is still missing while Pulseaudio is working perfectly.

Furthermore, I also tried to run Pulseaudio in system-mode; but things didn't get any better and the problem was the same.

So, it seemed that the main problem was about /run/user/1000/pulse getting owned by root, and means the real problem is that infamous bug.

After some research, I found out that libpam-systemd is causing that. This is a known bug that Debian got from Systemd, which has been reported for Debian Testing (Stretch) and Experimental; but not Stable at all:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732209

http://forums.debian.net/viewtopic.php?f=10&t=110035

https://bugs.debian.org/cgi-bin/pkgreport.cgi?dist=unstable;package=libpam-systemd

Concerning the 2nd link, I also confirm the "gksu gedit" problem, which I also applied the same workaround.

The problem seems unsolved, at least until the Debian Stable maintainers do update libpam-systemd.

On the other side, I've sent a bug report to them. Also, I recommend people facing this bug too to still report this bug again, so they can get a true confirmation.

Moreover, if anyone knows how to fix that bug in the meantime, I would gladly listen to any solution. This also includes recompiling libpam-systemd as a deb (since I don't know how to do it properly, in the Debian way), any hint is welcome.

1

I can explain the /dev/snd/pcmC0D0p error: This is an ALSA device. When Pulseaudio starts, it opens all ALSA devices it can find, and as ALSA hardware devices can't be shared and can only be opened once, the device gives a "busy" error next time someone tries to open it.

So if you run Pulseaudio in your main environment, and you've configured virtualbox to just "pass through" sound devices, the main Pulseaudio uses the device, so the virtualbox one can't.

If virtualbux emulates the sound device, you have something else running in the virtualbox that opens it, for example a second Pulseaudio instance. Use lsof and ps to find out which.

Modprobing snd-pcm-oss doesn't really help: That's the OSS emulation layer in ALSA, it povides /dev/dsp etc., which is just an alias to /dev/snd/pcmC0D0p with a different API. And if you enable both module-alsa-sink and module-oss in Pulseaudio, Pulseaudio will happily open both, which is of course nonsense. So disable the OSS stuff again, that's not the solution.

In my experience, pulseaudio -vvvv is enough to give you some idea what is actually going wrong. If you really get a crash, as in "segementation violation" etc., using strace or starting it with gdb, if possible on a version with debugging symbols, should again give you an idea what actually goes wrong.

I suspect your configuration has a gotcha somewhere, but I haven't enough information to figure it out.

  • Thanks for the answer. Unfortunately, the problem seems deeper than it was (see Update 2). But I'll mind what you said for enabling both module-alsa-sink and module-oss once the libpam-systemd bug is solved. – X.LINK Jun 2 '17 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.