Linux Container Development
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
To: Michael Tokarev <mjt-XAri/EZa3C4vJsYlp49lxw@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	LXC Development
	<lxc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: Shutting down a container?
Date: Fri, 13 Nov 2009 18:58:01 +0100	[thread overview]
Message-ID: <4AFD9E29.1030601@free.fr> (raw)
In-Reply-To: <4AFD9031.6030102-Gdu+ltImwkhes2APU0mLOQ@public.gmane.org>

Michael Tokarev wrote:
> What's the supposed way to stop a container?
>
> Let's assume I've a container that's running a complete
> system inside, together with its own init and the like.
> It should clean some stuff when "shutting down", it's
> not wise to kill it right away.  So I run something like
> a shutdown in the container.  And it goes up to `halt'
> and just sits here, with only one process left - it's
> the init process with virtual PID=1, which is reading
> from it's /dev/initctl.
>
> I tried to change /etc/init.d/halt to kill a process with
> pid=1, but that does not work - apparently the signal is
> ignored (even with kill -9) -- ie, init continues as if
> there was no signal.
>
> _But_, when I attempt to run strace on the ("virtual")
> init process, it gets killed with `kill -9' immediately.
>
> It also can be killed (also with -9) from the host system
> regardless of strace.
>
> Should there be some different init perhaps, that will
> exit given some command or signal, instead of sysvinit?
> Or is there other way to shutdown a container?
>
> P.S.  Using debian lenny with 2.6.31.6 kernel and lxc
> utils from yesterdays git.
>   
Unfortunately, it's not supported by the kernel yet.

Random thought : may be it could be interesting to have the kernel to 
send a signal to the init's parent when:

 * LINUX_REBOOT_CMD_POWER_OFF : the parent process kills the pid 1

 * LINUX_REBOOT_CMD_RESTART : the parent process kills the pid 1 and 
relaunch the container

 * LINUX_REBOOT_CMD_HALT: the parent process freeze the container
 
...

may be later:
 * LINUX_REBOOT_CMD_SW_SUSPEND : the parent process checkpoint the container

Well it's just an idea.

  parent reply	other threads:[~2009-11-13 17:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13 16:58 Shutting down a container? Michael Tokarev
     [not found] ` <4AFD9031.6030102-Gdu+ltImwkhes2APU0mLOQ@public.gmane.org>
2009-11-13 17:58   ` Daniel Lezcano [this message]
     [not found]     ` <4AFD9E29.1030601-GANU6spQydw@public.gmane.org>
2009-11-13 20:18       ` [lxc-devel] " Andrian Nord
     [not found]         ` <20091113195229.GA2327-Ad3oKH0rFUpsEo8Uxu2CLw@public.gmane.org>
2009-11-14 11:17           ` Michael Tokarev
     [not found]             ` <4AFE91D9.10309-Gdu+ltImwkhes2APU0mLOQ@public.gmane.org>
2009-11-14 14:46               ` Andrian Nord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AFD9E29.1030601@free.fr \
    --to=daniel.lezcano-ganu6spqydw@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=lxc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=mjt-XAri/EZa3C4vJsYlp49lxw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox