]> git.ipfire.org Git - thirdparty/systemd.git/blame_incremental - units/systemd-nspawn@.service.in
Merge pull request #16556 from keszybz/test-terminal-colors
[thirdparty/systemd.git] / units / systemd-nspawn@.service.in
... / ...
CommitLineData
1# SPDX-License-Identifier: LGPL-2.1+
2#
3# This file is part of systemd.
4#
5# systemd is free software; you can redistribute it and/or modify it
6# under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; either version 2.1 of the License, or
8# (at your option) any later version.
9
10[Unit]
11Description=Container %i
12Documentation=man:systemd-nspawn(1)
13Wants=modprobe@tun.service modprobe@loop.service modprobe@dm-mod.service
14PartOf=machines.target
15Before=machines.target
16After=network.target systemd-resolved.service modprobe@tun.service modprobe@loop.service modprobe@dm-mod.service
17RequiresMountsFor=/var/lib/machines/%i
18
19[Service]
20# Make sure the DeviceAllow= lines below can properly resolve the 'block-loop' expression (and others)
21ExecStart=systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --network-veth -U --settings=override --machine=%i
22KillMode=mixed
23Type=notify
24RestartForceExitStatus=133
25SuccessExitStatus=133
26Slice=machine.slice
27Delegate=yes
28TasksMax=16384
29@SERVICE_WATCHDOG@
30
31# Enforce a strict device policy, similar to the one nspawn configures when it
32# allocates its own scope unit. Make sure to keep these policies in sync if you
33# change them!
34DevicePolicy=closed
35DeviceAllow=/dev/net/tun rwm
36DeviceAllow=char-pts rw
37
38# nspawn itself needs access to /dev/loop-control and /dev/loop, to implement
39# the --image= option. Add these here, too.
40DeviceAllow=/dev/loop-control rw
41DeviceAllow=block-loop rw
42DeviceAllow=block-blkext rw
43
44# nspawn can set up LUKS encrypted loopback files, in which case it needs
45# access to /dev/mapper/control and the block devices /dev/mapper/*.
46DeviceAllow=/dev/mapper/control rw
47DeviceAllow=block-device-mapper rw
48
49[Install]
50WantedBy=machines.target