Systemd.mount units fail to mount

Same issue here, autofs, cifs-utils installed, working OK, Units correctly created [was working before], but stopped working after September update.
Strange is it mount CIFS during boot, but then its not mounted:
root@SERVER:/lib/systemd/system# journalctl -xe|grep upload
Oct 04 16:43:31 SERVER systemd[1]: Mounting /mnt/upload…
– Subject: A start job for unit mnt-upload.mount has begun execution
– A start job for unit mnt-upload.mount has begun execution.
Oct 04 16:43:32 SERVER kernel: CIFS: Attempting to mount //192.xx.yy.zz/upload
Oct 04 16:43:33 SERVER systemd[1]: Mounted /mnt/upload.
– Subject: A start job for unit mnt-upload.mount has finished successfully
– A start job for unit mnt-upload.mount has finished successfully.
Oct 04 16:45:47 SERVER systemd[1]: Unmounting /mnt/upload…
– Subject: A stop job for unit mnt-upload.mount has begun execution
– A stop job for unit mnt-upload.mount has begun execution.
Oct 04 16:45:48 SERVER systemd[475]: mnt-upload.mount: Succeeded.
Oct 04 16:45:48 SERVER systemd[1]: mnt-upload.mount: Succeeded.
– The unit mnt-upload.mount has successfully entered the ‘dead’ state.
Oct 04 16:45:48 SERVER systemd[1]: Unmounted /mnt/upload.
– Subject: A stop job for unit mnt-upload.mount has finished
– A stop job for unit mnt-upload.mount has finished.
Oct 04 16:45:48 SERVER systemd[1]: Mounting /mnt/upload…
– Subject: A start job for unit mnt-upload.mount has begun execution
– A start job for unit mnt-upload.mount has begun execution.
Oct 04 16:45:48 SERVER kernel: CIFS: Attempting to mount //192.xx.yy.zz/upload
Oct 04 16:45:48 SERVER systemd[1]: Mounted /mnt/upload.
– Subject: A start job for unit mnt-upload.mount has finished successfully
– A start job for unit mnt-upload.mount has finished successfully.
Oct 04 16:46:11 SERVER systemd[1]: Unmounting /mnt/upload…
– Subject: A stop job for unit mnt-upload.mount has begun execution
– A stop job for unit mnt-upload.mount has begun execution.
Oct 04 16:46:11 SERVER systemd[1]: mnt-upload.mount: Succeeded.
– The unit mnt-upload.mount has successfully entered the ‘dead’ state.
Oct 04 16:46:11 SERVER systemd[1]: Unmounted /mnt/upload.
– Subject: A stop job for unit mnt-upload.mount has finished
– A stop job for unit mnt-upload.mount has finished.
Oct 04 16:46:13 SERVER systemd[1]: mnt-upload.automount: Succeeded.
– The unit mnt-upload.automount has successfully entered the ‘dead’ state.
Oct 04 16:46:13 SERVER systemd[1]: Unset automount mnt-upload.automount.
– Subject: A stop job for unit mnt-upload.automount has finished
– A stop job for unit mnt-upload.automount has finished.
Oct 04 16:46:13 SERVER systemd[1]: Set up automount mnt-upload.automount.
– Subject: A start job for unit mnt-upload.automount has finished successfully
– A start job for unit mnt-upload.automount has finished successfully.

root@SERVER:/lib/systemd/system# df|grep upload
root@SERVER:/lib/systemd/system#

root@SERVER:/lib/systemd/system# pwd
/lib/systemd/system

root@SERVER:/lib/systemd/system# ll mnt-upload.mount
-rw-r–r-- 1 root root 393 Oct 4 16:45 mnt-upload.mount

root@SERVER:/lib/systemd/system# cat mnt-upload.mount
[Unit]
Description=Mount upload folder
Wants=connman.service network-online.target wpa_supplicant.service
After=connman.service network-online.target wpa_supplicant.service

[Mount]
What=//192.xx.yy.zz/upload
Where=/mnt/upload
Type=cifs
Options=x-systemd.automount,noperm,noauto,ro,iocharset=utf8,credentials=/etc/.credentials,uid=osmc,gid=osmc,vers=1.0 0 0

[Install]
WantedBy=network.target

It works OK, when I run it manually:
root@SERVER:/lib/systemd/system# systemctl status mnt-upload.mount

  • mnt-upload.mount - /mnt/upload
    Loaded: loaded (/etc/fstab; generated)
    Active: inactive (dead)
    TriggeredBy: * mnt-upload.automount
    Where: /mnt/upload
    What: //192.xx.yy.zz/upload
    Docs: man:fstab(5)
    man:systemd-fstab-generator(8)

root@SERVER:/lib/systemd/system# systemctl restart mnt-upload.mount

root@SERVER:/lib/systemd/system# systemctl status mnt-upload.mount

  • mnt-upload.mount - /mnt/upload
    Loaded: loaded (/etc/fstab; generated)
    Active: active (mounted) since Tue 2022-10-04 17:03:12 UTC; 2s ago
    TriggeredBy: * mnt-upload.automount
    Where: /mnt/upload
    What: //192.xx.yy.zz/upload
    Docs: man:fstab(5)
    man:systemd-fstab-generator(8)
    Tasks: 0 (limit: 975)
    CPU: 63ms
    CGroup: /system.slice/mnt-upload.mount

Oct 04 17:03:10 SERVER systemd[1]: Mounting /mnt/upload…
Oct 04 17:03:12 SERVER systemd[1]: Mounted /mnt/upload.
root@SERVER:/lib/systemd/system# df|grep upload
//192.xx.yy.zz/upload 5763789624 2124143864 3639543360 37% /mnt/upload

There is no spec. char in the /etc/.credentials
username=rpiuser
password=*******

But nothing after reboot.
Any idea? Thank you for help.

To get a better understanding of the problem you are experiencing we need more information from you. The best way to get this information is for you to upload logs that demonstrate your problem. You can learn more about how to submit a useful support request here.

Depending on the used skin you have to set the settings-level to standard or higher, in summary:

  • enable debug logging at settings->system->logging
  • reboot the OSMC device twice(!)
  • reproduce the issue
  • upload the log set (all configs and logs!) either using the Log Uploader method within the My OSMC menu in the GUI or the ssh method invoking command grab-logs -A
  • publish the provided URL from the log set upload, here

Thanks for your understanding. We hope that we can help you get up and running again shortly.

OSMC skin screenshot:

1 Like

Hi djha53k,

I’ve moved your post to a new topic, as doesn’t like you are using autofs; rather Systemd.mount units.

What filesystem is being used on the shared upload folder on the pi? e.g ext4 or exFat

Regards Tom

1 Like

Mounts are shared from NAS via CIFS = SMB version 1.0 - 3.0, but it doesn’t work if I tried manually mount it with anything else then vers=1.0

Just spotted the Unit was disabled :roll_eyes:
root@SERVER:/lib/systemd/system# systemctl enable mnt-upload.mount
… restart …
root@SERVER:/lib/systemd/system# systemctl status mnt-upload.mount

  • mnt-upload.mount - Mount upload folder
    Loaded: loaded (/lib/systemd/system/mnt-upload.mount; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Wed 2022-10-05 17:00:14 UTC; 24s ago
    Where: /mnt/upload
    What: //192.168.x.z/upload
    CPU: 43ms

Amended Unit line to:
Options=_netdev,noauto,x-systemd.automount,ro,iocharset=utf8,credentials=/etc/.credentials,uid=osmc,gid=osmc,vers=3.0

Manual restart works:
root@sp13osmc:/lib/systemd/system# systemctl status mnt-upload.mount

  • mnt-upload.mount - Mount upload folder
    Loaded: loaded (/lib/systemd/system/mnt-upload.mount; enabled; vendor preset: enabled)
    Active: active (mounted) since Wed 2022-10-05 17:54:11 UTC; 19s ago
    Where: /mnt/upload
    What: //192.168.x.z/upload
    Tasks: 0 (limit: 975)
    CPU: 45ms
    CGroup: /system.slice/mnt-upload.mount

But still not mounted after OS restart:
Oct 05 17:52:55 sp13osmc mount[296]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
Oct 05 17:52:55 sp13osmc systemd[1]: mnt-upload.mount: Mount process exited, code=exited, status=32/n/a
Oct 05 17:52:55 sp13osmc systemd[1]: mnt-upload.mount: Failed with result ‘exit-code’.
Oct 05 17:52:55 sp13osmc systemd[1]: Failed to mount Mount upload folder.

Hi,

Please provide full logs as requested above.

Regards Tom.

and back to original issue:
root@SERVER:/tmp# cp mnt-upload.mount /lib/systemd/system
root@SERVER:/lib/systemd/system# systemctl daemon-reload;systemctl enable mnt-upload.mount;systemctl status mnt-upload.mount
Created symlink /etc/systemd/system/network.target.wants/mnt-upload.mount → /lib/systemd/system/mnt-upload.mount.

  • mnt-upload.mount - Mount upload folder
    Loaded: loaded (/lib/systemd/system/mnt-upload.mount; enabled; vendor preset: enabled)
    Active: inactive (dead)
    Where: /mnt/upload
    What: //192.168.x.z/upload

Oct 05 18:39:03 SERVER systemd[1]: Mounting /mnt/upload…
Oct 05 18:39:04 SERVER mount[277]: mount error(101): Network is unreachable
Oct 05 18:39:04 SERVER mount[277]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
Oct 05 18:39:04 SERVER systemd[1]: mnt-upload.mount: Mount process exited, code=exited, status=32/n/a
Oct 05 18:39:04 SERVER systemd[1]: mnt-upload.mount: Failed with result ‘exit-code’.
Oct 05 18:39:04 SERVER systemd[1]: Failed to mount /mnt/upload.
Oct 05 18:44:32 SERVER systemd[1]: mnt-upload.mount: Succeeded.

# cat mnt-upload.mount
[Unit]
Description=Mount upload folder
Wants=connman.service network-online.target wpa_supplicant.service
After=connman.service network-online.target wpa_supplicant.service

[Mount]
What=//192.168.x.z/upload
Where=/mnt/upload
Type=cifs
Options=_netdev,noauto,x-systemd.automount,ro,iocharset=utf8,credentials=/etc/.credentials,uid=osmc,gid=osmc,vers=3.0

[Install]
WantedBy=network.target


Change Wants by Required:
Requires=connman.service network-online.target wpa_supplicant.service
After=connman.service network-online.target wpa_supplicant.service

restart … and nothing mounted again …

root@SERVER:~# df |grep upload
root@SERVER:~#
root@SERVER:~# systemctl status mnt-*

  • mnt-upload.mount - Mount upload folder
    Loaded: loaded (/lib/systemd/system/mnt-upload.mount; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Wed 2022-10-05 18:53:27 UTC; 38s ago
    Where: /mnt/upload
    What: //192.168.x.z/upload
    CPU: 49ms

Oct 05 18:53:26 SERVER systemd[1]: Mounting Mount upload folder…
Oct 05 18:53:27 SERVER mount[278]: mount error(101): Network is unreachable
Oct 05 18:53:27 SERVER mount[278]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
Oct 05 18:53:27 SERVER systemd[1]: mnt-upload.mount: Mount process exited, code=exited, status=32/n/a
Oct 05 18:53:27 SERVER systemd[1]: mnt-upload.mount: Failed with result ‘exit-code’.
Oct 05 18:53:27 SERVER systemd[1]: Failed to mount Mount upload folder.


This: mount error(101): Network is unreachable < seems like network-online.target is not UP at that time, but it is set as Required, so how come?

Hooray issue FIXED!!!

CIFS mounted after restart:
root@SERVER:/lib/systemd/system# df|grep upload
//192.168.x.z/upload 5763789624 2112536892 3651150332 37% /mnt/upload

I found one post on ArchLinux forum about “systemd-networkd-wait-online.service”, so gave it a try:
root@SERVER:/lib/systemd/system# systemctl list-unit-files |grep -i wait
connman-wait-for-network.service disabled enabled
systemd-networkd-wait-online.service disabled disabled
systemd-time-wait-sync.service disabled disabled

root@SERVER:/lib/systemd/system# systemctl status systemd-networkd-wait-online.service

  • systemd-networkd-wait-online.service - Wait for Network to be Configured
    Loaded: loaded (/lib/systemd/system/systemd-networkd-wait-online.service; disabled; vendor preset: disabled)
    Active: inactive (dead)
    Docs: man:systemd-networkd-wait-online.service(8)

root@SERVER:/lib/systemd/system# systemctl enable systemd-networkd-wait-online.service
Created symlink /etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service → /lib/systemd/system/systemd-networkd-wait-online.service.

root@SERVER:/lib/systemd/system# systemctl restart systemd-networkd-wait-online.service
root@SERVER:/lib/systemd/system# systemctl status systemd-networkd-wait-online.service

  • systemd-networkd-wait-online.service - Wait for Network to be Configured
    Loaded: loaded (/lib/systemd/system/systemd-networkd-wait-online.service; enabled; vendor preset: disabled)
    Active: active (exited) since Wed 2022-10-05 19:28:02 UTC; 3s ago
    Docs: man:systemd-networkd-wait-online.service(8)
    Process: 554 ExecStart=/lib/systemd/systemd-networkd-wait-online (code=exited, status=0/SUCCESS)
    Main PID: 554 (code=exited, status=0/SUCCESS)
    CPU: 46ms

root@SERVER:/lib/systemd/system# cat mnt-upload.mount
[Unit]
Description=Mount upload folder
Requires=network-online.target systemd-networkd-wait-online.service
After=connman.service network-online.target wpa_supplicant.service
Wants=network-online.target

[Mount]
What=//192.168.x.z/upload
TimeoutIdleSec=17
Where=/mnt/upload
Type=cifs
Options=x-systemd.automount,x-systemd.device-timeout=15,ro,_netdev,iocharset=utf8,credentials=/etc/.credentials,uid=osmc,gid=osmc

[Install]
WantedBy=network.target

1 Like