[lxc-users] properly shutdown jessie container on wheezy host

Bostjan Skufca bostjan at a2o.si
Fri Nov 13 19:23:19 UTC 2015


Speaking off the top of my head, but does not lxc-stop send sigterm signal
to all processes in a container, and then waits for configurable amount of
time (default=60s), before sending sigkill?

If your processes expect to be shut down by init scripts that need to do
some additional tasks, well, that will be the problem in this case.

lxc-shutdown is the second option, but you need to have your init
configured properly to start regular shutdown process, if I am not mistaken.

Personally I use either lxc-stop or "halt" from within the container.
My rule of thumb is:
- use halt if container is unprivileged (as procedure is faster - less
typing), or
- use lxc-stop if container is privileged.

(rule origin: I managed to kill the host once with improperly configured
privileged container and a "halt" command, so there is that:).

b.


On 13 November 2015 at 17:10, Alex Mestiashvili <alex at biotec.tu-dresden.de>
wrote:

> Depending on the version of lxc, lxc-stop behaves differently.
>
> In the version I use, lxc-stop kills all the processes inside the
> container which can lead to problems if you run a database server for
> example.
> That's why there is a separate tool - lxc-shutdown which stops a
> container and waits for the processes to exit gracefully.
> In newer versions of lxc with lxc-stop one can reboot, cleanly shut
> down, or kill a container....
>
> Regards,
> Alex
>
> On 11/13/2015 04:30 PM, Saint Michael wrote:
> > Good question. I always use lxc-stop
> >
> > On Fri, Nov 13, 2015 at 9:29 AM, Alex Mestiashvili <
> > alex at biotec.tu-dresden.de> wrote:
> >
> >> Hi All,
> >>
> >> Is there a way to properly shutdown Jessie container on a Wheezy host ?
> >> lxc version is 0.8.0~rc1-8+deb7u2
> >>
> >>  lxc-shutdown -n $host  which is basically
> >>
> >>  chroot /var/lib/lxc/${_CONTAINER}/rootfs telinit 0
> >>
> >> ends up in:
> >>
> >> "telinit: timeout opening/writing control channel /run/initctl"
> >>
> >> with no change to the host.
> >>
> >> Of course I can ssh/console to the container, run shutdown and then use
> >> lxc-stop to kill it, but may be there is a workaround for a direct
> >> shutdown ?
> >>
> >> Thank you!
> >> _______________________________________________
> >> lxc-users mailing list
> >> lxc-users at lists.linuxcontainers.org
> >> http://lists.linuxcontainers.org/listinfo/lxc-users
> >
> >
> >
> > _______________________________________________
> > lxc-users mailing list
> > lxc-users at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-users
> >
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20151113/d014df77/attachment-0001.html>


More information about the lxc-users mailing list