[pulseaudio-discuss] pulseaudio start stop
Colin Guthrie
gmane at colin.guthr.ie
Wed Apr 6 07:08:52 PDT 2011
[Please keep the list CC'ed on replies so other people can help and
benefit form the advice and debugging process!]
'Twas brillig, and duportail at 06/04/11 14:29 did gyre and gimble:
> Op 6-4-2011 15:18, Colin Guthrie schreef:
>> 'Twas brillig, and duportail at 06/04/11 12:36 did gyre and gimble:
>>> Op 6-4-2011 13:14, duportail schreef:
>>>> I am setting the default sink for the user at log-in according the
>>>> display he is on.
>>>> First time login is ok, but if the user logs out and logs in at
>>>> another display, pulse does not start with error (sorry, in dutch)
>>>> E: socket-server.c: bind(): Adres is al in gebruik
>>>> E: module.c: Failed to load module "module-esound-protocol-unix"
>>>> (argument: ""): initialization failed.
>>>> E: main.c: Module load failed.
>>>> E: main.c: Initialiseren van de daemon mislukt.
>>>> Can I do something at the user logout?
>>>> gd
>>> Ok, found it.Removing the /tmp/.esd(uid) did it.But why is this left
>>> ,after the user is logged out?
>> When you say /tmp/.esd(uid) what do you mean?
>>
>> On my system we use /tmp/.esd-uid/. This prevents one user from clashing
>> with another (although that doesn't prevent malicious DoS by another
>> user just creating lots of folder names - this is one of the problems
>> with ESD socket path - we solve that in PA and now in systemd with some
>> clever logic).
>>
>> Anyway, in the very old days, the ESD socket was just /tmp/.esd which
>> totally sucked in a multi-user environment. Most distros patch libesound
>> to make it /tmp/.esd-$UID but that's still sucky for deliberate DoS as
>> noted above.
>>
>> PA has the option to emulate either structure of socket paths via
>> configure switches. I suggest you ensure that your libesound and
>> pulseaudio packages are in sync in this regard. As your distro
>> maintainer to speak with us on IRC or via replying to this thread if you
>> like.
>>
>>
>> Alternatively, this problem could be simply that you are not using PID
>> files and you're trying to start two pulseaudio daemons for the same
>> user. This is not supported. PA is a per-user process. The user should
>> only run one instance of PA. PID files typically prevent this, but this
>> can be disabled.
>>
>>
>>
>> Either way something is not quite right on your system to be causing
>> this problem and I hope I've pointed you in the right direction for
>> debugging.
>
> Correct,it's /tmp/.esd-$UID/socket
> Removing this upon re-login of the user at an other display,makes the
> pulseaudio starting.
So the same user is logging in on separate displays?
OK, there are some fundamental things here you need to appreciate:
1. PA is per-user, not per-display, there should only ever be one
pulseaudio daemon running. Please confirm this.
2. You should not have to remove the socket (indeed another instance of
pulseaudio will already be running and have this socket open so it's
generally bad practice to remove it anyway (it'll still be kept as an
open file handle until the PA process is stopped)). If another process
is using the socket, find out which process it is and work out how to
prevent it running. Ensure that only one PA process is running, but try
and find out what is causing your esound error... How do you start PA?
Is there any special script you use?
3. pacmd (which you use on your script) works with a daemon, not a
display. As you should only have one daemon running per-user, running
pacmd when the same user logs in on another display will change the
default for all displays. You should really set PULSE_SINK property on
the X11 root window instead: e.g. xprop -root -f PULSE_SINK 8s -set
PULSE_SINK
alsa_output.usb-0d8c_C-Media_USB_Audio_Device-00-default_1.analog-stereo
4. Multiple logins for the same user on different displays is something
that is generally being deprecated, so you should likely avoid this in
your setup.
5. I'm not sure what you are trying to acheive, but it seems like some
kind of multi-seat setup? If this is the case you should configure you
seats better. IMO, what you should do is allocate a (different) user to
each seat, then write your udev rules such that certain USB ports are
allocated to each user (or rather each seat, but with a 1:1 mapping this
doesn't matter). Then start a separate PA daemon for each user (and thus
each seat). Due to the udev permissions, each individual user should
only have access to their own USB port and thus they will each only ever
see one USB sound card each. All the problems are solved!
I've not gone into too much detail as I don't know the intricate
details, but hopefully this helps you in some small way.
Col
[Original reply left below for the benefit of the list]
> I use such bash code to assign sink to a display:
> if [ "$DISPLAY" ]
> then
> if [ "$DISPLAY" = ":1.0" ]
> then
> /usr/local/sbin/uid.sh
> pacmd "set-default-sink
> alsa_output.usb-0d8c_C-Media_USB_Audio_Device-00-default.analog-stereo"
> fi
> if [ "$DISPLAY" = ":2.0" ]
> then
> /usr/local/sbin/uid.sh
> pacmd "set-default-sink
> alsa_output.usb-1130_USB_AUDIO-00-default_3.analog-stereo"
> fi
> if [ "$DISPLAY" = ":3.0" ]
> then
> /usr/local/sbin/uid.sh
> pacmd "set-default-sink
> alsa_output.usb-0d8c_C-Media_USB_Audio_Device-00-default_1.analog-stereo"
> fi
> if [ "$DISPLAY" = ":4.0" ]
> then
> /usr/local/sbin/uid.sh
> pacmd "set-default-sink
> alsa_output.usb-1130_USB_AUDIO-00-default_2.analog-stereo"
> fi
> fi
>
> The script uid.sh just removes the /tmp/esd-$uid with:
> uid=$(id -u "$USER")
> echo $uid
> rm -R /tmp/.esd-$uid
>
> however, pulseaudio sometimes still uses the first sink it founds to set
> it as default for the user.I do not know why.
> Can pulseaudio be set that when the sink is not found, do not set a
> sink.Rather than take a sink that is from another user.
> gd
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mageia Contributor [http://www.mageia.org/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
More information about the pulseaudio-discuss
mailing list