I have systemd-nspawn containers which are enabled and start upon the boot of the host server.

The problem I have is that they do not understand the reboot command issued on the guest: the container is cleanly shut down and does not restart.

Is there a way to fix this, i.e. inform the parent server (the host) that the container should be restarted?

Please note that this is different form the poweroff case (again, a command issued on the guest), where the container should be shut down and not reboot afterwards (this is the case now, whenever the container is shut down).

  • Please read man machinectl. It has the info you need. – Mio Rin Mar 25 '17 at 11:50
  • @Mioriin: I read the man page but did not find anything related to my problem. Can you give me a hint? (short of providing the answer) – WoJ Mar 25 '17 at 11:53
  • 1
    machinectl reboot [nameofcontainer] was the one I was thinking of, but on closer inspection I see you want to do this from within the container, so that won't work. Setting the service to restart on exit might, though. Then you can just shut it down normally (or kill it), then systemd will start it up again automagically. – Mio Rin Mar 25 '17 at 18:38
  • @Mioriin: as mentioned in my question - this is not a solution as it does not take into account the reboot vs. poweroff command on the guest. – WoJ Mar 26 '17 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.