Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 531150 - Handbook: add --make-rprivate to rbind mount options to work around systemd behavior
Summary: Handbook: add --make-rprivate to rbind mount options to work around systemd b...
Status: RESOLVED FIXED
Alias: None
Product: [OLD] Docs on www.gentoo.org
Classification: Unclassified
Component: Installation Handbook (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Docs Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-29 16:28 UTC by RedEyedMan
Modified: 2014-12-21 15:22 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Testing chroot with --rbind on systemd (chroot_test.log,5.14 KB, text/plain)
2014-11-30 15:21 UTC, RedEyedMan
Details
Optional patch reverting private mount propagation (001-mount_propagation_private.patch,1.29 KB, patch)
2014-12-01 12:06 UTC, RedEyedMan
Details | Diff
Optional patch reverting private mount propagation (001-mount_propagation_private.patch,1.29 KB, patch)
2014-12-01 12:13 UTC, RedEyedMan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description RedEyedMan 2014-11-29 16:28:50 UTC
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 :(
Comment 1 RedEyedMan 2014-11-29 18:35:37 UTC
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.
Comment 2 Alexander Tsoy 2014-11-30 00:19:07 UTC
It's a feature, not a bug. :) systemd marks / as shared:

$ findmnt -o TARGET,PROPAGATION /
TARGET PROPAGATION
/      shared
Comment 3 RedEyedMan 2014-11-30 11:46:07 UTC
(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
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2014-11-30 13:54:26 UTC
(In reply to Galym Kerimbekov from comment #0)
> http://pastebin.com/MLP2D52K

Please attach any relevant data to this bug report.
Comment 5 RedEyedMan 2014-11-30 15:21:04 UTC
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.
Comment 6 RedEyedMan 2014-11-30 15:36:47 UTC
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 :)
Comment 7 RedEyedMan 2014-12-01 12:06:32 UTC
Created attachment 390690 [details, diff]
Optional patch reverting private mount propagation

Optional patch reverting private mount propagation (ms_private)
Comment 8 RedEyedMan 2014-12-01 12:13:05 UTC
Created attachment 390694 [details, diff]
Optional patch reverting private mount propagation

 Optional patch reverting private mount propagation (ms_private) Fixed mistakes in commenting code
Comment 9 Mike Gilbert gentoo-dev 2014-12-01 16:09:58 UTC
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.
Comment 10 Sven Vermeulen (RETIRED) gentoo-dev 2014-12-20 13:53:18 UTC
Thanks. I've added the --make-rprivate mount options. They do not seem to cause problems with non-systemd deployments.
Comment 11 Sven Vermeulen (RETIRED) gentoo-dev 2014-12-21 14:42:34 UTC
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?
Comment 12 Mike Gilbert gentoo-dev 2014-12-21 15:22:06 UTC
(In reply to Sven Vermeulen from comment #11)

Interesting. Yes, make-rslave should also resolve the umount strangness.