[systemd-devel] stopping a systemd-nspwan container
Kashyap Chamarthy
kchamart at redhat.com
Sat Mar 22 13:40:53 PDT 2014
On Sat, Mar 22, 2014 at 04:35:19PM +0200, Kevin Wilson wrote:
> Hello,
>
> I had created a container according to systemd-nspwan man page and
> ran it by:
> systemd-nspawn -D/srv/mycontainer
>
> I killed it by pkill systemd-nspaw (and not by poweroff from within the
> container).
>
> Now, running "machinectl" shows that the container still runs:
> machinectl
> MACHINE CONTAINER SERVICE
> mycontainer container nspawn
>
> 1 machines listed.
>
> but the following is strange:
>
> Running:
> systemd-nspawn -D/srv/mycontainer
> gives:
> Spawning namespace container on /srv/mycontainer (console is /dev/pts/2).
> Init process in the container running as PID 2305.
> Failed to register machine: File exists
> Container failed with error code 239.
>
> (and running it again gives the same result but with a different pid
> number).
>
> Is there a way to shut down the container which is running in such a
> scenario ?
Hmm, I'm able to shut it down gracefully. I frequently do package builds
in systemd-nspawn.
Reading your email, I did this below test:
On one terminal:
$ systemd-nspawn -D /srv/testcontainer
Spawning container testcontainer on /srv/testcontainer. Press ^] three
times within 1s to abort execution.
On another terminal, invoke machinectl:
$ machinectl
MACHINE CONTAINER SERVICE
testcontainer container nspawn
1 machines listed.
Kill the systemd-nspawn process:
$ pkill systemd-nspawn
At this point, on the other terminal you see KILL signal invokcation:
[. . .]
-bash-4.2#
Container testcontainer terminated by signal KILL.
$
Invoke machinectl again:
$ machinectl
MACHINE CONTAINER SERVICE
0 machines listed.
$ machinectl status testcontainer
Could not get path to machine: No machine 'testcontainer' known
$
Versions:
$ uname -r; rpm -q systemd
3.13.4-200.fc20.x86_64
systemd-210-7.fc21.x86_64
--
/kashyap
More information about the systemd-devel
mailing list