Systemd mount does not honor `_netdev` option to make it a network mount

I’m using a systemd mount unit to mount an rclone storage into my homelab.

[Mount]
Type=rclone
What=paperless-backend:data
Where=/var/mnt/paperless/data
Options=rw,_netdev,allow_other,args2env,vfs-cache-mode=full,poll-interval=0,config=%d/rclone-podman.conf,cache-dir=%C/rclone-paperless
LoadCredential=rclone-podman.conf

According to systemd’s documentation, the presence of _netdev in the Options should be enough for systemd to classify this as a network mount and thread it into the tree of networkt.target and remote-fs.target: https://www.freedesktop.org/software/systemd/man/latest/systemd.mount.html#:~:text=in%20which%20case%20_netdev%20may%20be%20added

However, the option seems to be filtered out when systemd loads the unit:

$ systemctl daemon-reload
$ systemctl show var-mnt-paperless-data.mount
..snip..
# Note `local-fs` instead of `remote-fs`, and no `network.target` dependency
Before=umount.target paperless-webserver.service local-fs.target
After=systemd-journald.socket system.slice var.mount local-fs-pre.target -.mount
..snip..
# No _netdev!
Options=rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other
..snip..
# But here _netdev is passed
ExecMount={ path=/usr/bin/mount ; argv[]=/usr/bin/mount paperless-backend:data /var/mnt/paperless/data -t rclone -o rw,_netdev,allow_other,args2env,vfs-cache-mode=full,poll-interval>

I tried to set SloppyOptions=true as, according to the docs, systemd does some option filtering and that option disables it, and it does work to make it systemd detect it as a network mount, but the -s option then chokes the mount command. Plus I don’t think _netdev should be considered an “unrecognized” option.


My system:

  • Fedora CoreOS 44.20260419.3.1
  • systemd 259 (259.5-1.fc44)

I’m pretty sure that effect of _netddev is only when it’s used in /etc/fstab and not when it’s used in a hand written mount unit - in a mount unit you can specify ordering explicitly in the usual way with Before and After directives.

In fact that’s exactly how _netdev works - the generator systemd runs to create mount units from the fstab sees it and adds ordering directives to the mount unit.

Mmm… It does say this in the documentation, and it does refer specifcially to “unit” files, not the fstab:

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.

The main documentation of _netdev is in the fstab section though.

Specifically it is ordered before remote-fs.target instead of local-fs.target

Do they then have an error in their documentation? Because that paragraph does very clearly talk about unit files.

That looks like a bug yes, but since you are using directly a systemd mount unit (not
fstab) you may try specifying the ordering yourself with:

[Unit]
After=remote-fs-pre.target
Before=remote-fs.target

or perhaps use network-online.target instead. See remote-fs-pre.target in the
systemd.special manual.

[Unit]
After=network-online.target
Before=remote-fs.target

You are not alone in considered this as a bug

See explicitly configured .mount unit with Options=_netdev is still ordered before local-fs.target, rather than remote-fs.target #18235.