LE RPi hangs when mounted remote disk sleeps

  • I made a 2 line script to let TVheadend TV recording wake my server (NAS) where it records to, so I can let the server sleep when it is not needed. Script is perfect, but...

    For as long as the server is sleeping and hence this mount is unavailable, RPi is not communicative. Apparantly, the script works normally, and will wake the server to make recordings. Putty works.

    RPi LE with TVH has a OS level mount to the server as per OE Wiki:
    # /storage/.config/autostart.sh contains:

    Bash
    #!/bin/sh
    (
        mount -t nfs 192.168.2.5:/volume1/Public/Video/TV /storage/recordings -o nolock
    )&

    At the moment when the server (NAS) goes to sleep (and for the duration of it), both RPis are unresponsible. Depends on the starting position, they may work apparantly perfectly normal (if they were allready being used) or may be hanged (e.g. if Kodi restarted after server went to sleep).

    I can connect with Putty and remain connected all the time regardles of the server state. I can do some things with putty, some not.

    Is there a better way to mount the remote disk with LE n RPi? Ideally, automount when needed. This is pure LE RPi OS issue.

    If I umount this share prior to the server going to sleep, all is perfect, both RPis work perfectly normal (not having acces to the external disk). After I wake my server, I mount it back with usual command, all is perfect but with the external disk.

    But, how to make umounts and mounts after wakeup automatic? Or create a smarter automount than the one I am using now?

    Edited once, last by pila (October 17, 2016 at 1:25 PM).

  • I wrote a line of code to deal with this, but having it cronned every minute to check and fix is not my idea of fun or nice. We must never do such things when dealing with a file system. As they were not fragile enough! This should not be a solution as it is not bulletproof nor transparent.

    There must be a better way. What I did to fix a problem is not fit for many, if not most users.

    There must be a way for me to link into a file request at the OS level and make a check, instead of cron. If there is no legal automount.

    This is legitimate issue with a mounting in LE. Today it should be clear and accepted that devices when not used must be allowed to sleep. This notion should not break LE RPi.
    [hr]
    no, LibreElec hangs file system when remote disk mount dissapears.

    Puty can log in, but:
    > mountpoint -q /storage/recordings
    > umount /storage/recordings
    > umount -f /storage/recordings

    do nothing, just hanging out there ...

    So, this is not a LE bug? A feature then?

    Edited once, last by pila (October 17, 2016 at 3:47 PM).


  • Have a look at systemd based mounts.


    OK, I am off trying that.
    [hr]
    No, did nothing. Same hangup as with the first method of mounting.

    So, if a mount goes to sleep, LibreElec hangs. Tried both mount methods. Same hang.

    To reproduce:
    - mount LE RPi to nfs server
    - putty to LE - type ls to see it working, then exit Putty
    - make server sleep
    - putty to LE - type ls to see it hanging
    - wake server, LE works egain

    systemctl stop storage-recordings.mount also hangs

    To be clear:
    1. If TV picture is streaming to the second RPI when server goes to sleep, all is perfect. Kodi will wake server if needed to view recordings.
    2. If left alone and server goes to sleep, all is perfect. Script wakes it when recording is due, and server returns to sleep later.
    3. But if you are not connected to the TV stream, you can not connect to any RPI (escept Putty with partial command set usable) until server returns from the sleep. It takes it a couple of minutes and then all is perfect again.

    I guess I want autofs which does not exist on LE.

    Edited once, last by pila (October 17, 2016 at 10:36 PM).

  • Here is my LibreElec OS level mounting bug report summary.

    LibreElec hangs RPi with OS level mount network share is active (either mount version) if network disk is / becomes unavailable (until server disk becomes available)

    - when RPI works, server goes to sleep
    - when RPI boots, server sleeps
    - when RPI works, server reboots
    - with server down, Kodi works streaming TV from TVheadend if it was active prior to disk sleeping, but only until the Kodi Info PVR page is visited (where total PVR disk space is shown). As Kodi does not use OS level shares, it will WOL server when needed perfectly fine
    - any file command will hang in Putty, other commands work
    - WinSCP does not work as it is only issuing file commands
    - share can not be umounted in any way while it is unavailable

    Same goes to any additional RPi connected to use tv stream from the one where mount and TVheadend actually are.

    If LibreElec is not provoked by issuing any file command in any way while server is down (mount target is unavailable), cron will work perfectly waking the server from sleep when needed.

    My workaround: I am umounting share when not needed for TVHeadend recording, but there are downsides to that. I should not have to do it this way.