<p><br>
On Feb 4, 2013 1:36 PM, "Tom Gundersen" <<a href="mailto:teg@jklm.no">teg@jklm.no</a>> wrote:<br>
><br>
><br>
> On Feb 4, 2013 10:31 AM, "Lennart Poettering" <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br>
> ><br>
> > On Fri, 01.02.13 12:50, Jake Edge (<a href="mailto:jake@lwn.net">jake@lwn.net</a>) wrote:<br>
> ><br>
> > > [ OK, let's try this again ... since I'm impatient about it sitting in<br>
> > > the moderator queue, I went ahead and joined up ]<br>
> > ><br>
> > > Hi Lennart (and the rest of the systemd gang),<br>
> > ><br>
> > > I was quite surprised by some behavior that I found today in Fedora 18,<br>
> > > which I think comes from systemd. I was trying to play with mount<br>
> > > namespaces and was rather surprised to find that they didn't work as<br>
> > > expected. After some googling, I realized that Fedora makes / a shared<br>
> > > mount by default. That appears to come from:<br>
> > ><br>
> > > <a href="http://cgit.freedesktop.org/systemd/systemd/commit/?id=b3ac5f8cb98757416d8660023d6564a7c411f0a0">http://cgit.freedesktop.org/systemd/systemd/commit/?id=b3ac5f8cb98757416d8660023d6564a7c411f0a0</a><br>
> > ><br>
> > > where you say:<br>
> > ><br>
> > > Setups which prefer the default of "private" should undo this change<br>
> > > via invoking "mount --make-private /" or a similar command after boot.<br>
> > ><br>
> > > I am not sure that I want the default to be "private", but if I did,<br>
> > > what is the proper, systemd-ish way to do so?<br>
> ><br>
> > Drop a unit file like this one to /etc/systemd/system/make-shared.service:<br>
> ><br>
> > [Unit]<br>
> > Description=I like my hierarchies private<br>
> > DefaultDependencies=no<br>
> > Conflicts=shutdown.target<br>
> > Before=local-fs-pre.target shutdown.target<br>
> ><br>
> > [Service]<br>
> > Type=oneshot<br>
> > RemainAfterExit=yes<br>
> > ExecStart=/bin/mount --make-rprivate /<br>
> ><br>
> > And then pull this into the early boot:<br>
> ><br>
> > # mkdir -p /etc/systemd/system/local-fs.target.wants/<br>
> > # ln -s ../make-shared.service /etc/systemd/system/local-fs.target.wants/<br>
> ><br>
> > I didn't test this, but it should do the job, nicely.<br>
> ><br>
> > Explanations:<br>
> ><br>
> > As this is an early boot process we need to disable the default<br>
> > ordering/requirement dependencies systemd adds to services via<br>
> > DefaultDependencies=no. Then, we order ourselves before<br>
> > "local-fs-pre.target", which has the benefit that we can be sure that<br>
> > further mounted fs will inherit the flag nicely and<br>
> > race-freely. local-fs-pre.target is ordered after all local mounts.<br>
><br>
> *before*?</p>
<p>Meh, scratch that, Lennart already corrected it.</p>
<p>> > We also order ourselves relative to shutdown.target, which ensures this<br>
> > unit is stopped at shutdown. This is just to make things nice, and<br>
> > actually has very little effect, as the unit doesn't do anything anyway<br>
> > when stopped.<br>
> ><br>
> > We use Type=oneshot since the specified command should be executed at<br>
> > boot and be waited for before boot progresses (adhering to the ordering<br>
> > dependencies expressed in [Unit]).<br>
> ><br>
> > We use RemainAfterExit=yes so that the unit stays around after it is<br>
> > started, so that we can easily check after boot if it got properly<br>
> > started during boot.<br>
> ><br>
> > Finally, the ln -s line makes sure the unit is activated as part of<br>
> > local-fs.target, which is where all local file system units tend to be<br>
> > pulled in.<br>
> ><br>
> > Hope this makes sense!<br>
> ><br>
> > Lennart<br>
> ><br>
> > --<br>
> > Lennart Poettering - Red Hat, Inc.<br>
> > _______________________________________________<br>
> > systemd-devel mailing list<br>
> > <a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a><br>
> > <a href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel">http://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</p>