<div dir="ltr"><div>Hi,</div><div>I tried again and now it did work.<div>maybe I was wrong somewhere, sorry.</div><div>KW</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 22, 2014 at 10:40 PM, Kashyap Chamarthy <span dir="ltr"><<a href="mailto:kchamart@redhat.com" target="_blank">kchamart@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sat, Mar 22, 2014 at 04:35:19PM +0200, Kevin Wilson wrote:<br>
> Hello,<br>
><br>
> I had created a container according to systemd-nspwan man page and<br>
> ran it by:<br>
> systemd-nspawn -D/srv/mycontainer<br>
><br>
> I killed it by  pkill systemd-nspaw (and not by poweroff from within the<br>
> container).<br>
><br>
> Now, running "machinectl" shows that the container still runs:<br>
> machinectl<br>
> MACHINE                          CONTAINER SERVICE<br>
> mycontainer                      container nspawn<br>
><br>
> 1 machines listed.<br>
><br>
> but the following is strange:<br>
><br>
> Running:<br>
> systemd-nspawn -D/srv/mycontainer<br>
> gives:<br>
> Spawning namespace container on /srv/mycontainer (console is /dev/pts/2).<br>
> Init process in the container running as PID 2305.<br>
> Failed to register machine: File exists<br>
> Container failed with error code 239.<br>
><br>
> (and running it again gives the same result but with a different pid<br>
> number).<br>
><br>
> Is there a way to shut down the container which is running in such a<br>
> scenario ?<br>
<br>
</div></div>Hmm, I'm able to shut it down gracefully. I frequently do package builds<br>
in systemd-nspawn.<br>
<br>
Reading your email, I did this below test:<br>
<br>
On one terminal:<br>
<br>
    $ systemd-nspawn -D /srv/testcontainer<br>
    Spawning container testcontainer on /srv/testcontainer. Press ^] three<br>
    times within 1s to abort execution.<br>
<br>
<br>
On another terminal, invoke machinectl:<br>
<br>
    $ machinectl<br>
    MACHINE                          CONTAINER SERVICE<br>
    testcontainer                    container nspawn<br>
<br>
    1 machines listed.<br>
<br>
<br>
Kill the systemd-nspawn process:<br>
<br>
    $ pkill systemd-nspawn<br>
<br>
<br>
At this point, on the other terminal you see KILL signal invokcation:<br>
<br>
    [. . .]<br>
    -bash-4.2#<br>
    Container testcontainer terminated by signal KILL.<br>
    $<br>
<br>
<br>
Invoke machinectl again:<br>
<br>
    $ machinectl<br>
    MACHINE                          CONTAINER SERVICE<br>
<br>
    0 machines listed.<br>
<br>
    $ machinectl status testcontainer<br>
    Could not get path to machine: No machine 'testcontainer' known<br>
    $<br>
<br>
<br>
Versions:<br>
<br>
    $ uname -r; rpm -q systemd<br>
    3.13.4-200.fc20.x86_64<br>
    systemd-210-7.fc21.x86_64<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
/kashyap<br>
</font></span></blockquote></div><br></div>