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>
We abuse a global "args" dictionary to store all state, which may include
unserializable objects that cannot be passed to a new process with the
multiprocessing "spawn" method.
Create a new dict with only the strictly necessary keys for init to work.
In case the app has been changed to headless, we should remove
previously installed desktop file and skip creating new one, so
the app will not appear in the launcher on Linux.
Catching exceptions without specifying the exception type is not
recommended since it will catch all exception, like import errors,
keyboard interruption or name errors.
Some actions can gracefully handle waydroid not having been initialized,
but some others do not. Let's restore an early filter for actions we want to
allow when uninitialized.
Update the representations of file sizes and download speeds to
correct the informal units (kb, mb, kbps and mbps):
- Changed kb to kB for kilobytes
- Changed mb to MB for megabytes
- Changed kbps to kB/s for kilobytes per second
- Changed mbps to MB/s for megabytes per second
Compute download speed and print download progress updates every 2 seconds;
0.01 seconds was too fast to compute any meaningful download speed, and it
unnecessarily floods our DBus progress reporting.
Make sure to also report progress if the download stalled, at 0mbps.
Drop our terrible home-made socket-based IPC.
In its place, use DBus signals for communicating progress updates.
Also greatly simplify the remote-init multiprocessing/multithreading.