[systemd-devel] Rebooting systemd-nspawn container results in shutdown

Kai Krakow hurikhan77 at gmail.com
Sun Apr 26 07:55:35 PDT 2015


Hello!

I've successfully created a Gentoo container on top of a Gentoo host. I can 
start the container with machinectl, as I can with "systemctl start ...".

Inside the container (logged in via SSH), I could issue a reboot command. 
But that just results in the container being shutdown. It never comes back 
unless I restart the machine with systemctl or machinectl.

BTW: Is there a way to automatically bind-mount some directories instead of 
"systemctl edit --full" the service file and add those?

Here's the service file (modified to bind the portage and src tree):

# /etc/systemd/system/systemd-nspawn at gentoo\x2dcontainer\x2dbase.service
#  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]
Description=Container %I
Documentation=man:systemd-nspawn(1)
PartOf=machines.target
Before=machines.target

[Service]
ExecStart=/usr/bin/systemd-nspawn --quiet --keep-unit --boot --link-
journal=try-guest --network-veth --machine=%I --bind=/usr/portage --bind-
ro=/usr/src
KillMode=mixed
Type=notify
RestartForceExitStatus=133
SuccessExitStatus=133
Delegate=yes
MemoryLimit=4G

[Install]
WantedBy=machines.target

-- 
Replies to list only preferred.



More information about the systemd-devel mailing list