udev: String substitutions can be done in ENV, too
[systemd_ALT.git] / units / systemd-nspawn@.service.in
blob079d6064f631e69e2c37a60f610d5dae98ee8939
1 #  SPDX-License-Identifier: LGPL-2.1-or-later
3 #  This file is part of systemd.
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.
10 [Unit]
11 Description=Container %i
12 Documentation=man:systemd-nspawn(1)
13 Wants=modprobe@tun.service modprobe@loop.service modprobe@dm_mod.service
14 PartOf=machines.target
15 Before=machines.target
16 After=network.target modprobe@tun.service modprobe@loop.service modprobe@dm_mod.service
17 RequiresMountsFor=/var/lib/machines/%i
19 [Service]
20 # Make sure the DeviceAllow= lines below can properly resolve the 'block-loop' expression (and others)
21 ExecStart=systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --network-veth -U --settings=override --machine=%i
22 KillMode=mixed
23 Type=notify
24 RestartForceExitStatus=133
25 SuccessExitStatus=133
26 Slice=machine.slice
27 Delegate=yes
28 DelegateSubgroup=supervisor
29 TasksMax=16384
30 {{SERVICE_WATCHDOG}}
32 {# Enforce a strict device policy, similar to the one nspawn configures when it
33  # allocates its own scope unit. Make sure to keep these policies in sync if you
34  # change them! #}
35 DevicePolicy=closed
36 DeviceAllow=/dev/net/tun rwm
37 DeviceAllow=char-pts rw
39 # nspawn itself needs access to /dev/loop-control and /dev/loop, to implement
40 # the --image= option. Add these here, too.
41 DeviceAllow=/dev/loop-control rw
42 DeviceAllow=block-loop rw
43 DeviceAllow=block-blkext rw
45 # nspawn can set up LUKS encrypted loopback files, in which case it needs
46 # access to /dev/mapper/control and the block devices /dev/mapper/*.
47 DeviceAllow=/dev/mapper/control rw
48 DeviceAllow=block-device-mapper rw
50 [Install]
51 WantedBy=machines.target