[systemd-devel] disabling shared mount propagation

Lennart Poettering lennart at poettering.net
Wed Apr 24 07:25:55 PDT 2013


On Tue, 23.04.13 21:51, Albert Strasheim (fullung at gmail.com) wrote:

> What is the recommended way to do this during early boot? Was the
> fstab way of doing it (mentioned in the Git commit message) ever
> implemented?

Karel added that in the very latest util-linux:

http://karelzak.blogspot.com.br/2013/04/umount8-mount8-and-nsenter1.html
> 
> More details:
> 
> We need to reset this before any of our services run.
> 
> We are activating services to manage individual disks with
> SYSTEMD_WANTS via udev, which includes mounting the file system in a
> private mount namespace, via a "unshare" in the ExecStart= part.
> 
> One hack would be to have this unit do ExecStartPre="mount
> --make-rprivate /" but that seems quite gross.

A simple solution would be to write a new service for this:

<snip>
[Unit]
DefaultDependencies=no
Before=local-fs.target

[Service]
ExecStart=/usr/bin/mount --make-rprivate /
Type=oneshot
<snip>

and the pull this in via a .wants link from local-fs.target or so.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list