Execute o script systemd no chroot fora do chroot?

0

É possível executar um serviço SystemD com uma raiz diferente? Por exemplo, se eu usar debootstrap para instalar uma distro paralela, e dentro dessa distro é um serviço systemd que eu gostaria de executar, existe uma maneira de configurar o systemd no host para fazer isso?

Eu vejo WorkingDirectory no script atualmente.

    
por Evan Carroll 21.07.2018 / 23:17

1 resposta

1

O SystemD suporta isso através de RootDirectory ,

RootDirectory= Takes a directory path relative to the host's root directory (i.e. the root of the system running the service manager). Sets the root directory for executed processes, with the chroot(2) system call. If this is used, it must be ensured that the process binary and all its auxiliary files are available in the chroot() jail. Note that setting this parameter might result in additional dependencies to be added to the unit (see above).

The MountAPIVFS= and PrivateUsers= settings are particularly useful in conjunction with RootDirectory=.

APIVFS , é provavelmente o mais útil,

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 are mounted inside of it, unless they are already mounted

    
por 21.07.2018 / 23:18