Airplay only works after restarting airplay service

  • Using LibreElec 9.2.1 with Raspberry-Pi 4b and Hifiberry AMP2.

    If I start-up or restart the Raspberry-Pi, Airplay is not working.

    I have to stop and start Airplay service every time to get it to work.

    Anyone have a dirty fix like a script to restart airplay service after boot?

    • Official Post
    Code
    echo "(sleep 20 && systemctl restart avahi)&" > /storage/.config/autostart.sh

    ^ I'm not sure what the issue is, but that should restart the avahi service (which advertises airplay) 20 seconds into userspace boot which is usually plenty of time for Kodi to start.

  • When I start my Pi, avahi-daemon.service is running, Zeroconf is running and Airplay is running.

    Still Airplay do not work.

    If I stop Airplay and start it again in the GUI, Airplay is working.

    • Official Post

    Pastebin a debug log at the start, and after restarting Kodi, e.g.

    cat /storage/.kodi/temp/kodi.log | paste <= share the URL generated

    wait 30 secons

    systemctl restart kodi

    cat /storage/.kodi/temp/kodi.log | paste <= share the URL generated

    i'm wondering if it's something to do with drivers/loading.

  • Thanks for all help.

    I did try a restart of kodi and when it works.

    I ended up in a simple solution with a delayed start of kodi.

    Code
    nano /storage/.config/autostart.sh
    
    sleep 10

    It solved the problem.

    As you mentioned chewitt, something was not ready before kodi started.