Pulseaudio and Autologin Problem
#1
Hi,

I am running kodi with Kubuntu 14.04 and am trying to get kodi to autostart in ALSA mode by temporarily killing off Pulseaudio before kodi starts and then starting it again when kodi exits. I believe this is a fairly standard approach which I found somewhere else on this forum. I have created a new session file in /usr/share/xsessions/kodi-alsa.desktop containing the following :

[Desktop Entry]
Name=kodi-alsa
Comment=kodi-alsa
Exec=/home/kodi/kodi_alsa_starter
TryExec=/home/kodi/kodi_alsa_starter
Type=Application

and also created a file /home/kodi/kodi_alsa_starter containing the following

#!/bin/bash
# Kill PulseAudio
echo autospawn = no > ~/.config/pulse/client.conf
pulseaudio --kill
# Start Kodi
kodi-standalone
# Start Pulse Audio
rm ~/.config/pulse/client.conf
pulseaudio --start

The file /etc/lightdm/lightdm.conf contains the following

[SeatDefaults]
autologin-user=kodi
user-session=kodi-alsa
greeter-session=lightdm-kde-greeter
allow-guest=false

When I boot the machine, kodi starts automatically as expected but there is no sound and kodi does not appear to be in ALSA mode because I cannot see the audio output device in kodi/system/audio. However, if I exit kodi then drop back to the lightdm login screen and then login again using a password then kodi starts up in ALSA mode as expected. For some reason, autologin is behaving differently from a manual login of the same user and same session.

The lightdm.log (http://paste.ubuntu.com/10116859) shows that /home/kodi/kodi_alsa_starter is being executed in both cases - there are some differences between the two runs but no errors that I can see.

There do not appear to be any pulseaudio errors in syslog (http://paste.ubuntu.com/10116949/)

Does anybody have any ideas about why an autologin session should behave differently from a normal manual login session of the same name?

Is this the best way to start kodi without pulseaudio?

Thanks
Reply
#2
AE_SINK=ALSA kodi

and don't bother starting and stopping pulse.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#3
Thanks for the reply nickr - however AE_SINK=ALSA doesn't really solve my problem.

I have tried various versions of my file /home/kodi/kodi_alsa_starter and one of them contains just the single line

AE_SINK=ALSA kodi-standalone

This works properly when I log in manually but, like the example in my first post, fails to produce sound when autologin is used. The main problem is that autologin seems to change something and I cannot figure out what!!

Thanks again
Reply
#4
There is some trick to passing an environment variable in a startup script, buggered if I can recall.

By the way welcome fellow kiwi!
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#5
Hi All,

I think I've found my problem - but still need some help to solve it!

The problem seems to be something to do with timing. If I introduce a huge 30 second delay in my session startup script by inserting 'sleep 30' just before the call to kodi then all works perfectly. Without the 30 second delay, I am guessing that kodi must be starting before some essential service or other is properly initialized - it looks to me as if kodi needs to wait for something to complete before it starts - but what?

I know it is not only a matter of waiting for pulseaudio because the problem is still present even if I make sure pulseaudio is started before the call to kodi (by using pulseaudio --start)

So what else does kodi need to wait for? How can I find out?

Thanks
Reply
#6
Anybody?

To rephrase the question more simply, I have a kodi session started with AE_SINK=ALSA and sound works perfectly. When I set the same session to autologin then kodi starts but without sound.

I suspect that some services have not had a chance to start because with autologin the system boots into kodi so fast.

If I introduce an arbitrary 30s delay into the kodi startup script then all is again OK. However, I would much rather use a script which waits for the necessary services to startup but have no idea what to wait for!

Any ideas please?

Thanks
Reply
#7
Watch the system log and see what starts within that 30s?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#8
(2015-02-08, 09:12)namirda Wrote: ......The problem seems to be something to do with timing. If I introduce a huge 30 second delay in my session startup script by inserting 'sleep 30' just before the call to kodi then all works perfectly.........

Hi, by your description of the symptoms, looks like I have the same issue: 218225 (thread)

I will be ok adding a delay in the start sequence, in which script should I add the 'sleep 30'?

TIA
Reply
#9
Hi dz108,

I start kodi by creating a custom session file /usr/share/xsessions/kodi-sink.desktop containing the following :

[Desktop Entry]
Name=kodi-sink
Comment=kodi-sink
Exec=/home/kodi/kodi_sink_starter
TryExec=/home/kodi/kodi_sink_starter
Type=Application

The file /home/kodi/kodi_sink_starter contains the following

#!/bin/bash
#Wait for essential servicesHuh?
sleep 30
# Start kodi
AE_SINK=ALSA kodi-standalone

The file /etc/lightdm/lightdm.conf contains the following

[SeatDefaults]
autologin-user=kodi
user-session=kodi-sink
greeter-session=lightdm-kde-greeter
allow-guest=false

This all works perfectly. However, if I remove the sleep 30 then I have no sound.

I hope this helps.
Reply

Logout Mark Read Team Forum Stats Members Help
Pulseaudio and Autologin Problem0