[Bug 1979952] Re: Bind mount to NFS mount fails on Ubuntu 22.04
Philipp Wendler
1979952 at bugs.launchpad.net
Fri Jul 29 07:20:56 UTC 2022
The fix https://github.com/systemd/systemd/pull/24122 is now merged
upstream. The change should be easy to backport, is it possible that
this could be done for Ubuntu?
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1979952
Title:
Bind mount to NFS mount fails on Ubuntu 22.04
Status in systemd:
Unknown
Status in systemd package in Ubuntu:
New
Bug description:
I have the following setup:
- /data is an NFS mount.
- /home is a bind mount to /data/home.
Configured in /etc/fstab with these lines:
$FILE_SERVER:/data /data nfs defaults 0 0
/data/home /home none bind,_netdev,x-systemd.requires-mounts-for=/data 0 0
This has worked with the same configuration for me on at least Ubuntu 18.04 and Ubuntu 20.04, but on Ubuntu 22.04 the mount of /home fails when attempted by systemd.
So not only is /home not mounted after boot, but also when I run "sudo systemctl start home.mount", it fails.
The journal entries are this:
sudo[1316]: wendler : TTY=pts/0 ; PWD=/home/wendler ; USER=root ; COMMAND=/usr/bin/systemctl start home.mount
sudo[1316]: pam_unix(sudo:session): session opened for user root(uid=0) by wendler(uid=1000)
systemd[1]: home.mount: Directory /home to mount over is not empty, mounting anyway.
systemd[1]: home.mount: Failed to make bind mount source '/data/home': Permission denied
systemd[1]: home.mount: Failed to run 'mount' task: Permission denied
systemd[1]: home.mount: Failed with result 'resources'.
systemd[1]: Failed to mount /home.
However, when I run "sudo mount /home" it works.
Now the weird thing is that after I have mounted /home manually once
and unmounted it again, then "sudo systemctl start home.mount"
suddenly also works! But of course only until the next reboot.
And even if I just do "ls /data" once (either as root or as my user),
it also makes "sudo systemctl start home.mount" start working!
To be fully clear:
- Booting the system (/home fails to mount)
- sudo systemctl start home.mount # fails
- sudo ls /data # shows correct output
- sudo systemctl start home.mount # works!
Additional information:
The NFS export for /data has root_squash set and if I remove this
option, the bind mount of /home works as it should. However, both
/data and /data/home have mode rwxr-xr-x, so root is able to enter and
read these directories even despite root_squash.
It is not a network or mount-order problem. Not only is the bind mount
to /home correctly attempted after /data is mounted during boot,
remember that the bind mount also fails when I try it with "sudo
systemctl start home.mount" minutes afterwards.
Versions (system is a recent installation with all updates applied):
- Ubuntu 22.04
- Linux 5.15.0-40-generic
- systemd 249.11-0ubuntu3.3
- util-linux 2.37.2-4ubuntu3
This appears on both Ubuntu 22.04 machines that I have (a hardware
machine and a VM).
To manage notifications about this bug go to:
https://bugs.launchpad.net/systemd/+bug/1979952/+subscriptions
More information about the foundations-bugs
mailing list