]> git.ipfire.org Git - thirdparty/systemd.git/blame - units/systemd-nspawn@.service.in
nspawn: port over to /supervisor/ subcgroup being delegated to nspawn
[thirdparty/systemd.git] / units / systemd-nspawn@.service.in
CommitLineData
db9ecf05 1# SPDX-License-Identifier: LGPL-2.1-or-later
a7df2d1e 2#
05947bef
LP
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]
7a8c9e44 11Description=Container %i
05947bef 12Documentation=man:systemd-nspawn(1)
143a1f10 13Wants=modprobe@tun.service modprobe@loop.service modprobe@dm_mod.service
6a140df0
LP
14PartOf=machines.target
15Before=machines.target
8f1359bf 16After=network.target modprobe@tun.service modprobe@loop.service modprobe@dm_mod.service
3b355677 17RequiresMountsFor=/var/lib/machines/%i
05947bef
LP
18
19[Service]
31ea9c89 20# Make sure the DeviceAllow= lines below can properly resolve the 'block-loop' expression (and others)
cdc6804b 21ExecStart=systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --network-veth -U --settings=override --machine=%i
d8e40d62 22KillMode=mixed
05947bef 23Type=notify
ce38dbc8
LP
24RestartForceExitStatus=133
25SuccessExitStatus=133
45d383a3 26Slice=machine.slice
a931ad47 27Delegate=yes
1a3704dc 28DelegateSubgroup=supervisor
8d36b53a 29TasksMax=16384
059cc610 30{{SERVICE_WATCHDOG}}
05947bef 31
fa104516
ZJS
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! #}
54cd6556 35DevicePolicy=closed
773ce3d8 36DeviceAllow=/dev/net/tun rwm
773ce3d8
LP
37DeviceAllow=char-pts rw
38
3982becc
LP
39# nspawn itself needs access to /dev/loop-control and /dev/loop, to implement
40# the --image= option. Add these here, too.
988a4796
LP
41DeviceAllow=/dev/loop-control rw
42DeviceAllow=block-loop rw
a2c90f05 43DeviceAllow=block-blkext rw
988a4796 44
3982becc
LP
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/*.
47DeviceAllow=/dev/mapper/control rw
48DeviceAllow=block-device-mapper rw
49
05947bef 50[Install]
6a140df0 51WantedBy=machines.target