8.1.0 Beta - SystemD unmounts fail due to -c parameter not existing

  • Copying nfs.mount.sample in the ~/.config/system.d/ and configuring yeilds a successful mount of my NAS server's files on my LibreELEC system via NFS.

    Unmounts fail however due to there being no -c option in umount. This causes the system to hang on shutdown (Which is annoying when you're trying to save a buck by shutting down an idle system)

    Display Spoiler

    ● storage-test.mount - test nfs mount script

    Loaded: loaded (/storage/.config/system.d/storage-test.mount; disabled; vendor preset: disabled)

    Active: active (mounted) (Result: exit-code) since Fri 2017-08-18 01:21:39 NZST; 1s ago

    Where: /storage/test

    What: 192.168.254.254:/mnt/user/ISOS

    Process: 3056 ExecUnmount=/usr/bin/umount /storage/test -c (code=exited, status=1/FAILURE)

    Process: 3034 ExecMount=/usr/bin/mount 192.168.254.254:/mnt/user/ISOS /storage/test -t nfs (code=exited, status=0/SUCCESS)

    CGroup: /system.slice/storage-test.mount

    Aug 18 01:21:30 RyanHTPC systemd[1]: Mounting test nfs mount script...

    Aug 18 01:21:30 RyanHTPC systemd[1]: Mounted test nfs mount script.

    Aug 18 01:21:39 RyanHTPC systemd[1]: Unmounting test nfs mount script...

    Aug 18 01:21:39 RyanHTPC systemd[1]: storage-test.mount: Mount process exited, code=exited status=1

    Aug 18 01:21:39 RyanHTPC systemd[1]: Failed unmounting test nfs mount script.

    umount command:

    Display Spoiler

    RyanHTPC:~/.config/system.d # umount /storage/test -c

    umount: invalid option -- 'c'

    BusyBox v1.26.2 (2017-07-28 19:38:17 CEST) multi-call binary.

    Usage: umount [OPTIONS] FILESYSTEM|DIRECTORY

    Unmount file systems

    -a Unmount all file systems

    -r Try to remount devices as read-only if mount is busy

    -l Lazy umount (detach filesystem)

    -f Force umount (i.e., unreachable NFS server)

    -D Don't free loop device even if it has been use


    It seems that either systemd needs to be patched to not use -c or the version of umount in LibreELEC needs to be updated to a version with the -c flag (Or have this option enabled)

    This also seems to occur with CIFS mounts, however I cannot confirm if its the same -c option causing the unmount issue.

    Edited once, last by PrimusNZ (August 17, 2017 at 2:34 PM).

  • Can you post your nfs service:

    Code
    cat /storage/.config/system.d/storage-test.mount | pastebinit



    I've tested an NFS mount based on the default nfs.mount.sample (pastebin) but can't see a problem:

    I've tested this with 8.0.2, 8.1.0 and also LE9.

    Looking at the systemd source code there's no evidence it adds the "-c" argument when unmounting:
    systemd/mount.c at v232 · systemd/systemd · GitHub

  • Heres my mount file XVRQ

  • He's using my build, so I've probably introduced this regression somehow. Could be the util-linux bump to 2.29.2 or systemd bump to 2.34. I'll be investigating, in the meantime you could mount manually in autostart.sh and unmount in shutdown.sh.

  • I've been testing a bit, disabling the busybox mount applet and instead adding mount from util-linux seems to do the trick (i.e. it supports the -c option). Downside is that it needs helpers for nfs/cifs. I already have nfs-utils in my build, so I added cifs-utils as well and now systemd mounts/unmounts both cifs/nfs like it should.

    This is probably something LE upstream will have to deal with at some point too. Perhaps busybox could be hacked to silently ignore the -c option for example, or systemd hacked to not use it. Or even better maybe busybox should support it :)