Hi all! I often use chroot for building my custom gentoo-based live and I used "mount --rbind". It works well and I can unmount chroot without using -l parameter. But after moving to systemd, I have to append -l that unmounts stuff like "/mnt/gentoo/dev/pts" and breaks bash session, i.e. new bash sessions now doesn't work after doing abovenamed things. Here full output of that steps I reproduced: http://pastebin.com/MLP2D52K After that we have broken system till we run systemctl daemon-reexec to return unmounted things that are related to system (not chroot) System-folks suggest me to use --bind instead of --rbind and it works well with systemd. However, it's not a fix if it only avoids the behavior by not mounting /dev/shm and /dev/pts So, that strange mount --rbind behavior fully discouraged me :(
So, I can't use --rbind when systemd is used, but I can do same thing when openrc is active. With systemd there should be used --bind and it not breaks new bash session.
It's a feature, not a bug. :) systemd marks / as shared: $ findmnt -o TARGET,PROPAGATION / TARGET PROPAGATION / shared
(In reply to Alexander Tsoy from comment #2) > It's a feature, not a bug. :) systemd marks / as shared: > > $ findmnt -o TARGET,PROPAGATION / > TARGET PROPAGATION > / shared Yes, Lennart did it in this commit: http://cgit.freedesktop.org/systemd/systemd/commit/?id=b3ac5f8cb98757416d8660023d6564a7c411f0a0 So, chroot should be mount with --make-rprivate --rbind
(In reply to Galym Kerimbekov from comment #0) > http://pastebin.com/MLP2D52K Please attach any relevant data to this bug report.
Created attachment 390654 [details] Testing chroot with --rbind on systemd Unmounting chroot that mount with --rbind on systemd also unmounts things related to system with negative effect to bash. Sorry if my technical terminology is wrong, I trying to not use it.
I noticed that Gentoo handbook points to use mount --rbind that works well if you're doing it on system that have sysvinit/openrc, but it isn't work well of there is systemd. Systemd marks / as shared as Alexander noticed. So, imo, Handbook should notice to use --make-rprivate --rbind instead, if users going to build in chroot on their systems which have systemd. I mean because not all users builds Gentoo from Minimal CD. Anyway, it is just my opinion :)
Created attachment 390690 [details, diff] Optional patch reverting private mount propagation Optional patch reverting private mount propagation (ms_private)
Created attachment 390694 [details, diff] Optional patch reverting private mount propagation Optional patch reverting private mount propagation (ms_private) Fixed mistakes in commenting code
This is basically a duplicate of bug 516980. We are definitely not going to conditionally patch this, and systemd upstream is not going to change the "shared" mount behavior. Docs team: please consider changing the handbook per comment 6. If you have any questions, feel free to ask.
Thanks. I've added the --make-rprivate mount options. They do not seem to cause problems with non-systemd deployments.
The make-rprivate, unlike what was expected from the documentation, removed the submounts on /sys and /dev (well, /mnt/gentoo/{sys,dev}). We're now documenting first the --rbind and then the --make-rslave option. Hopefully that still fixes the systemd behavior?
(In reply to Sven Vermeulen from comment #11) Interesting. Yes, make-rslave should also resolve the umount strangness.