Ticket #315 (closed defect: fixed)

Opened 3 months ago

Last modified 5 days ago

./pulse hidden directory

Reported by: gohanz Assigned to: lennart
Priority: normal Milestone: 0.9.11
Component: daemon Severity: normal
Keywords: Cc:

Description

Pulseaudio make an hidden directory "./pulse" on the root directory tree. Please take a look on uploaded image. This directory is empty. Another non-empty "./pulse" directory is present in home.

On my system Slackware 12.1 with (Gnome)GSlacky-2.22.1, pulseaudio is started in system-wide mode.

http://img157.imageshack.us/img157/3163/schermata1sj8.png

echo -n "Starting PulseAudio Daemon: $DAEMON --system --daemonize --high-priority --log-target=syslog"

/usr/bin/pulseaudio --system --daemonize --high-priority --log-target=syslog

if [ -e /var/run/pulse/.esd_auth ]; then

chown pulse:audio /var/run/pulse/.esd_auth chmod 640 /var/run/pulse/.esd_auth

fi if [ -e /var/run/pulse/.pulse-cookie ]; then

chown pulse:audio /var/run/pulse/.pulse-cookie chmod 640 /var/run/pulse/.pulse-cookie

fi echo "."

}

Attachments

pulseenviron.txt (214 bytes) - added by gohanz on 07/31/08 19:48:43.

Change History

06/27/08 12:12:21 changed by coling

I think you mean /.pulse not ./pulse :)

Running pulse in system wide mode is generally not recommended... it's only really appropriate for e.g. small embedded systems that do not really have a concept of users... or a system where you want multiple users to be able to play sound all at once (which IMO is nasty and could lead to eavesdropping but there may be some legitimate reasons for wanting this).

This is probably happening due to the fact that pulseaudio is run when $HOME is set to / for some user... (probably root during boot up or similar). I'm just guessing here. Be aware that it may not be the daemon starting that creates this folder; it could be a pulseclient that's doing it....

06/27/08 20:34:14 changed by gohanz

Thanks for preciuos help, and sorry for errors! :D

I have removed the .pulse directory and restarted my Slackware and Pulseaudio daemon in init3, then without X. And i think without any audio client. Ok, after boot and shell login, i see that the .pulse directory is present again on the root directory tree. Then i think that the problem is related on daemon starting! And this problem is present only on boot. If i remove again the .pulse and restart the daemon at prompt

/etc/rc.d/rc.pulseaudio restart

PulseAudio work fine but not make the .pulse directory on the root directory tree.

Thanks again. I don't understand if it is my PulseAudio setup problem or other. But, i repeat, PulseAudio work very fine, also ESD emulation.

06/28/08 13:09:53 changed by coling

Judging by what you say, it sounds suspiciously like certain environment variables are not set when starting pulse at boot. Normally pulse will create a .pulse folder in $HOME. I suspect this is not set at boot but once you login to restart the service, it is indeed set.

When starting in system wide mode, the daemon should drop privs to the pulse user and then create the .pulse dir. However, the code (at least in 0.9.10) explicitly uses a precompiled path, not the runtime path and issues a warning if the two do not match.

As --system is specified on the command line it should be hitting this pre-defined code path and never using the runtime stuff so this is pretty damn confusing.

So I don't think it's the daemon bit of the code that is doing this, but it's not to say it's not created when the daemon starts up. I suspect another codepath is present (probably when opening the config file or something) that also tries to create this same folder but it does not have use the same way of determining it....

Ahhhhh yes. here it is: core-util.c line 1136

This in turn uses pa_get_home_dir() to get the home directory. I'd place money on this being / at the time it's run.

It seems that when the daemon is started, it calls pa_daemon_conf_load() here. This is before change_user() is called which in turn sets the PULSE_CONFIG_PATH env var which in turn would have prevented pa_get_home_dir() from returning /...

Phew!

OK, now that I think I've found the problem, how to fix it!! The hacky way is to make sure your init script does export HOME=/var/run/pulse (or whatever the pulse user's home dir is on your system) before starting pulse. For the less hacky solution, I'll have to ask Lennart about this as I don't really know all the background to this code :)

06/28/08 13:13:06 changed by coling

Just to further my last post. When the daemon starts in system wide mode it is run by root. There fore the per-user daemon.conf that should be loaded should be /root/.pulse/daemon.conf... so your hacky solution above should actually export HOME=/root, not the home of the pulse user. I'm not sure this is fully intended anyway. In system wide mode, we should probably either:

  1. Use the pulse user's ~/.pulse folder, or
  2. Do not use any per-user overrides.

This is something for Lennart to comment on :)

06/30/08 11:00:20 changed by gohanz

Thanks again for technical information. After some test i made a very dirty hack! :D. I have added a simple rm -r /.pulse at the /etc/rc.d/rc.pulseaudio init script. Simple but seem work wery well. :)

pulseaudio_start () {

echo -n "Starting PulseAudio Daemon: $DAEMON --system --daemonize --high-priority --log-target=syslog"

/usr/bin/pulseaudio --system --daemonize --high-priority --log-target=syslog

if [ -e /var/run/pulse/.esd_auth ]; then

chown pulse:audio /var/run/pulse/.esd_auth chmod 640 /var/run/pulse/.esd_auth

fi if [ -e /var/run/pulse/.pulse-cookie ]; then

chown pulse:audio /var/run/pulse/.pulse-cookie chmod 640 /var/run/pulse/.pulse-cookie

fi echo "."

rm -r /.pulse }

07/30/08 20:31:06 changed by lennart

Could you please dump the environment variables of the running PA instance? (i.e.check /proc/$(pidof pulseaudio)/environ) Does any of them point to root's home directory?

07/31/08 12:20:33 changed by gohanz

Yes this is my /proc/2856

root@argo:/proc/2856# ls -l total 0 dr-xr-xr-x 2 pulse audio 0 2008-07-31 12:13 attr/ -r-------- 1 root root 0 2008-07-31 12:13 auxv --w------- 1 root root 0 2008-07-31 12:13 clear_refs -r--r--r-- 1 root root 0 2008-07-31 12:13 cmdline -rw-r--r-- 1 root root 0 2008-07-31 12:13 coredump_filter lrwxrwxrwx 1 root root 0 2008-07-31 12:13 cwd -> // -r-------- 1 root root 0 2008-07-31 12:13 environ lrwxrwxrwx 1 root root 0 2008-07-31 12:13 exe -> /usr/bin/pulseaudio* dr-x------ 2 root root 0 2008-07-31 12:13 fd/ dr-x------ 2 root root 0 2008-07-31 12:13 fdinfo/ -r-------- 1 root root 0 2008-07-31 12:13 limits -r--r--r-- 1 root root 0 2008-07-31 12:13 maps -rw------- 1 root root 0 2008-07-31 12:13 mem -r--r--r-- 1 root root 0 2008-07-31 12:13 mounts -r-------- 1 root root 0 2008-07-31 12:13 mountstats -rw-r--r-- 1 root root 0 2008-07-31 12:13 oom_adj -r--r--r-- 1 root root 0 2008-07-31 12:13 oom_score lrwxrwxrwx 1 root root 0 2008-07-31 12:13 root -> // -r--r--r-- 1 root root 0 2008-07-31 12:13 smaps -r--r--r-- 1 root root 0 2008-07-31 12:13 stat -r--r--r-- 1 root root 0 2008-07-31 12:13 statm -r--r--r-- 1 root root 0 2008-07-31 12:13 status dr-xr-xr-x 5 pulse audio 0 2008-07-31 12:13 task/ -r--r--r-- 1 root root 0 2008-07-31 12:13 wchan root@argo:/proc/2856#

07/31/08 12:23:37 changed by gohanz

root@argo:/proc/2856# ls -l

total 0

dr-xr-xr-x 2 pulse audio 0 2008-07-31 12:13 attr/

-r-------- 1 root root 0 2008-07-31 12:13 auxv

--w------- 1 root root 0 2008-07-31 12:13 clear_refs

-r--r--r-- 1 root root 0 2008-07-31 12:13 cmdline

-rw-r--r-- 1 root root 0 2008-07-31 12:13 coredump_filter

lrwxrwxrwx 1 root root 0 2008-07-31 12:13 cwd -> //

-r-------- 1 root root 0 2008-07-31 12:13 environ

lrwxrwxrwx 1 root root 0 2008-07-31 12:13 exe -> /usr/bin/pulseaudio*

dr-x------ 2 root root 0 2008-07-31 12:13 fd/

dr-x------ 2 root root 0 2008-07-31 12:13 fdinfo/

-r-------- 1 root root 0 2008-07-31 12:13 limits

-r--r--r-- 1 root root 0 2008-07-31 12:13 maps

-rw------- 1 root root 0 2008-07-31 12:13 mem

-r--r--r-- 1 root root 0 2008-07-31 12:13 mounts

-r-------- 1 root root 0 2008-07-31 12:13 mountstats

-rw-r--r-- 1 root root 0 2008-07-31 12:13 oom_adj

-r--r--r-- 1 root root 0 2008-07-31 12:13 oom_score

lrwxrwxrwx 1 root root 0 2008-07-31 12:13 root -> //

-r--r--r-- 1 root root 0 2008-07-31 12:13 smaps

-r--r--r-- 1 root root 0 2008-07-31 12:13 stat

-r--r--r-- 1 root root 0 2008-07-31 12:13 statm

-r--r--r-- 1 root root 0 2008-07-31 12:13 status

dr-xr-xr-x 5 pulse audio 0 2008-07-31 12:13 task/

-r--r--r-- 1 root root 0 2008-07-31 12:13 wchan

root@argo:/proc/2856#

07/31/08 12:35:48 changed by coling

That's not actually what Lennart asked for! Can you do:

cat /proc/$(pidof pulseaudio)/environ > pulseenviron.txt

Then attach the file pulseenviron.txt to this ticket :)

(also for raw output, just use three curly braces then a new line and close it with three curly braces on their own line - just check the WikiFormatting link :)

07/31/08 19:48:43 changed by gohanz

  • attachment pulseenviron.txt added.

07/31/08 19:50:17 changed by gohanz

Oh I'm sorry, now I understand! (i hope) :)

08/15/08 14:49:47 changed by lennart

Uh, what version of PA is this?

The problem seems to be that $HOME is set to / when the PA is started. Please try to unset HOME before you start it.

Newer versions of PA always overwrite $HOME properly ignoring what was previously set, when used in --system mode.

10/01/08 01:41:28 changed by lennart

  • status changed from new to closed.
  • resolution set to fixed.

Closing du to lack of response and because we overwrite HOME in newer versions of PA anyway.

10/01/08 03:33:01 changed by lennart

  • milestone set to 0.9.11.

10/01/08 20:04:18 changed by gohanz

Sorry for no response. Summer problem. However the problem is related to the 0.9.10 PA version. Now i'm working on Gnome-2.24.0 with PA 0.9.12 and libcanberra. PA now work like a charm, i have only a problem with the libcanberra and gnome-system-sounds, completely mute. Maybe i will open another thread. Sorry again, and thanks for great work. :D