Files
Nikolay Metchev 5f19fe9c4c lxc: Fix post-stop hook erroring on every container stop
The post-stop hook was set to `/dev/null` as a no-op. Its actual purpose
(see #436) is to make LXC suppress auto-respawning the container when the
guest reboots/crashes, since waydroid manages the session lifecycle itself
-- LXC suppresses the respawn when the post-stop hook exits non-zero, and
/dev/null "achieves" this only because it is not executable.

The side effect is that the hook fails on *every* container stop, including
a normal shutdown, logging an error that users routinely misdiagnose:

    lxc-start: waydroid: utils.c: run_buffer: 569 Script exited with status 126
    lxc-start: waydroid: start.c: lxc_end: 1178 Failed to run lxc.hook.post-stop for container "waydroid"

(Reproduced on LXC 7.0.0; status 126 is execve() of the non-executable
/dev/null.)

Replace it with a real post-stop script that keys off LXC_TARGET: exit 0 on
"stop" so a routine `waydroid session stop` is clean, and non-zero otherwise
(reboot, or an unset value on older LXC) to preserve the respawn-suppression.
The script path is substituted into the generated config in set_lxc_config(),
mirroring the existing LXCARCH handling.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 17:26:57 +02:00
..
2021-09-06 20:37:33 +04:30