6

I have a CIFS mount that was working but has broken. It still mounts with sudo mount -a but not at boot. The CIFS share is hosted on openmediavault 5 on a raspberry pi 4. I'm not seeing any errors in the OMV logs.

My fstab entry looks like this:

//192.168.1.97/sharedrive /media/Nas cifs credentials=/home/brad/.smbcredentials,vers=3,_netdev,iocharset=utf8,auto,forceuid,forcegid,uid=1000,gid=5000,file_mode=0777,dir_mode=0777 0 0

DMESG output looks like this:

CIFS: Attempting to mount //192.168.1.97/sharedrive
CIFS VFS: Error connecting to socket. Aborting operation.
CIFS VFS: cifs_mount failed w/return code = -2

JOURNALCTL output looks like this:

systemd[1]: media-Nas.mount: Mount process exited, code=exited, status=32/n/a
systemd[1]: media-Nas.mount: Failed with result 'exit-code'.
systemd[1]: Failed to mount Mount CIFS Share.

Any help would be hugely appreciated. Thanks!

edit:

output of systemctl status NetworkManager-wait-online.service

systemctl status NetworkManager-wait-online.service
● NetworkManager-wait-online.service - Network Manager Wait Online
     Loaded: loaded (/lib/systemd/system/NetworkManager-wait-online.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2021-01-29 17:42:32 EST; 43min ago
       Docs: man:nm-online(1)
    Process: 806 ExecStart=/usr/bin/nm-online -s -q --timeout=30 (code=exited, status=0/SUCCESS)
   Main PID: 806 (code=exited, status=0/SUCCESS)

Jan 29 17:42:26 HP-Laptop systemd[1]: Starting Network Manager Wait Online... Jan 29 17:42:32 HP-Laptop systemd[1]: Finished Network Manager Wait Online.

output of systemd-networkd-wait-online

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

edit 2:

systemctl status systemd-networkd-wait-online
● systemd-networkd-wait-online.service - Wait for Network to be Configured
     Loaded: loaded (/lib/systemd/system/systemd-networkd-wait-online.service; enabled; vendor preset: enabled)
     Active: active (exited) since Fri 2021-01-29 18:42:00 EST; 3min 54s ago
       Docs: man:systemd-networkd-wait-online.service(8)
    Process: 444 ExecStart=/lib/systemd/systemd-networkd-wait-online (code=exited, status=0/SUCCESS)
   Main PID: 444 (code=exited, status=0/SUCCESS)

Jan 29 18:42:00 HP-Laptop systemd[1]: Starting Wait for Network to be Configured... Jan 29 18:42:00 HP-Laptop systemd[1]: Finished Wait for Network to be Configured.

EDIT 3:

The output of systemctl status networkd-dispatcher.service systemd-networkd.service

● networkd-dispatcher.service - Dispatcher daemon for systemd-networkd
     Loaded: loaded (/lib/systemd/system/networkd-dispatcher.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-01-29 19:19:51 EST; 1min 20s ago
   Main PID: 747 (networkd-dispat)
      Tasks: 1 (limit: 9072)
     Memory: 19.7M
     CGroup: /system.slice/networkd-dispatcher.service
             └─747 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers

Jan 29 19:19:51 HP-Laptop systemd[1]: Starting Dispatcher daemon for systemd-networkd... Jan 29 19:19:51 HP-Laptop systemd[1]: Started Dispatcher daemon for systemd-networkd. Jan 29 19:19:57 HP-Laptop networkd-dispatcher[747]: WARNING:Unknown index 3 seen, reloading interface list Jan 29 19:20:00 HP-Laptop networkd-dispatcher[747]: WARNING:Unknown index 5 seen, reloading interface list Jan 29 19:20:00 HP-Laptop networkd-dispatcher[747]: WARNING:Unknown index 6 seen, reloading interface list

● systemd-networkd.service - Network Service Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-01-29 19:19:49 EST; 1min 22s ago TriggeredBy: ● systemd-networkd.socket Docs: man:systemd-networkd.service(8) Main PID: 431 (systemd-network) Status: "Processing requests..." Tasks: 1 (limit: 9072) Memory: 4.1M CGroup: /system.slice/systemd-networkd.service └─431 /lib/systemd/systemd-networkd

  • Please [edit] your question to add the output of systemctl status NetworkManager-wait-online.service systemd-networkd-wait-online. Your fstab entry looks okay but those two services might be disabled one or both. – Raffa Jan 29 '21 at 23:17
  • Pleas add the output of systemctl status networkd-dispatcher.service systemd-networkd.service to your question. – Raffa Jan 29 '21 at 23:49
  • @tracing-shadows Please go through the answer I've just posted, it might work out for you too: https://askubuntu.com/a/1312383/928088. Thanks. – Jags Jan 31 '21 at 07:10
  • I had the same issue and my setup is also OMV 5 with Raspi4. I found a solution on Raspberry forum for this issue and it worked. Reliable Wait for Network Note: the original code did not work, but modified code by Paul92 did the trick. Hope this helps – irshad barot Sep 08 '21 at 18:14

2 Answers2

1

Your fstab entry looks okay and should work fine.

It ,however. appears that the mount is attempted prior to network connectivity becomes available ( systemd's connectivity in particular ). Hence these errors:

CIFS VFS: Error connecting to socket. Aborting operation.

and

systemd[1]: media-Nas.mount: Mount process exited, code=exited, status=32/n/a systemd[1]: media-Nas.mount: Failed with result 'exit-code'. systemd[1]: Failed to mount Mount CIFS Share.

This is due to the service systemd-networkd-wait-online being disabled.

Enable the service like so:

sudo systemctl enable systemd-networkd-wait-online

This should execute without errors.

After that reboot your system. Your network share should mount at boot now.

If the share is still not mounting, check:

systemctl status networkd-dispatcher.service systemd-networkd.service

And see if either service is disabled and enable them too. Then reboot your system.

Raffa
  • 32,237
  • Thanks for your help. After enabling the service the share is not mounting at boot, with the dmesg output the same. – tracing_shadows Jan 29 '21 at 23:39
  • @tracing_shadows Can you please verify the service has been enabled and run again systemctl status systemd-networkd-wait-online. Also please add the output of that to your question. – Raffa Jan 29 '21 at 23:45
  • I've updated the post to show the current output. – tracing_shadows Jan 29 '21 at 23:49
  • @tracing_shadows Pleas add the output of systemctl status networkd-dispatcher.service systemd-networkd.service to your question. – Raffa Jan 29 '21 at 23:58
  • @tracing_shadows Those two services are enabled and running. systemd-networkd-wait-online has been fixed and is now running. NetworkManager-wait-online.service does not complain and runs in a timely proper manner. fstab entry looks fine. I am out of thought. What I am sure of is that it is a connectivity issue and systemd's.in particular. – Raffa Jan 30 '21 at 00:35
  • 1
    Thank you for troubleshooting with me. It was greatly appreciated. – tracing_shadows Jan 30 '21 at 00:38
  • @raffa I too am having exact same issue as @tracing-shadows. Though my fstab entry do not have this _netdev,iocharset=utf8,forceuid,forcegid,file_mode=0777,dir_mode=0777 Should I add that... as after enabling systemd-networkd-wait-online and systemd-networkd.service, I'm getting these errors (too long for a comment): https://pastebin.com/raw/eGqZ8HUQ . My fstab: //192.168.1.1/nas /media/admn/nas cifs auto,vers=3.11,credentials=/home/admn/.smbcredentials,uid=1000,gid=1000,noperm 0 0. Many thanks. – Jags Jan 30 '21 at 00:56
  • @Jags You will only need to add _netdev. For the meaning and usage cases of other options in @tracing_shadows fstab see here. This systemd[1]: Dependency failed for Remote File Systems. might require posting a new question if the mount still does not work after the above changes. – Raffa Jan 30 '21 at 13:58
  • @raffa Thank you so much. Adding _netdev to fstab entry did not help. I'll post a new question later on. – Jags Jan 30 '21 at 19:32
  • @tracing_shadows were you able to solve this? Facing exact same issue on Ubuntu Server 20.04. All services are enabled but nothing works. – UzUmAkI_NaRuTo Mar 16 '21 at 12:18
1

I too was having exact same issue. Though in my case CIFS share is hosted on ASUS RT AC68U with DD WRT 3.0

Here's how I solved the issue:

(1) Enabled these services (as I've disabled these in the past):

sudo systemctl enable systemd-networkd-wait-online

sudo systemctl enable systemd-networkd.service

sudo systemctl enable NetworkManager-wait-online.service

Note: If any of those services are masked, then you would need to first unmask, and then enable it.

You can find more on how to properly unmask here: [1] and [2].

(2) I commented out (removed) fstab entry for CIFS share, and created systemd mount for cifs share:

Note: Create a new file media-admn-nas.mount in the diretory /etc/systemd/system.

The filename must contain the mount point name where the slashes are replaced with “minus”. Mount-directory /media/admn/nas => media-admn-nas.mount

sudo nano /etc/systemd/system/media-admn-nas.mount

[Unit]
Description=CIFS Mount Service 
Requires=network-online.target systemd-networkd.service
After=network-online.target network-online.service media-admn-1\x2d6TB.mount remote-fs.target
Wants=network-online.target NetworkManager-wait-online.service

[Mount] What=//192.168.1.1/nas Where=/media/admn/nas Options=rw,_netdev,auto,cache=none,vers=3.11,credentials=/home/admn/.smbcredentials,forceuid,forcegid,uid=1000,gid=1000 Type=cifs TimeoutSec=15

[Install] WantedBy=multi-user.target

Note-1: In my case, media-admn-1\x2d6TB.mount is an additional hard drive where I have mounted the cifs share, so I've added that as After= requirement.

Note-2: As I was still getting errors, I've added TimeoutSec=15

(3) Enable the mount:

sudo systemctl enable media-admn-nas.mount

sudo systemctl daemon-reload

(4) Reboot: 15 sec after a reboot, CIFS share should be mounted.

(5) Check status:

$ systemctl status media-admn-nas.mount
● media-admn-nas.mount - CIFS Mount Service
     Loaded: loaded (/etc/systemd/system/media-admn-nas.mount; enabled; vendor preset: enable>
     Active: active (mounted) since Sun 2021-01-31 10:37:52 IST; 1h 58min ago
      Where: /media/admn/nas
       What: //192.168.1.1/nas
      Tasks: 0 (limit: 19083)
     Memory: 12.0K
     CGroup: /system.slice/media-admn-nas.mount
Jags
  • 2,176