Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   portablectl    ( 1 )

прикрепляйте, отсоединяйте или проверяйте портативные сервисные образы (Attach, detach or inspect portable service images)

  Name  |  Synopsis  |  Description  |    Commands    |  Options  |  Files  |  Profiles  |  Exit  |  Environment  |  See also  |

Команды (Commands)

The following commands are understood:

list List available portable service images. This will list all portable service images discovered in the portable image search paths (see below), along with brief metadata and state information. Note that many of the commands below may both operate on images inside and outside of the search paths. This command is hence mostly a convenience option, the commands are generally not restricted to what this list shows.

attach IMAGE [PREFIX...] Attach a portable service image to the host system. Expects a file system path to a portable service image file or directory as first argument. If the specified path contains no slash character ("/") it is understood as image filename that is searched for in the portable service image search paths (see below). To reference a file in the current working directory prefix the filename with "./" to avoid this search path logic.

When a portable service is attached four operations are executed:

1. All unit files of types .service, .socket, .target, .timer and .path which match the indicated unit file name prefix are copied from the image to the host's /etc/systemd/system.attached/ directory (or /run/systemd/system.attached/ — depending whether --runtime is specified, see above), which is included in the built-in unit search path of the system service manager.

2. For unit files of type .service a drop-in is added to these copies that adds RootDirectory= or RootImage= settings (see systemd.unit(5) for details), that ensures these services are run within the file system of the originating portable service image.

3. A second drop-in is created: the "profile" drop-in, that may contain additional security settings (and other settings). A number of profiles are available by default but administrators may define their own ones. See below.

4. If the portable service image file is not already in the search path (see below), a symbolic link to it is created in /etc/portables/ or /run/portables/, to make sure it is included in it.

By default all unit files whose names start with a prefix generated from the image's file name are copied out. Specifically, the prefix is determined from the image file name with any suffix such as .raw removed, truncated at the first occurrence of an underscore character ("_"), if there is one. The underscore logic is supposed to be used to versioning so that the an image file foobar_47.11.raw will result in a unit file matching prefix of foobar. This prefix is then compared with all unit files names contained in the image in the usual directories, but only unit file names where the prefix is followed by "-", "." or "@" are considered. Example: if a portable service image file is named foobar_47.11.raw then by default all its unit files with names such as foobar-quux-waldi.service, foobar.service or foobar@.service will be considered. It's possible to override the matching prefix: all strings listed on the command line after the image file name are considered prefixes, overriding the implicit logic where the prefix is derived from the image file name.

By default, after the unit files are attached the service manager's configuration is reloaded, except when --no-reload is specified (see above). This ensures that the new units made available to the service manager are seen by it.

If --now and/or --enable are passed, the portable service(s) are immediately started (blocking operation unless --no-block is passed) and/or enabled after attaching the image.

detach IMAGE [PREFIX...] Detaches a portable service image from the host. This undoes the operations executed by the attach command above, and removes the unit file copies, drop-ins and image symlink again. This command expects an image name or path as parameter. Note that if a path is specified only the last component of it (i.e. the file or directory name itself, not the path to it) is used for finding matching unit files. This is a convenience feature to allow all arguments passed as attach also to detach.

If --now and/or --enable are passed, the portable service(s) are immediately stopped (blocking operation) and/or disabled before detaching the image. Prefix(es) are also accepted, to be used in case the unit names do not match the image name as described in the attach.

reattach IMAGE [PREFIX...] Detaches an existing portable service image from the host, and immediately attaches it again. This is useful in case the image was replaced. Running units are not stopped during the process. Partial matching, to allow for different versions in the image name, is allowed: only the part before the first "_" character has to match. If the new image doesn't exist, the existing one will not be detached. The parameters follow the same syntax as the attach command.

If --now and/or --enable are passed, the portable service(s) are immediately stopped if removed, started and/or enabled if added, or restarted if updated. Prefixes are also accepted, in the same way as described in the attach case.

inspect IMAGE [PREFIX...] Extracts various metadata from a portable service image and presents it to the caller. Specifically, the os-release(5) file of the image is retrieved as well as all matching unit files. By default a short summary showing the most relevant metadata in combination with a list of matching unit files is shown (that is the unit files attach would install to the host system). If combined with --cat (see above), the os-release data and the units files' contents is displayed unprocessed. This command is useful to determine whether an image qualifies as portable service image, and which unit files are included. This command expects the path to the image as parameter, optionally followed by a list of unit file prefixes to consider, similar to the attach command described above.

is-attached IMAGE Determines whether the specified image is currently attached or not. Unless combined with the --quiet switch this will show a short state identifier for the image. Specifically:

Table 1. Image attachment states ┌─────────────────┬──────────────────────────┐ │State Description │ ├─────────────────┼──────────────────────────┤ │detached │ The image is currently │ │ │ not attached. │ ├─────────────────┼──────────────────────────┤ │attached │ The image is currently │ │ │ attached, i.e. its unit │ │ │ files have been made │ │ │ available to the host │ │ │ system. │ ├─────────────────┼──────────────────────────┤ │attached-runtime │ Like attached, but the │ │ │ unit files have been │ │ │ made available │ │ │ transiently only, i.e. │ │ │ the attach command has │ │ │ been invoked with the │ │ │ --runtime option. │ ├─────────────────┼──────────────────────────┤ │enabled │ The image is currently │ │ │ attached, and at least │ │ │ one unit file associated │ │ │ with it has been │ │ │ enabled. │ ├─────────────────┼──────────────────────────┤ │enabled-runtime │ Like enabled, but the │ │ │ unit files have been │ │ │ made available │ │ │ transiently only, i.e. │ │ │ the attach command has │ │ │ been invoked with the │ │ │ --runtime option. │ ├─────────────────┼──────────────────────────┤ │running │ The image is currently │ │ │ attached, and at least │ │ │ one unit file associated │ │ │ with it is running. │ ├─────────────────┼──────────────────────────┤ │running-runtime │ The image is currently │ │ │ attached transiently, │ │ │ and at least one unit │ │ │ file associated with it │ │ │ is running. │ └─────────────────┴──────────────────────────┘

read-only IMAGE [BOOL] Marks or (unmarks) a portable service image read-only. Takes an image name, followed by a boolean as arguments. If the boolean is omitted, positive is implied, i.e. the image is marked read-only.

remove IMAGE... Removes one or more portable service images. Note that this command will only remove the specified image path itself — it refers to a symbolic link then the symbolic link is removed and not the image it points to.

set-limit [IMAGE] BYTES Sets the maximum size in bytes that a specific portable service image, or all images, may grow up to on disk (disk quota). Takes either one or two parameters. The first, optional parameter refers to a portable service image name. If specified, the size limit of the specified image is changed. If omitted, the overall size limit of the sum of all images stored locally is changed. The final argument specifies the size limit in bytes, possibly suffixed by the usual K, M, G, T units. If the size limit shall be disabled, specify "-" as size.

Note that per-image size limits are only supported on btrfs file systems. Also, depending on BindPaths= settings in the portable service's unit files directories from the host might be visible in the image environment during runtime which are not affected by this setting, as only the image itself is counted against this limit.