Bug#863850: systemd service file does not stop systemd-based containers

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#863850: systemd service file does not stop systemd-based containers

JD Friedrikson

Package: lxc
Version: 1:2.0.7-2

Hello,

Debian's packaged version of LXC currently is not able to stop systemd-based containers as they have not responded to SIGPWR as of https://github.com/lxc/lxc/commit/8eb62c245e9b67b451ba0766f3ecd7c6f2081d73 .

The appropriate way to stop systemd via a signal is to use SIGRTMIN+3 (or, I think, SIGRTMIN+4). The lxc-stop binary automatically determines whether the container will respond to this signal and handles it appropriately. Therefore, we should use that binary with ExecStop instead of using a signal (in the service file).

This has already been fixed upstream:

https://github.com/lxc/lxc/commit/c08d29b6d134fbb94d2cff0454ce27eb66930c4d

It would be cool if we could package this fix before the release. Here's a patch:

"""

diff --git a/config/init/systemd/lxc@.service.in b/config/init/systemd/lxc@.service.in
index 44d11e8e..a2aa2211 100644
--- a/config/init/systemd/lxc@.service.in
+++ b/config/init/systemd/lxc@.service.in
@@ -8,9 +8,9 @@ Documentation=man:lxc-start man:lxc
[Service]
Type=simple
KillMode=mixed
-KillSignal=SIGPWR
TimeoutStopSec=120s
ExecStart=@BINDIR@/lxc-start -F -n %i
+ExecStop=@BINDIR@/lxc-stop -n %i
# Environment=BOOTUP=serial
# Environment=CONSOLETYPE=serial
Delegate=yes
--
2.13.0

"""

Please let me know if you need anything more from me.

Cheers,
JD

Reply | Threaded
Open this post in threaded view
|

Bug#863850: [pkg-lxc-devel] Bug#863850: systemd service file does not stop systemd-based containers

Evgeni Golov-2
Ohai,

On Wed, May 31, 2017 at 07:10:01PM -0400, JD Friedrikson wrote:
> Debian's packaged version of LXC currently is not able to stop systemd-based containers as they have not responded to SIGPWR as of https://github.com/lxc/lxc/commit/8eb62c245e9b67b451ba0766f3ecd7c6f2081d73 .
>
> The appropriate way to stop systemd via a signal is to use SIGRTMIN+3 (or, I think, SIGRTMIN+4). The lxc-stop binary automatically determines whether the container will respond to this signal and handles it appropriately. Therefore, we should use that binary with ExecStop instead of using a signal (in the service file).

You are absolutelly right! Thanks for catching this.

> This has already been fixed upstream:
>
> https://github.com/lxc/lxc/commit/c08d29b6d134fbb94d2cff0454ce27eb66930c4d

And thanks for fixing it upstream!

> It would be cool if we could package this fix before the release. Here's a patch:

I fear it's too late for Stretch 9.0, but I'll see to include that into
9.1.

Reply | Threaded
Open this post in threaded view
|

Bug#863850: [pkg-lxc-devel] Bug#863850: systemd service file does not stop systemd-based containers

JD Friedrikson
Hi again,

> You are absolutelly right! Thanks for catching this.
> And thanks for fixing it upstream!

You're welcome! I enjoy fixing things.

> I fear it's too late for Stretch 9.0, but I'll see to include that into
> 9.1.

It appears that my endeavors have been foiled. Very well, then. Is there any place where we can document the issue or do we just leave it here until 9.1?

Cheers,
JD