2

I have a CIFS mount of a single volume which then has 2 subdirectories bind mounted. Upon boot, systemd complains of an "ordering cycle" and fails to mount 1 of the binds but the other works fine. If I run mount -a, the missing bind is mounted. I have been able to recreate this behavior in a new VM.

/etc/fstab

//server.example.com    /mnt/media             cifs    [snip]  0  0
/mnt/media/secure       /var/www/media/secure  none    bind    0  0
/mnt/media/public       /var/www/media/public  none    bind    0  0

The bind mounts are not altered, those are the actual names. I don't know how, but, I think that may be significant, perhaps due to sort order because when I change the order in fstab only the public bind mount fails. secure always works.

logs from journal

Mar 19 14:06:45 ubuntu systemd[1]: local-fs.target: Found dependency on var-www-media-public.mount/start
Mar 19 14:06:45 ubuntu systemd[1]: local-fs.target: Found dependency on mnt-media.mount/start
Mar 19 14:06:45 ubuntu systemd[1]: local-fs.target: Found dependency on network-online.target/start
Mar 19 14:06:45 ubuntu systemd[1]: local-fs.target: Found dependency on networking.service/start
Mar 19 14:06:45 ubuntu systemd[1]: local-fs.target: Found dependency on local-fs.target/start
Mar 19 14:06:45 ubuntu systemd[1]: local-fs.target: Breaking ordering cycle by deleting job var-www-media-public.mount/start
Mar 19 14:06:45 ubuntu systemd[1]: var-www-media-public.mount: Job var-www-media-public.mount/start deleted to break ordering cycle starting with local-fs.target/start

I've tried specifying x-systemd.requires=/mnt/media on the bind mount but it made no change. I am at a loss for where to go next with this issue.

1 Answer 1

5

I am not sure why even one of the bind mounts is able to work. Here is my suggestion why both might fail together, and how to fix it:

Your networking.service is ordered after local filesystems. The bind mounts are being treated as local filesystems. But, the bind mounts are also ordered after a network mount - systemd adds these logical dependencies automatically for bind mounts.

In which case you need to tell systemd that the bind mount is actually a network mount. There is an option deliberately for this sort of case. Simply add the mount option _netdev to the bind mounts. For further information, this option is defined in man systemd.mount.

6
  • Thank you! I've seen _netdev before but totally forgot about it. As for why one mount works... I can't figure it out either.
    – virullius
    Mar 19, 2018 at 20:25
  • Important detail: it also required setting x-systemd.requires=/mnt/media to the mount options otherwise the bind was to the local directory later covered by the CIFS mount.
    – virullius
    Mar 19, 2018 at 20:30
  • @mjb2kmn thanks! That's odd because I saw the automatic dependency in the code. Maybe you have an older version than I looked at. github.com/systemd/systemd/blob/v238/src/core/mount.c#L296
    – sourcejedi
    Mar 19, 2018 at 21:11
  • Correct, affected system has v229.
    – virullius
    Apr 5, 2018 at 13:14
  • @mjb2kmn gotcha. Looks like its a logic error for _netdev bind mounts specifically, which was fixed in v230. github.com/systemd/systemd/commit/…
    – sourcejedi
    Apr 5, 2018 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.