You are not logged in.

#1 2019-05-06 08:00:16

adrianmay
Member
Registered: 2017-12-19
Posts: 64

Cifs mount failing at boot but working later

Hi All,

I have two samba shares served up by an off-the-shelf docker container like this:

docker run --name=samba -d \
--net mydockernet \
--ip 10.60.0.90 \
-v /mnt/mag/docker/volumes/torrents/completed:/torrents \
-v /mnt/mag/docker/volumes/pics/new:/newpics \
-p 139:139 -p 145:145 \
-p 137:137/udp -p 138:138/udp \
--restart unless-stopped \
dperson/samba \
-n \
-s "torrents;/torrents" \
-s "newpics;/newpics;;no"

And the Arch client can connect with systemd like this:

::::::::::::::
mnt-newpics.mount
::::::::::::::
[Unit]
  Description=cifs mount script
#  After=remote-fs-pre.target
#  Wants=remote-fs-pre.target
  Requires=network-online.target
  After=network-online.service

[Mount]
  What=//10.60.0.90/newpics
  Where=/mnt/newpics
  Options=username=guest,password=,noperm,vers=3.0
  Type=cifs

[Install]
  WantedBy=multi-user.target
::::::::::::::
mnt-torrents.mount
::::::::::::::
[Unit]
  Description=cifs mount script
#  After=remote-fs-pre.target
#  Wants=remote-fs-pre.target
  Requires=network-online.target
  After=network-online.service

[Mount]
  What=//10.60.0.90/torrents
  Where=/mnt/torrents
  Options=username=guest,password=,ro,vers=3.0
  Type=cifs

[Install]
  WantedBy=multi-user.target

or fstab like this:

//10.60.0.90/newpics /mnt/newpics cifs username=guest,password=,noperm,vers=3.0 0 0 
//10.60.0.90/torrents /mnt/torrents cifs guest,ro,vers=3.0 0 0                          

Either way it works fine if I'm already booted, but not as part of the boot process. The systemd way leaves no trace in journalctl -xe and the fstab way leaves:

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

in dmesg.

Any help much appreciated.

Offline

#2 2019-05-07 20:03:36

adrianmay
Member
Registered: 2017-12-19
Posts: 64

Re: Cifs mount failing at boot but working later

Hey, slow down, don't all shout at once ;-)

Offline

#3 2019-05-07 20:23:41

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,860
Website

Re: Cifs mount failing at boot but working later


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2019-05-07 22:06:40

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,735

Re: Cifs mount failing at boot but working later

Which network-online.target provider are you using/do you have enabled?

Online

#5 2019-05-08 06:58:14

seth
Member
Registered: 2012-09-03
Posts: 51,213

Re: Cifs mount failing at boot but working later

fstab: https://wiki.archlinux.org/index.php/Fs … filesystem

Other than that, you probably also wanna wait for docker to be up and running?

Offline

#6 2019-05-10 10:38:10

adrianmay
Member
Registered: 2017-12-19
Posts: 64

Re: Cifs mount failing at boot but working later

Oh hi. Sorry for the silence.

> Which network-online.target provider are you using/do you have enabled?
I don't understand the question, which probably means it's the installation default.

> wait for docker to be up and running?
It's on a different box and runs continuously.

Offline

#7 2019-05-10 10:48:27

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,735

Re: Cifs mount failing at boot but working later

The network-online target the mount unit depends on will not be invoked if you haven't defined a handler for it. Which is why the "systemd way" doesn't show up (you are never invoking an online target so the unit is correctly never attempted to be mounted) and the fstab way will try and fail before the network is up. How are you connecting to the network? See the note in https://wiki.archlinux.org/index.php/Sa … c_mounting

Alternatively do it the way the wiki suggests in seths link, where a mount attempt will only be made when you actively access the device, which will presumably happen after the connection has established.

Last edited by V1del (2019-05-10 10:54:19)

Online

#8 2019-05-10 13:08:32

adrianmay
Member
Registered: 2017-12-19
Posts: 64

Re: Cifs mount failing at boot but working later

So are you saying that I should take out those dependencies on network-online.target and simply trust that mounts like that already know what to wait for, and also enable systemd-networkd-wait-online.service, and then it should work?
Update: I tried that but it still doesn't mount.
I suppose I could resort to mounting on demand but I'd rather they were there from the outset

Last edited by adrianmay (2019-05-10 14:19:24)

Offline

#9 2019-05-10 14:41:46

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,735

Re: Cifs mount failing at boot but working later

No you should keep the dependencies on network-online.target (and be consequent here, one of the two is network-online.service instead, use target everywhere) but enable systemd-networkd-wait-online.service in addition. systemd-networkd-wait-online service will bring up, and thus start any units waiting on network-online.target

Also, you should of course also enable the mount unit regardless for it to be even considered.

FWIW you might want to post

systemctl list-unit-files --state=enabled
systemctl list-unit-files --type=mount

Last edited by V1del (2019-05-10 15:03:26)

Online

#10 2019-05-10 15:10:24

adrianmay
Member
Registered: 2017-12-19
Posts: 64

Re: Cifs mount failing at boot but working later

So I corrected that stuff (including having network-online.target everywhere) but it still ain't working.

$ journalctl -u mnt-torrents.mount
...
...
May 10 16:00:47 blackmail systemd[1]: Mounting cifs mount script...
May 10 16:00:47 blackmail mount[753]: mount error(2): No such file or directory
May 10 16:00:47 blackmail mount[753]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
May 10 16:00:47 blackmail systemd[1]: mnt-torrents.mount: Mount process exited, code=exited, status=32/n/a
May 10 16:00:47 blackmail systemd[1]: mnt-torrents.mount: Failed with result 'exit-code'.
May 10 16:00:47 blackmail systemd[1]: Failed to mount cifs mount script.
$ systemctl list-unit-files --state=enabled
UNIT FILE                            STATE  
mnt-newpics.mount                    enabled
mnt-torrents.mount                   enabled
org.cups.cupsd.path                  enabled
autovt@.service                      enabled
getty@.service                       enabled
lm_sensors.service                   enabled
netctl@wifi.service                  enabled
org.cups.cupsd.service               enabled
sshd.service                         enabled
systemd-networkd-wait-online.service enabled
systemd-timesyncd.service            enabled
org.cups.cupsd.socket                enabled
remote-fs.target                     enabled
Deadbattery.timer                    enabled

14 unit files listed.
$ systemctl list-unit-files --type=mount
UNIT FILE                     STATE    
-.mount                       generated
dev-hugepages.mount           static   
dev-mqueue.mount              static   
home.mount                    generated
mnt-newpics.mount             enabled  
mnt-torrents.mount            enabled  
proc-fs-nfsd.mount            static   
proc-sys-fs-binfmt_misc.mount static   
sys-fs-fuse-connections.mount static   
sys-kernel-config.mount       static   
sys-kernel-debug.mount        static   
tmp.mount                     static   
var-lib-machines.mount        static   
var-lib-nfs-rpc_pipefs.mount  static   

14 unit files listed.

Offline

#11 2019-05-10 15:31:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,735

Re: Cifs mount failing at boot but working later

As you seem to use netctl you will want to disable systemd-networkd-wait-online.service and instead enable netctl-wait-online.service (these are always network daemon dependant)

However the error you are receiving now points to an issue in the .mount unit though I'm not entirely sure where if it indeed works after a connection is established.

Online

#12 2019-05-10 17:00:05

adrianmay
Member
Registered: 2017-12-19
Posts: 64

Re: Cifs mount failing at boot but working later

Yippee!

Swapping systemd-networkd-wait-online.service for netctl-wait-online.service fixed it! Thanks!

Is this a doc error on https://wiki.archlinux.org/index.php/Sa … c_mounting ?

Offline

Board footer

Powered by FluxBB