Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
pulseaudio fails to create secure directory /run/user/1000/
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
orionbelt
Apprentice
Apprentice


Joined: 05 Apr 2006
Posts: 178

PostPosted: Tue Dec 04, 2018 1:08 pm    Post subject: pulseaudio fails to create secure directory /run/user/1000/ Reply with quote

The problem that i describe below started after successfully upgrading ~150 KDE packages from 5.13.5 to 5.14.3 yesterday. This is just a time coincidence but i'm mentioning it in case it's also the cause.

EDIT: In fact, i just noticed that media-sound/pulseaudio was also updated, to version 12.2, at the same time as the numerous KDE packages, and i missed it. So this has probably nothing to do with the KDE update, and is only related to the pulseaudio update.

After the upgrade i rebooted my system, and all worked fine, including sound/pulseaudio. However, at some later point, and without having done anything out of the ordinary, pulseaudio failed:
Code:
% ogg123 KDE_Beep_Classic.ogg
Failed to create secure directory (/run/user/1000/pulse): No such file or directory

The same error message was produced by mplayer and other audio software.

The pulseaudio server was running, but when i attempted to kill it in order to restart it, it could not find itself. And when i manually killed it, it would refuse to restart:
Code:
% ps x | grep pulse
 5743 ?        Sl     0:20 /usr/bin/pulseaudio --start --log-target=syslog
 5871 ?        Sl     0:00 /usr/libexec/pulse/gsettings-helper

% pulseaudio -k
E: [pulseaudio] main.c: Failed to kill daemon: No such process

% kill -QUIT 5743
% ps x | grep pulse
% pulseaudio --start
E: [pulseaudio] core-util.c: Failed to create secure directory (/run/user/1000/pulse): No such file or directory
N: [pulseaudio] main.c: User-configured server at {9dc58d757a30fea2b1570ca90000ce47}unix:/run/user/1000/pulse/native, refusing to start/autospawn.

# Trying it as root failed, too:
#
% pulseaudio --start
W: [pulseaudio] main.c: This program is not intended to be run as root (unless --system is specified).
N: [pulseaudio] main.c: User-configured server at {9dc58d757a30fea2b1570ca90000ce47}unix:/run/user/1000/pulse/native, refusing to start/autospawn.

At this point my KDE session quickly became unusable because every time an application or component would attempt to play a sound it would freeze. I attempted to log out of the KDE session but on the way out X froze and i had to reboot...

Upon rebooting, things returned to normal: Pulseaudio worked, and so did all the sound applications that i tried. Then i locked my screen and left. When i returned this morning, the same problem had reappeared, i.e. the "Failed to create secure directory (/run/user/1000/pulse): No such file or directory" error! I checked the system log for clues, but the only relevant thing is this message, written 1h45m after reboot:
Code:
Dec  4 06:05:47 pulseaudio[11409]: [pulseaudio] core-util.c: Failed to create secure directory (/run/user/1000/pulse): No such file or directory
Dec  4 06:05:47 pulseaudio[11409]: [pulseaudio] main.c: User-configured server at {9dc58d757a30fea2b1570ca90000ce47}unix:/run/user/1000/pulse/native, refusing to start/autospawn.

Since i was not using the computer during that time, the only program that produced a sound is the ogg123 line mentioned at the beginning, which beeps when email arrives. Indeed, i can confirm that the first email that i received after reboot arrived at the same time (06:05:36, but the beep can take a few seconds to occur).

In case it is relevant: My system is systemd-free, but as a Skype user i had to uninstall ConsoleKit and install elogind to make Skype work. But this happened several months ago, and i haven't had any sound problems during that time. I see that pulseaudio has a systemd USE flag, which in my case is deactivated. I don't know whether pulseaudio needs to interact with ConsoleKit, but if so, could it be that it somehow fails to work with elogind instead?

Many thanks in advance for any help.
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Wed Dec 05, 2018 12:19 am    Post subject: Reply with quote

When you get the message:
Code:
Failed to create secure directory (/run/user/1000/pulse): No such file or directory

Which directory does not exist?
1) Does /run/user/1000/ exist and does /run/user/1000/pulse NOT exist?
2) Or do neither /run/user/1000 nor /run/user/1000/pulse exist?

I guess that neither /run/user/1000 nor /run/user/1000/pulse exist. If I'm wrong: please ignore the rest of my post.

Please look at https://unix.stackexchange.com/questions/162900/what-is-this-folder-run-user-1000 to understand the rationale behind /run/user/<uid>.

As far as I know, ConsoleKit is responsible to set up /run/user/<uid> on non-Systemd machines (I might be wrong). So the problem could be related to your migration from ConsoleKit to elogind. Try to find out why /run/user/<uid> does not exist after you logged in to your machine.
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Wed Dec 05, 2018 1:09 am    Post subject: Reply with quote

orionbelt wrote:
Code:
W: [pulseaudio] main.c: This program is not intended to be run as root (unless --system is specified).

Is your installation running pulseaudio as root user instead of your user account?

Code:
fitzcarraldo@clevow230ss ~ $ ps aux | grep pulseaudio | grep -v grep
fitzcarraldo      4403  0.0  0.0 1327812 12812 ?       S<l  00:02   0:00 /usr/bin/pulseaudio --start --log-target=syslog


Does the directory /run/user/1000/pulse actually exist but is owned by root instead of your user account? Here is the situation on one of my Gentoo installations:

Code:
fitzcarraldo@clevow230ss ~ $ ls -la /run/user/1000/pulse
total 4
drwx------ 2 fitzcarraldo fitzcarraldo  80 Dec  5 00:02 .
drwx------ 5 fitzcarraldo fitzcarraldo 160 Dec  5 00:03 ..
srwxrwxrwx 1 fitzcarraldo fitzcarraldo   0 Dec  5 00:02 native
-rw------- 1 fitzcarraldo fitzcarraldo   5 Dec  5 00:02 pid


What USE flags are enabled in your installation of pulseaudio? These are the USE flag settings for pulseaudio-11.1-r1 (I have not yet upgraded to ~12.2) in one of my installations running elogind without any problems, for comparison:

Code:
X alsa alsa-plugin asyncns bluetooth caps dbus gdbm glib gnome gtk ipv6 jack orc qt5 ssl tcpd udev webrtc-aec zeroconf -doc -equalizer -libressl -libsamplerate -lirc -native-headset -neon -ofono-headset -oss -realtime -selinux -sox -system-wide -systemd -test

_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
orionbelt
Apprentice
Apprentice


Joined: 05 Apr 2006
Posts: 178

PostPosted: Wed Dec 05, 2018 2:11 am    Post subject: Reply with quote

mike155 wrote:
When you get the message:
Code:
Failed to create secure directory (/run/user/1000/pulse): No such file or directory

Which directory does not exist?
1) Does /run/user/1000/ exist and does /run/user/1000/pulse NOT exist?
2) Or do neither /run/user/1000 nor /run/user/1000/pulse exist?

I guess that neither /run/user/1000 nor /run/user/1000/pulse exist. If I'm wrong: please ignore the rest of my post.

Well, about 5 hours ago the problem happened again, and i had to reboot once again. Ever since, my sound is running OK, and /run/user/1000/pulse/ does exist, as expected:
Code:
% ls -n /run/user/1000/pulse/
total 4
srwxrwxrwx 1 1000 1000 0 Dec  4 21:29 native
-rw------- 1 1000 1000 5 Dec  4 21:29 pid

But i do remember that i looked for these directories when i was having this problem, and i am sure that /run/user/1000/pulse did not exist, and possibly not /run/user/1000/ either. But we'll have to wait for the problem to reoccur to confirm.

Quote:
Please look at https://unix.stackexchange.com/questions/162900/what-is-this-folder-run-user-1000 to understand the rationale behind /run/user/<uid>.

As far as I know, ConsoleKit is responsible to set up /run/user/<uid> on non-Systemd machines (I might be wrong). So the problem could be related to your migration from ConsoleKit to elogind. Try to find out why /run/user/<uid> does not exist after you logged in to your machine.

Thanks for the link. I hope that this is not the issue because then Skype users are out of luck, at least as long as the skype-dbus-mock package is not added to portage so that we can switch back to using ConsoleKit...

[ I would love to just stop using Skype if i could find another way to make unlimited landline calls to a specific country for a few euros a month... ]
Back to top
View user's profile Send private message
orionbelt
Apprentice
Apprentice


Joined: 05 Apr 2006
Posts: 178

PostPosted: Wed Dec 05, 2018 2:27 am    Post subject: Reply with quote

Fitzcarraldo wrote:
orionbelt wrote:
Code:
W: [pulseaudio] main.c: This program is not intended to be run as root (unless --system is specified).

Is your installation running pulseaudio as root user instead of your user account?

No, i run it as a regular user. I reluctantly tried root in desperation, just to test whether it was some kind of permissions problem. I included the output of both root and user in my first thread posting above.

Quote:
Does the directory /run/user/1000/pulse actually exist but is owned by root instead of your user account? Here is the situation on one of my Gentoo installations:

Code:
fitzcarraldo@clevow230ss ~ $ ls -la /run/user/1000/pulse
total 4
drwx------ 2 fitzcarraldo fitzcarraldo  80 Dec  5 00:02 .
drwx------ 5 fitzcarraldo fitzcarraldo 160 Dec  5 00:03 ..
srwxrwxrwx 1 fitzcarraldo fitzcarraldo   0 Dec  5 00:02 native
-rw------- 1 fitzcarraldo fitzcarraldo   5 Dec  5 00:02 pid


Please read my previous posting, in response to mike155. I (still) have sound after my last reboot, and my directory structure is currently identical to yours. But i think the pulse or the 1000/pulse part disappeared when sound was not working.

Quote:
What USE flags are enabled in your installation of pulseaudio? These are the USE flag settings for pulseaudio-11.1-r1 (I have not yet upgraded to ~12.2) in one of my installations running elogind without any problems, for comparison:

Code:
X alsa alsa-plugin asyncns bluetooth caps dbus gdbm glib gnome gtk ipv6 jack orc qt5 ssl tcpd udev webrtc-aec zeroconf -doc -equalizer -libressl -libsamplerate -lirc -native-headset -neon -ofono-headset -oss -realtime -selinux -sox -system-wide -systemd -test

I think my settings are very similar, and i don't think the differences could be related to my problem:
Code:
X alsa alsa-plugin asyncns caps dbus equalizer gdbm glib gnome ipv6 orc qt5 ssl tcpd udev webrtc-aec -bluetooth -doc -gtk -jack -libressl -libsamplerate -lirc -native-headset (-neon) -ofono-headset (-oss) -realtime (-selinux) -sox (-system-wide) -systemd -test -zeroconf
Back to top
View user's profile Send private message
orionbelt
Apprentice
Apprentice


Joined: 05 Apr 2006
Posts: 178

PostPosted: Wed Dec 05, 2018 2:42 am    Post subject: Reply with quote

An update:

I mentioned above that i rebooted some hours ago. However, before rebooting i downgraded to media-sound/pulseaudio-11.1-r1. I attempted to restart the downgraded pulseaudio before rebooting, but it failed again. So i rebooted, and for the moment (the downgraded) pulseaudio seems to be running smoothly.

There is one more change that i made. I start my X session with "startx" at the console, and in order to minimize the risk of someone CTRL-ALT-F1-ing to the console and accessing my account, i used to run it in the background ("startx >& /dev/null &") and then logging out of the console. However, some years ago i realized that this was the reason why i was getting KDE crashes a few hours into the session... So back at the time, i switched to just running "startx" or "startx >& ~/Xorg.txt" in the foreground and keeping the console open despite the small security risk. Some time later, i switched to sddm, so startx was no longer necessary. Unfortunately, however, sddm stopped working for me after a KDE upgrade about a year ago, and despite spending hours and hours trying to fix the problem it still doesn't work... So i had to switch back to using startx from the console, but i tried running it again in the background as "startx >& /dev/null &" just in case it was now working. Lo and behold, KDE would no longer crash, and this is how i have been launching startx for about a year now.

However, this problem with pulseaudio got me thinking, because pulseaudio also fails a few hours into the session like KDE used to, and managing sessions is what ConsoleKit and elogind do, so perhaps /run/user/1000/pulse/ gets deleted after logging out of the console and it causes the problem because X is still running...

So besides downgrading pulseaudio, i am now running "startx" without putting it in the background. As i said, so far so good. If i get no trouble within a day or so, i will upgrade pulseaudio to 12.2 once again and reboot. This should determine whether the culprit is the newer version of pulseaudio and/or running startx in the background (or none of the above...)
Back to top
View user's profile Send private message
orionbelt
Apprentice
Apprentice


Joined: 05 Apr 2006
Posts: 178

PostPosted: Mon Dec 10, 2018 5:42 pm    Post subject: Reply with quote

OK, so after more than a day of usage, pulseaudio-11.1-r1 did not crash. So i re-upgraded pulseaudio to 12.2, and rebooted my system, making sure to start X again in the foreground (i.e., as "startx >& Xorg.txt" and not as "startx >& Xorg.txt &"). After a couple of days of usage, i am happy to say that pulseaudio is still going.

So it would seem that the problem was related to logging out from the console after putting startx in the background. As i said, this used to crash KDE some years ago but not any longer. I am not sure whether it stopped being a problem due to KDE doing something about it or due to ConsoleKit doing something about it. In the second case, one might hope that elogind might do something similar, but i don't suppose this can easily happen (even if it were desirable, which it may not be for reasons that escape me) since elogind is presumably not supposed to deviate much from systemd's logind.

The only other solution that i can see is using sddm, which, as i said, for some reason refuses to work on my system even after spending hours on wikis and the forums... But this will probably be a topic of another thread :-)
Back to top
View user's profile Send private message
mega_flow
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2016
Posts: 84
Location: Belgium

PostPosted: Mon Dec 10, 2018 6:13 pm    Post subject: Reply with quote

pulseaudio like to keep running when you logout. But u make elogind to stop all procces when logging off
/etc/elogind/logind.conf "KillUserProcesses=yes"

Or u can try https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Permission_errors_bug
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21490

PostPosted: Tue Dec 11, 2018 1:49 am    Post subject: Reply with quote

What happens if, instead of logging out the console or leaving it open, you exec startx so that no shell is left behind? I suspect your problem is that some process is watching your login shell and, when that login shell exits, the supervisor assumes (incorrectly) that all state created for that login shell can now be removed. It then proceeds to delete your /run/userUID directory. Most of your programs handle that correctly, but pulseaudio fails badly. I would consider that a bug in pulseaudio: it should not hang or crash as a result of the directory being absent. It may not be able to work properly, but it could at least fail gracefully: play no sounds, but not hang or abort any programs.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum