You are not logged in.

#1 2023-03-17 02:00:26

GuantoApril
Member
Registered: 2023-03-17
Posts: 2

[Resolved] cifs mount not waiting for network

This is driving me mad. I've followed the guide here https://wiki.archlinux.org/title/Samba#As_systemd_unit, plus a few other things I've found elsewhere. Mounting works fine if I manually start mnt-storage.mount once the system is up, but won't work during boot.

I've seen a lot of talk about automount, which I had working in debian, but I abandoned that solution because it wasn't playing nice with docker-compose. I got frustrated and went back to arch, but I'm stuck in basically the same spot, which makes me think I'm doing something wrong.

Happy to try automount again if it should work with a docker-compose service.

cat /etc/systemd/system/mnt-storage.mount

[Unit]
Description=Mount storage on noonian
Requires=network-online.target systemd-networkd-wait-online.service
After=network-online.target systemd-networkd-wait-online.service

[Mount]
What=//10.0.0.13/Storage
Where=/mnt/storage
Options=credentials=/etc/samba/credentials/storage,iocharset=utf8,rw,noauto
Type=cifs
TimeoutSec=30

[Install]
WantedBy=multi-user.target

cat /etc/systemd/network/05-ethernet.network

[Match]
Name=enp0s31f6

[Network]
DHCP=yes

systemctl status systemd-networkd

● systemd-networkd.service - Network Configuration
     Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; preset: enabled)
     Active: active (running) since Thu 2023-03-16 21:44:51 EDT; 3min 13s ago
TriggeredBy: ● systemd-networkd.socket
       Docs: man:systemd-networkd.service(8)
   Main PID: 205 (systemd-network)
     Status: "Processing requests..."
      Tasks: 1 (limit: 9354)
     Memory: 3.4M
        CPU: 150ms
     CGroup: /system.slice/systemd-networkd.service
             └─205 /usr/lib/systemd/systemd-networkd

Mar 16 21:44:51 reginald systemd-networkd[205]: Enumeration completed
Mar 16 21:44:51 reginald systemd[1]: Started Network Configuration.
Mar 16 21:44:51 reginald systemd-networkd[205]: eth0: Interface name change detected, renamed to enp0s31f6.
Mar 16 21:44:51 reginald systemd-networkd[205]: enp0s31f6: Configuring with /etc/systemd/network/05-ethernet.network.
Mar 16 21:44:51 reginald systemd-networkd[205]: enp0s31f6: Link UP
Mar 16 21:44:52 reginald systemd-networkd[205]: wlan0: Interface name change detected, renamed to wlp1s0.
Mar 16 21:44:54 reginald systemd-networkd[205]: enp0s31f6: Gained carrier
Mar 16 21:44:55 reginald systemd-networkd[205]: enp0s31f6: DHCPv4 address 10.0.0.253/24, gateway 10.0.0.1 acquired from>
Mar 16 21:44:55 reginald systemd-networkd[205]: Could not set hostname: Access denied
Mar 16 21:44:56 reginald systemd-networkd[205]: enp0s31f6: Gained IPv6LL

systemctl status mnt-storage.mount

× mnt-storage.mount - Mount storage on noonian
     Loaded: loaded (/etc/systemd/system/mnt-storage.mount; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Thu 2023-03-16 21:44:51 EDT; 35s ago
      Where: /mnt/storage
       What: //10.0.0.13/Storage
        CPU: 5ms

Mar 16 21:44:51 reginald systemd[1]: Mounting Mount storage on noonian...
Mar 16 21:44:51 reginald mount[236]: mount error(101): Network is unreachable
Mar 16 21:44:51 reginald mount[236]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messag>
Mar 16 21:44:51 reginald systemd[1]: mnt-storage.mount: Mount process exited, code=exited, status=32/n/a
Mar 16 21:44:51 reginald systemd[1]: mnt-storage.mount: Failed with result 'exit-code'.
Mar 16 21:44:51 reginald systemd[1]: Failed to mount Mount storage on noonian.

systemctl status systemd-networkd-wait-online.service

● systemd-networkd-wait-online.service - Wait for Network to be Configured
     Loaded: loaded (/usr/lib/systemd/system/systemd-networkd-wait-online.service; enabled; preset: disabled)
     Active: active (exited) since Thu 2023-03-16 21:44:51 EDT; 5min ago
       Docs: man:systemd-networkd-wait-online.service(8)
    Process: 232 ExecStart=/usr/lib/systemd/systemd-networkd-wait-online (code=exited, status=0/SUCCESS)
   Main PID: 232 (code=exited, status=0/SUCCESS)
        CPU: 9ms

Mar 16 21:44:51 reginald systemd[1]: Starting Wait for Network to be Configured...
Mar 16 21:44:51 reginald systemd[1]: Finished Wait for Network to be Configured.

systemctl list-unit-files --state=enabled

UNIT FILE                            STATE   PRESET  
mnt-storage.mount                    enabled disabled
getty@.service                       enabled enabled 
sshd.service                         enabled disabled
systemd-network-generator.service    enabled enabled 
systemd-networkd-wait-online.service enabled disabled
systemd-networkd.service             enabled enabled 
systemd-networkd.socket              enabled disabled
remote-fs.target                     enabled enabled 

8 unit files listed.

Last edited by GuantoApril (2023-03-18 12:04:34)

Offline

#2 2023-03-17 07:15:59

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: [Resolved] cifs mount not waiting for network

Mar 16 21:44:51 reginald systemd-networkd[205]: enp0s31f6: Link UP
Mar 16 21:44:51 reginald systemd[1]: Finished Wait for Network to be Configured.
Mar 16 21:44:51 reginald systemd[1]: Mounting Mount storage on noonian...
Mar 16 21:44:51 reginald mount[236]: mount error(101): Network is unreachable
Mar 16 21:44:52 reginald systemd-networkd[205]: wlan0: Interface name change detected, renamed to wlp1s0.
Mar 16 21:44:54 reginald systemd-networkd[205]: enp0s31f6: Gained carrier
Mar 16 21:44:55 reginald systemd-networkd[205]: enp0s31f6: DHCPv4 address 10.0.0.253/24, gateway 10.0.0.1 acquired from>

https://wiki.archlinux.org/title/System … ait-online
The NetworkManager version is even more useless.

Try

ExecStartPre=/usr/bin/sleep 5

or

ExecStartPre=/usr/bin/ping -qW 5 -c1 10.0.0.13

(-W 5 to control the timeout)

Last edited by seth (2023-03-17 07:16:34)

Offline

#3 2023-03-17 12:23:23

just4arch
Member
Registered: 2023-01-07
Posts: 74

Re: [Resolved] cifs mount not waiting for network

I'd simply use an automount.
On my system, they're generated via fstab (x-systemd.automount) and I use them with nofail,idle-timeout,_netdev for NFS.

Offline

#4 2023-03-17 16:05:49

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: [Resolved] cifs mount not waiting for network

The OP wrote:

I've seen a lot of talk about automount, which I had working in debian, but I abandoned that solution because it wasn't playing nice with docker-compose.

Offline

#5 2023-03-17 16:56:00

just4arch
Member
Registered: 2023-01-07
Posts: 74

Re: [Resolved] cifs mount not waiting for network

Fair enough, but this is Arch and not Debian wink
(and there are other automounters than systemd)
Might be worthwhile to take another look.... ymmv

Last edited by just4arch (2023-03-17 16:57:58)

Offline

#6 2023-03-18 00:19:30

GuantoApril
Member
Registered: 2023-03-17
Posts: 2

Re: [Resolved] cifs mount not waiting for network

seth wrote:
Mar 16 21:44:51 reginald systemd-networkd[205]: enp0s31f6: Link UP
Mar 16 21:44:51 reginald systemd[1]: Finished Wait for Network to be Configured.
Mar 16 21:44:51 reginald systemd[1]: Mounting Mount storage on noonian...
Mar 16 21:44:51 reginald mount[236]: mount error(101): Network is unreachable
Mar 16 21:44:52 reginald systemd-networkd[205]: wlan0: Interface name change detected, renamed to wlp1s0.
Mar 16 21:44:54 reginald systemd-networkd[205]: enp0s31f6: Gained carrier
Mar 16 21:44:55 reginald systemd-networkd[205]: enp0s31f6: DHCPv4 address 10.0.0.253/24, gateway 10.0.0.1 acquired from>

https://wiki.archlinux.org/title/System … ait-online
The NetworkManager version is even more useless.

Try

ExecStartPre=/usr/bin/sleep 5

or

ExecStartPre=/usr/bin/ping -qW 5 -c1 10.0.0.13

(-W 5 to control the timeout)

Thank you! I used this as inspiration to create a 'noonian-available.service' service which just loops the ping until it succeeds with a 1sec delay. I then had my actual mount unit depend on that service.

cat /etc/systemd/system/noonian-available.service

[Unit]
Description=Wait for Noonian to be available
After=systemd-networkd-wait-online.service
Requires=systemd-networkd-wait-online.service

[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c 'until /usr/bin/ping -qW 1 -c1 noonian; do sleep 1; done' 
RemainAfterExit=yes
Timeout=30

[Install]
WantedBy=network-online.target

cat /etc/systemd/system/mnt-storage.mount

[Unit]
Description=Mount storage on noonian
Requires=noonian-available.service
After=noonian-available.service

[Mount]
What=//noonian/Storage
Where=/mnt/storage
Options=credentials=/etc/samba/credentials/storage,iocharset=utf8,rw
Type=cifs
TimeoutSec=30

[Install]
WantedBy=multi-user.target

@just4arch: you're right, it may have worked with automount. Or I could have just accessed the mount before launching docker-compose. But I feel like this solution is more deterministic. Thank you though for the suggestion!

Offline

#7 2023-03-18 06:16:41

seth
Member
Registered: 2012-09-03
Posts: 49,981

Re: [Resolved] cifs mount not waiting for network

\o/

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB