pulseaudio hangs, prevents login, home as ntfs

Bug #330766 reported by Duncan Hawthorne on 2009-02-17
42
This bug affects 5 people
Affects Status Importance Assigned to Milestone
PulseAudio
Fix Released
Unknown
pulseaudio (Ubuntu)
Medium
Unassigned
Jaunty
Undecided
Unassigned

Bug Description

Binary package hint: pulseaudio

IMPACT: When pulseaudio can not write into ~/.pulse (either because of permissions or quota or some other issue), pulseaudio spins continually attempting to write its state into that directory. This can hang the login process.

DEVELOPMENT: A later upstream release included a patch to give up and fail to start if pulseaudio is unable to write its state into ~/.pulse, instead of spinning.

PATCH: Attached at <http://launchpadlibrarian.net/35285914/pulseaudio_0.9.14-0ubuntu20.3.debdiff> (test builds are in <https://launchpad.net/~broder/+archive/ubuntu-tests>). This simply backports the upstream fix to the release in Jaunty.

INSTRUCTIONS: chmod/chown ~/.pulse to root/root 700, then attempt to login.

REGRESSION: This patch is from upstream, and has been tested in later releases of both PA and Ubuntu.

============
Original bug description:

I have my home directory on an ntfs drive. fstab line for the ntfs drive is
UUID=DA103AC5103AA901 /windows ntfs defaults,umask=022,uid=1001,gid=1001 0 1

Log in as user 1001

Login screen disappears, goes to ubuntu brown background, and just waits. Can still move mouse, but no visual progress on screen (waited several times more than one minute). Then run
$ killall pulseaudio
from tty or from ssh from another computer, and then gnome loads, the panel appears, and everything (except for pulseaudio) works fine

Note that uninstalling pulseaudio (and everything related) lets me log in fine
Note that having my home directory on an ext3 drive works fine (sound works properly from pulseaudio too).
I also used an empty home folder for testing.

This kind of setup previously worked. On ubuntu hardy and intrepid, pulseaudio performed fine on a home directory on an ntfs drive. Does not work on jaunty

The .xsessions-errors give the following information about pulseaudio
I: caps.c: Limited capabilities successfully to CAP_SYS_NICE.
I: caps.c: Dropping root privileges.
I: caps.c: Limited capabilities successfully to CAP_SYS_NICE.
N: main.c: Called SUID root and real-time and/or high-priority scheduling was requested in the configuration. However, we lack the necessary privileges:
N: main.c: We are not in group 'pulse-rt', PolicyKit refuse to grant us the requested privileges and we have no increase RLIMIT_NICE/RLIMIT_RTPRIO resource limits.
N: main.c: For enabling real-time/high-priority scheduling please acquire the appropriate PolicyKit privileges, or become a member of 'pulse-rt', or increase the RLIMIT_NICE/RLIMIT_RTPRIO resource limits for this user.
E: core-util.c: Failed to create secure directory: Permission denied
W: lock-autospawn.c: Cannot access autospawn lock.
Terminated

The terminated is where I killed it, and everything else in the .xsessions-errors file looks fine

I have tried this setup on two laptops.
Happy to give more info.

$ lsb_release -rd
Description: Ubuntu jaunty (development branch)
Release: 9.04

$ apt-cache policy pulseaudio
pulseaudio:
  Installed: 0.9.14-0ubuntu6
  Candidate: 0.9.14-0ubuntu6
  Version table:
 *** 0.9.14-0ubuntu6 0
        500 http://archive.ubuntu.com jaunty/main Packages
        100 /var/lib/dpkg/status

description: updated
Mario Schwalbe (schwalbe) wrote :

Same for me. But in contrast to the OP this bug is not related to his NTFS home directory. I'm using ext3. A freshly created user account does work. Some old setting from Intrepid that's confusing pulseaudio.

Mario Schwalbe (schwalbe) wrote :

running pulseaudio without any arguments (if no pulseaudio is currently running):

W: main.c: High-priority scheduling enabled in configuration but not allowed by policy.
pa_make_secure_dir: dir: /home/mario/.pulse, mode: 0700, uid: -1, gid: -1
E: core-util.c: Failed to create secure directory: Permission denied
Exit 1

running pulseaudio --start instead:

W: main.c: High-priority scheduling enabled in configuration but not allowed by policy.
pa_make_secure_dir: dir: /home/mario/.pulse, mode: 0700, uid: -1, gid: -1
E: core-util.c: Failed to create secure directory: Permission denied
W: lock-autospawn.c: Cannot access autospawn lock.

does not terminate, but --start shall imply --daemonize according to the documentation.

Mario Schwalbe (schwalbe) wrote :

i've enhanced pulseaudio with some debugging messages in pa_make_secure_dir:

W: main.c: High-priority scheduling enabled in configuration but not allowed by policy.
pa_make_secure_dir: dir: /home/mario/.pulse, mode: 0700, uid: -1, gid: -1
pa_make_secure_dir: u: 0022, r: -1, errno: 17
pa_make_secure_dir: uid: 1000, gid: 1000
pa_make_secure_dir: !S_ISDIR(st.st_mode) == 1
pa_make_secure_dir: st.st_uid != uid == 0
pa_make_secure_dir: st.st_gid != gid == 0
pa_make_secure_dir: (st.st_mode & 0777) != m == 1
E: core-util.c: Failed to create secure directory: Permission denied

why does the function pa_make_secure_dir in pulsecore/core-util.c use lstat to stat the runtime directory instead of following the link and stating the target?

"this directory" is a symlink and the permission checks obviously fail.

Carl Johnstone (carljohnstone) wrote :

Had the same problem - checked my .pulse directory and it, and all the contents were owned by root.

I've deleted it and logged in again, and everything now seems to work fine.

The problem for potentially several people is that incorrect .pulse permissions can screw up pulseaudio working. And more importantly, the failure of pulseaudio starting means the entire desktop never gets to load up. However this can be fixed by a one off deleting of the .pulse directory, so when it respawns it has the correct permissions.

The problem for me especially (the OP) is that pulseaudio needs to put special permissions on the folder in the first place. This means that when using an ntfs drive for the home directory, or something similar, there is no chance for pulseaudio to change the permissions, as the drive doesnt support them. This turns this into a design error in pulseaudio rather than just a small upgrade type bug.

I should stress the other issue, why does pulseaudio hanging hold up the entire of gnome?

This is not a duplicate of bug #189060.
That bug is about permissions being wrong after an upgrade.

This bug is about:
1) incorrrect permissions causing all of gnome to wait
2) pulseaudio folder needing special permissions in the first place, which make it incompatible with using the ntfs partition as the home folder

This is the same bug with the same race condition as the culprit, thanks.

On Mar 7, 2009 5:30 PM, "Josh Smith" <email address hidden> wrote:

*** This bug is a duplicate of bug 189060 ***
https://bugs.launchpad.net/bugs/189060
This is not a duplicate of bug #189060.
That bug is about permissions being wrong after an upgrade.

This bug is about:
1) incorrrect permissions causing all of gnome to wait
2) pulseaudio folder needing special permissions in the first place, which
make it incompatible with using the ntfs partition as the home folder

-- pulseaudio hangs, prevents login, home as ntfs
https://bugs.launchpad.net/bugs/330766 You recei...

Mario Schwalbe (schwalbe) wrote :

This is no duplicate and no race condition, at all. In addition to points 1-2 by Josh Smith, I'd like to add:
3) if ~/.pulse is a symlink, pulseaudio fails to start although the target directory's permissions are correct

# ls -ld .pulse ../mario-sync/.pulse/
lrwxrwxrwx 1 mario mario 20 2008-10-10 16:53 .pulse -> ../mario-sync/.pulse
drwx------ 2 mario mario 4096 2008-10-10 16:53 /home/mario-sync/.pulse

the problem lies in pulsecore/core-util.c, function pa_make_secure_dir line 206 and following:

#ifdef HAVE_LSTAT
    if (lstat(dir, &st) < 0)
#else
    if (stat(dir, &st) < 0)
#endif
        goto fail;

#ifndef OS_IS_WIN32
    if (!S_ISDIR(st.st_mode) ||
        (st.st_uid != uid) ||
        (st.st_gid != gid) ||
        ((st.st_mode & 0777) != m)) {
        errno = EACCES;
        goto fail;
    }
#else
    pa_log_warn("Secure directory creation not supported on Win32.");
#endif

Since we are compiling for linux, 'lstat' is available. But pulseaudio should have used 'stat' instead, because in contrast to 'stat', 'lstat' returns the symlink's permissions (lrwxrwxrwx), not those of the target directory (drwx------).

Daniel T Chen (crimsun) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 10 Mar 2009, Mario Schwalbe wrote:

> This is no duplicate and no race condition, at all. In addition to points 1-2 by Josh Smith, I'd like to add:
> 3) if ~/.pulse is a symlink, pulseaudio fails to start although the target directory's permissions are correct

Have you strace -fF'd to confirm?

> the problem lies in pulsecore/core-util.c, function pa_make_secure_dir
> line 206 and following:
>
> #ifdef HAVE_LSTAT
> if (lstat(dir, &st) < 0)
> #else
> if (stat(dir, &st) < 0)
> #endif
> goto fail;
>
> #ifndef OS_IS_WIN32
> if (!S_ISDIR(st.st_mode) ||
> (st.st_uid != uid) ||
> (st.st_gid != gid) ||
> ((st.st_mode & 0777) != m)) {
> errno = EACCES;
> goto fail;
> }

The above changes can be addressed. What is being discussed is why root
has suddenly consumed the files, e.g., ~/.pulse-cookie.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJtvMCe9GwFciKvaMRAto4AJ9GxoK81YzFrj/okp3P+A95+Kzb6gCeOC8V
4rxJ/5AQB4qCRV/TmZA5cyk=
=31a7
-----END PGP SIGNATURE-----

Mario Schwalbe (schwalbe) wrote :

> Have you strace -fF'd to confirm?

No, I read the sources. But if you like:

umask(077) = 022
mkdir("/home/mario/.pulse", 0700) = -1 EEXIST (File exists)
umask(022) = 077
getuid() = 1000
getgid() = 1000
chown("/home/mario/.pulse", 1000, 1000) = 0
chmod("/home/mario/.pulse", 0700) = 0
lstat("/home/mario/.pulse", {st_mode=S_IFLNK|0777, st_size=20, ...}) = 0
rmdir("/home/mario/.pulse") = -1 ENOTDIR (Not a directory)
ioctl(2, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(2, "E: core-util.c: \33[1;31mFailed to "..., 80) = 80

Woif (w-woif) wrote :

Hi,

I have the same Problem. This affects also other applications that use pulseaudio too (e.g., Skype). Is there already a solution to this issue?

Best regards.

    Wolfgang

reported it upstream here: http://pulseaudio.org/ticket/539
a workaround was supplied

Changed in pulseaudio:
status: Unknown → New
Dan Lea (danlea) wrote :

I'd just like to make clear how important this issue could be, since I spent almost a whole day trying to get my work computer to log in under my main user without a failsafe Gnome session after upgrading to Jaunty, due to the specific reason mentioned by Josh.

Daniel T Chen (crimsun) wrote :

It's in the SRU work queue.

On Apr 24, 2009 6:10 PM, "Dan Lea" <email address hidden> wrote:

I'd just like to make clear how important this issue could be, since I
spent almost a whole day trying to get my work computer to log in under
my main user without a failsafe Gnome session after upgrading to Jaunty,
due to the specific reason mentioned by Josh.

-- pulseaudio hangs, prevents login, home as ntfs
https://bugs.launchpad.net/bugs/330766 You recei...

Simeon Walker (simeon-walker) wrote :

I'd just like to add that it's not just ntfs. I see the same problem on a machine (authenticated via ldap to AD) mounting homes via cifs using pam_mount.

vnevoa (vasco-nevoa) wrote :

I've got the same problem with a locally authenticated user, but with a CIFS home dir in fstab (_netdev option).

My present workaround is:
sudo /etc/init.d/gdm stop
rm -rf .pulse
sudo /etc/init.d/gdm start

But it has to be done every single time I turn on the machine.
A more permanent workaround would be much appreciated.

Changed in pulseaudio:
status: New → Fix Released
Evan Broder (broder) wrote :

As far as I can tell, the version of PulseAudio currently in Karmic contains commit 277822053c2f070940e5a996b9a6d95645d74590, which should fix this bug.

Attached is a debdiff that backports the patch for Jaunty as well; I'm running a test build in my PPA now (https://launchpad.net/~broder/+archive/ubuntu-tests).

Geoffrey Thomas (geofft) wrote :

I installed the Jaunty backport from Evan's PPA, and it fixes the problem for me. (For bonus points, most audio seems to fall back to ALSA directly if Pulse doesn't start.)

I'm running into this issue with a home directory in the AFS networked file system that's exceeded its quota; if you can't log in at all, you can't get to your files to delete them.

Marking as confirmed and subscribing ubuntu-sru.

Changed in pulseaudio (Ubuntu):
status: New → Confirmed
Daniel T Chen (crimsun) on 2009-08-10
Changed in pulseaudio (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
Christoph (christop) wrote :

This fixes does not work for me, but as I am using cifs and not ntfs I opened a new bug at https://bugs.launchpad.net/ubuntu/+bug/429533 and attached a workaround. With cifs the problems seems to be that, broken symlinks are not taken care of. This causes pulseaudio not beeing able to set permissions on a non existing dir.

Evan Broder (broder) wrote :

Whoops! It was pointed out to me that I targetted the update for jaunty-updates instead of jaunty-proposed. Here's a new debdiff that corrects for that.

Scott Kitterman (kitterman) wrote :

Is this fixed in Karmic/Lucid already?

Daniel T Chen (crimsun) wrote :

The NTFS one is fixed in Karmic & Lucid.

Evan Broder (broder) on 2009-11-07
description: updated
Scott Kitterman (kitterman) wrote :

Uploaded for jaunty-proposed. Thank you for your contribution to Ubuntu. It won't be available for testing until it's accepted by ubuntu-sru.

Changed in pulseaudio (Ubuntu Jaunty):
status: New → In Progress
milestone: none → jaunty-updates

Accepted pulseaudio into jaunty-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in pulseaudio (Ubuntu Jaunty):
status: In Progress → Fix Committed
tags: added: verification-needed
jama (elmiwab) wrote :

how to make youtube work

jama (elmiwab) wrote :

can anyone help me how to make youtube work to load or add flash my javascript is an enable

Evan Broder (broder) wrote :

jama: This page is for discussion of a specific bug in Ubuntu, which is described at the top of the page. It's not the right place for general Ubuntu-related discussion. If you need help with using Ubuntu, you can try the Answers section (https://answers.launchpad.net/ubuntu)

Evan Broder (broder) wrote :

I've verified that the packages in proposed fix the login hangs we were experiencing here.

Martin Pitt (pitti) on 2009-11-13
tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:0.9.14-0ubuntu20.3

---------------
pulseaudio (1:0.9.14-0ubuntu20.3) jaunty-proposed; urgency=low

  * Cherry-pick 27782205 from upstream; this causes PulseAudio to exit out
    if it is unable to create a lock file at startup (LP: #330766).
 -- Evan Broder <email address hidden> Sun, 09 Aug 2009 20:13:09 -0400

Changed in pulseaudio (Ubuntu Jaunty):
status: Fix Committed → Fix Released
Martin Pitt (pitti) on 2009-11-17
Changed in pulseaudio (Ubuntu):
assignee: nobody → Evan Broder (broder)
milestone: none → lucid-alpha-1
Evan Broder (broder) wrote :

This was fixed upstream. As far as I'm aware, the fix hasn't regressed in Lucid, so I'm closing the bug. Please re-open if I'm mistaken.

Changed in pulseaudio (Ubuntu):
assignee: Evan Broder (broder) → nobody
status: Triaged → Fix Released
Eric (ericvmelo) wrote :

I have karmic with pulseaudio 1:0.9.19-0ubuntu4 and home as ntfs and still have this problem. Pulseaudio doesn't start.

eric@eric:~$ pulseaudio
E: core-util.c: Failed to create secure directory: Permission Denied

My partition is like this in fstab:
/dev/sda5 /home ntfs-3g nodev,nosuid,relatime,uid=1000,gid=1000,umask=022,locale=pt_BR.UTF-8 0 0

Yep, that was intentionally the resolution of this bug - instead of
hanging in the middle of the login process, pulseaudio now gives up.

It's certainly not the perfect solution, but it's better than not
being able to login. I'm not sure whether or not we can expect a
better fix from pulseaudio upstream.

On Sun, Dec 6, 2009 at 11:47 PM, Eric <email address hidden> wrote:
> I have karmic with pulseaudio 1:0.9.19-0ubuntu4 and home as ntfs and
> still have this problem. Pulseaudio doesn't start.
>
> eric@eric:~$ pulseaudio
> E: core-util.c: Failed to create secure directory: Permission Denied
>
> My partition is like this in fstab:
> /dev/sda5 /home ntfs-3g nodev,nosuid,relatime,uid=1000,gid=1000,umask=022,locale=pt_BR.UTF-8 0 0
>
> --
> pulseaudio hangs, prevents login, home as ntfs
> https://bugs.launchpad.net/bugs/330766
> You received this bug notification because you are a member of Debathena
> Project, which is a direct subscriber.
>

Volcano (bjorn-boonen) wrote :

For me the problem isn't solved, i tried the workarounds above.
I have my home directory on a ntfs partition. I have no problems with booting and sound is playing (on most programs like rhytmbox and amarok but is not paying on Mplayer).
But as Pulsaudio isn't starting up, i can't choose which of my 2 soundcards i want to use or any other audio setting...
please some advise for an other workaround (maybe another program)

Andrew Smart (andrew.j.smart) wrote :

Volcano, I have a solution that worked for me (my brother's home partition was NTFS). Though I didn't think to update pulseaudio to see if the most recent one fixed the problem...

Make a small partition around 5 MiB with a file system that supports symbolic links (like ext3). Mount that partition to /home/volcano/.pulse/ in fstab.
Make sure you set everything in there to have the right permissions too:
"chmod/chown ~/.pulse to root/root 700"
I found that volcano/volcano instead of root/root will work too.

This way pulse audio can make a symbolic link from ~/.pulse to /tmp and succeed!

Nasty work around; I know. But it is a way to get pulseaudio working while your home partition is NTFS, which is better than falling back to ALSA (which I assume is the most up to date behavior in this situation).

Michael Zaugg (AOI) (it-oas) wrote :

This is an old bug but the issue remains if mounting homefolder with cifs.
If unix extensions are not enabled in samba pulseaudio cannot create a symlink to /tmp.

To workaround this you can use solution #34 (https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/330766/comments/34) or use the bind command (no need of an extra partition):

e.g. mount --bind /tmp/volcano /home/volcano/.pulse

For even more flexibility use pam_mount:
e.g <volume path="/tmp/%(USER)" mountpoint="~/.pulse" options="bind" />

Please note: the folder /tmp/volcano has to exist with owner:group volcano:volcano.

AllAboutMike (mike-aacomp) wrote :

This seems to be back in 12.04 LTS!
Same work around using mount --bind fixes it there too. Is this just a regression because someone forgot the NFS issue, or a new problem?

brian baker (brian-m-baker) wrote :

have the same problem with ntfs as home partition using the 13.04 seems to be a regression will try the bind work around!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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