mirror of
https://github.com/waydroid/waydroid.git
synced 2026-07-30 17:37:13 -04:00
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>
18 lines
758 B
Bash
Executable File
18 lines
758 B
Bash
Executable File
#!/bin/sh
|
|
# LXC post-stop hook.
|
|
#
|
|
# waydroid manages the container lifecycle itself, so LXC must not
|
|
# automatically respawn the container when the guest reboots or crashes.
|
|
# LXC suppresses that respawn when the post-stop hook exits non-zero.
|
|
#
|
|
# We only need to suppress it on a reboot; on a normal shutdown we exit 0
|
|
# so that a routine `waydroid session stop` doesn't log a spurious
|
|
# "Failed to run lxc.hook.post-stop" error (the previous no-op hook was
|
|
# `/dev/null`, which is not executable and therefore failed on every stop).
|
|
#
|
|
# LXC_TARGET is "stop" for a shutdown and "reboot" for a reboot. Default to
|
|
# suppressing the respawn for any other/unset value to preserve the old
|
|
# always-non-zero behaviour.
|
|
[ "$LXC_TARGET" = "stop" ] && exit 0
|
|
exit 1
|