I'm trying to mount a CIFS device after the system boots (using systemd), but the system tries to mount the system before the network is established, so it fails.

After logging into the system I can mount it without any problem, using sudo mount -a.

How can I tell my Arch (arm) to wait until the network is available?


4 Answers 4


Adding _netdev to the mount options in /etc/fstab might be sufficient.

Mount units referring to local and network file systems are distinguished by their file system type specification. In some cases this is not sufficient (for example network block device based mounts, such as iSCSI), in which case _netdev may be added to the mount option string of the unit, which forces systemd to consider the mount unit a network mount.

Additionally systemd supports explicit order dependencies between mount entries and other units: Adding x-systemd.after=network-online.target to the mount options might work if _netdev is not enough.

See the systemd mount unit documentation for more details.

  • 1
    the _netdev section did not work for me BUT it was left and the x-systemd.after=network-online.target did on nfsv4 mounts, this was verifed on U16.04.6 vm
    – ssvegeta96
    Commented Dec 23, 2019 at 19:16
  • @ssvegeta96 yeah, i have never in my life seen that _netdev works on systemd. they just don't care enough. (not to mention that needing any of that is a regression compared to classic unix which simply sorted the fstab from local to non-local) Commented Aug 29, 2022 at 1:11
  • 1
    careful: having nofail disables the automatic addition of x-systemd.after... targets (cf same doc page), so you have to add them explicitly Commented Nov 3, 2023 at 16:10

Add _netdev to the /etc/fstab entries in question. From the manpages for `mount(8)':

_netdev The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).


A bit hacky, but all _netdev and x-systemd options didn't help, since WINS/DNS was stil not running.
I got going with a root crontab entry:

@reboot /usr/bin/mount -a

This is run late in the boot process.
So even if systemd fails in the first place to mount the CIFS mount defined in fstab, later a mount -a is run again and this time the mount succeeds.

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 4, 2023 at 19:14

Instead of fighting systemd assumptions and legacy options which may or may not work, make your service and make your mount target depend on it.

My SMB shares are mounted from, change to what is correct in your case.

# /etc/systemd/system/wait-for-ping.service
Description=Blocks until it successfully pings

ExecStartPre=/usr/bin/bash -c "while ! ping -c1; do sleep 1; done"
ExecStart=/usr/bin/bash -c "echo good to go"


Enable that service with:

sudo systemctl daemon-reload
sudo systemctl enable --now wait-for-ping.service

Then edit your fstab as follows to include this as final mount option:


Do another systemctl daemon-reload and you can verify that your mount target has the correct option set. My mount target is /mnt/media, that creates mnt-media.mount, so do:

systemctl cat mnt-media.mount

This should have an header like this:

# Automatically generated by systemd-fstab-generator

Documentation=man:fstab(5) man:systemd-fstab-generator(8)

# ... rest of file follows ...

Reboot your machine and you should find your mounts waiting until a ping succeeds.

  • Works very fine on Debian 12.
    – cweiske
    Commented Nov 15, 2023 at 20:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .