From 915e6d1676cf73c4f927f3bbfa21ee82640b1832 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 23 Dec 2016 14:26:05 +0100 Subject: core: add RootImage= setting for using a specific image file as root directory for a service This is similar to RootDirectory= but mounts the root file system from a block device or loopback file instead of another directory. This reuses the image dissector code now used by nspawn and gpt-auto-discovery. --- man/systemd.exec.xml | 53 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'man') diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index e594dc1b0c..09e78c6786 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -86,12 +86,10 @@ A few execution parameters result in additional, automatic dependencies to be added. - Units with WorkingDirectory= or - RootDirectory= set automatically gain - dependencies of type Requires= and - After= on all mount units required to access - the specified paths. This is equivalent to having them listed - explicitly in RequiresMountsFor=. + Units with WorkingDirectory=, RootDirectory= or + RootImage= set automatically gain dependencies of type Requires= and + After= on all mount units required to access the specified paths. This is equivalent to having + them listed explicitly in RequiresMountsFor=. Similar, units with PrivateTmp= enabled automatically get mount unit dependencies for all mounts required to access /tmp and /var/tmp. They will also gain an @@ -117,9 +115,10 @@ User= is used. If not set, defaults to the root directory when systemd is running as a system instance and the respective user's home directory if run as user. If the setting is prefixed with the - character, a missing working directory is not considered fatal. If - RootDirectory= is not set, then WorkingDirectory= is relative to the root - of the system running the service manager. Note that setting this parameter might result in additional - dependencies to be added to the unit (see above). + RootDirectory=/RootImage= is not set, then + WorkingDirectory= is relative to the root of the system running the service manager. Note + that setting this parameter might result in additional dependencies to be added to the unit (see + above). @@ -136,13 +135,24 @@ in conjunction with RootDirectory=. For details, see below. + + RootImage= + Takes a path to a block device node or regular file as argument. This call is similar to + RootDirectory= however mounts a file system hierarchy from a block device node or loopack + file instead of a directory. The device node or file system image file needs to contain a file system without a + partition table, or a file system within an MBR/MS-DOS or GPT partition table with only a single + Linux-compatible partition, or a set of file systems within a GPT partition table that follows the Discoverable Partitions + Specification. + + MountAPIVFS= Takes a boolean argument. If on, a private mount namespace for the unit's processes is created and the API file systems /proc, /sys and /dev will be mounted inside of it, unless they are already mounted. Note that this option has no effect unless used - in conjunction with RootDirectory= as these three mounts are generally mounted in the host + in conjunction with RootDirectory=/RootImage= as these three mounts are generally mounted in the host anyway, and unless the root directory is changed the private mount namespace will be a 1:1 copy of the host's, and include these three mounts. Note that the /dev file system of the host is bind mounted if this option is used without PrivateDevices=. To run the service with a private, minimal @@ -952,7 +962,7 @@ access a process might have to the file system hierarchy. Each setting takes a space-separated list of paths relative to the host's root directory (i.e. the system running the service manager). Note that if paths contain symlinks, they are resolved relative to the root directory set with - RootDirectory=. + RootDirectory=/RootImage=. Paths listed in ReadWritePaths= are accessible from within the namespace with the same access modes as from outside of it. Paths listed in ReadOnlyPaths= are accessible for @@ -971,9 +981,10 @@ Paths in ReadWritePaths=, ReadOnlyPaths= and InaccessiblePaths= may be prefixed with -, in which case they will be ignored when they do not exist. If prefixed with + the paths are taken relative to the root - directory of the unit, as configured with RootDirectory=, instead of relative to the root - directory of the host (see above). When combining - and + on the same - path make sure to specify - first, and + second. + directory of the unit, as configured with RootDirectory=/RootImage=, + instead of relative to the root directory of the host (see above). When combining - and + + on the same path make sure to specify - first, and + + second. Note that using this setting will disconnect propagation of mounts from the service to the host (propagation in the opposite direction continues to work). This means that this setting may not be used for @@ -1004,9 +1015,9 @@ that in this case both read-only and regular bind mounts are reset, regardless which of the two settings is used. - This option is particularly useful when RootDirectory= is used. In this case the - source path refers to a path on the host file system, while the destination path refers to a path below the - root directory of the unit. + This option is particularly useful when RootDirectory=/RootImage= + is used. In this case the source path refers to a path on the host file system, while the destination path + refers to a path below the root directory of the unit. @@ -1094,10 +1105,10 @@ such as CapabilityBoundingSet= will affect only the latter, and there's no way to acquire additional capabilities in the host's user namespace. Defaults to off. - This setting is particularly useful in conjunction with RootDirectory=, as the need to - synchronize the user and group databases in the root directory and on the host is reduced, as the only users - and groups who need to be matched are root, nobody and the unit's own - user and group. + This setting is particularly useful in conjunction with + RootDirectory=/RootImage=, as the need to synchronize the user and group + databases in the root directory and on the host is reduced, as the only users and groups who need to be matched + are root, nobody and the unit's own user and group. -- cgit v1.2.3-54-g00ecf