2017-11-18 17:35:03 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1+
|
|
|
|
#
|
2013-04-30 02:11:37 +02:00
|
|
|
# This file is part of systemd.
|
|
|
|
#
|
|
|
|
# systemd is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU Lesser General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
[Unit]
|
2016-02-26 20:35:09 +01:00
|
|
|
Description=Container %i
|
2013-04-30 02:11:37 +02:00
|
|
|
Documentation=man:systemd-nspawn(1)
|
2014-12-29 12:38:26 +01:00
|
|
|
PartOf=machines.target
|
|
|
|
Before=machines.target
|
2017-02-16 17:57:30 +01:00
|
|
|
After=network.target systemd-resolved.service
|
2017-06-06 17:18:22 +02:00
|
|
|
RequiresMountsFor=/var/lib/machines
|
2013-04-30 02:11:37 +02:00
|
|
|
|
|
|
|
[Service]
|
2016-04-22 14:12:27 +02:00
|
|
|
ExecStart=@bindir@/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --network-veth -U --settings=override --machine=%i
|
2014-05-28 17:17:25 +02:00
|
|
|
KillMode=mixed
|
2013-04-30 02:11:37 +02:00
|
|
|
Type=notify
|
2014-07-03 12:50:11 +02:00
|
|
|
RestartForceExitStatus=133
|
|
|
|
SuccessExitStatus=133
|
2017-12-07 11:58:25 +01:00
|
|
|
WatchdogSec=3min
|
2015-05-19 19:47:52 +02:00
|
|
|
Slice=machine.slice
|
2014-11-05 17:57:23 +01:00
|
|
|
Delegate=yes
|
2016-07-14 12:20:29 +02:00
|
|
|
TasksMax=16384
|
2013-04-30 02:11:37 +02:00
|
|
|
|
2017-08-09 18:19:00 +02:00
|
|
|
# Enforce a strict device policy, similar to the one nspawn configures when it
|
|
|
|
# allocates its own scope unit. Make sure to keep these policies in sync if you
|
|
|
|
# change them!
|
2016-07-22 11:58:03 +02:00
|
|
|
DevicePolicy=closed
|
2015-04-28 20:46:03 +02:00
|
|
|
DeviceAllow=/dev/net/tun rwm
|
|
|
|
DeviceAllow=char-pts rw
|
|
|
|
|
2017-08-09 18:19:00 +02:00
|
|
|
# nspawn itself needs access to /dev/loop-control and /dev/loop, to implement
|
|
|
|
# the --image= option. Add these here, too.
|
2015-10-03 11:23:52 +02:00
|
|
|
DeviceAllow=/dev/loop-control rw
|
|
|
|
DeviceAllow=block-loop rw
|
2015-10-22 00:39:57 +02:00
|
|
|
DeviceAllow=block-blkext rw
|
2015-10-03 11:23:52 +02:00
|
|
|
|
2017-08-09 18:19:00 +02:00
|
|
|
# nspawn can set up LUKS encrypted loopback files, in which case it needs
|
|
|
|
# access to /dev/mapper/control and the block devices /dev/mapper/*.
|
|
|
|
DeviceAllow=/dev/mapper/control rw
|
|
|
|
DeviceAllow=block-device-mapper rw
|
|
|
|
|
2013-04-30 02:11:37 +02:00
|
|
|
[Install]
|
2014-12-29 12:38:26 +01:00
|
|
|
WantedBy=machines.target
|