ALSA audio output not available in KODI unless root

Hi,

I restarted my Raspberry Pi recently and lost my HifiBerry sound output.
I checked system settings and observed that the output device was not available, instead only Analog, HDMI, analog + HDMI were available.

I edited /usr/bin/mediacenter to start kodi as root instead of as osmc. This fixed the problem as the hifiberry output device is now available and working.

The exact change is:
sudo -u osmc $KODI --standalone -fs --lircdev /var/run/lirc/lircd; CODE="$?"
altered to
sudo -u root $KODI --standalone -fs --lircdev /var/run/lirc/lircd; CODE="$?"

I am sure a better solution is possible since what I’ve done is merely a workaround.
I hope you can help me fix the issue and possibly help others with the same problem.

Best regards
Eskild

Try deleting your local Kodi userdata directory

I don’t have a HifiBerry, so won’t be able to try anything myself but you need to do two things at this stage:

  • Post logs
  • Search this forum for “hifiberry”.

Hi

I did delete the /osmc/.kodi folder without success before finding my workaround.

If I find the time to experiment further I will definitely post logs.

Best regards
Eskild

Hi,

I have now run an experiment:

  1. Standard /usr/bin/mediacenter which runs kodi as osmc
    1.1) I deleted /home/osmc/.kodi folder
    1.2) I started kodi with “sudo service mediacenter start”
    1.3) I enabled logging
    1.4) I stopped kodi with “sudo service mediacenter start”
    1.5) I deleted temp logs by “rm -R /home/osmc/.kodi/temp”
    1.6) I started kodi with “sudo service mediacenter start”
    1.7) I navigated to system audio settings and could not find my hifiberry card
    1.8) I uploaded logs with OSMC app, https://paste.osmc.tv/roqikopupe

  2. Non-standard /usr/bin/mediacenter which runs kodi as root
    2.1) I deleted /root/.kodi folder
    2.2) I started kodi with “sudo service mediacenter start”
    2.3) I enabled logging
    2.4) I stopped kodi with “sudo service mediacenter start”
    2.5) I deleted temp logs by “rm -R /root/.kodi/temp”
    2.6) I started kodi with “sudo service mediacenter start”
    2.7) I navigated to system audio settings and did find my hifiberry card
    2.8) I uploaded logs with OSMC app, https://paste.osmc.tv/axicunureb

Best regards,
Eskild

What is the output of groups? mine is

osmc adm disk lp dialout cdrom audio video sambashare pulse-access

As osmc:
osmc adm disk lp dialout cdrom audio www-data video

As root:
root

Best regards,
Eskild

I dug a little deeper and it appears that my issue may be related to the following report:

This was fixed according to:

Perhaps I am experiencing a different case of the same bug?

Best regards,
Eskild

Doesn’t affect Krypton.

I took a look at the Hifiberry site and this page says that you need to have created /etc/asound.conf, as well as other configuration options.

Have you followed the recommendations on the above page? I can see no mention of your ALSA configuration.

Not sure what this is about. But under OSMC the Hifiberry works out of the box after it is configured in MyOSMC. And that also has not changed after the change to Stretch.

Since the thread seems to have stalled, I was hoping my modest contribution might help to move it forward.

As a strategy, I have found that saying something should work has not been particularly successful. Right now, it doesn’t work.

So you mean a fresh install with the December Image and a hifiberry doesn’t work?

Hi,

HifiBerry certainly works. I can use it for Kodi just fine - the only problem is that I have to run Kodi as root. Hence the HifiBerry device is functioning correctly.

I do not know why Kodi would not list HifiBerry as an audio output device when Kodi is run as osmc user. That’s what I am trying to figure out and resolve in this thread :-). I have presented logs but it doesn’t seem that these are useful?

I am not sure how I can help move this issue further.

Best regards,
Eskild