If I have following Libvirt hook in
/etc/libvirt/hooks/qemu.d/hook.sh
#!/usr/bin/env bash
if [[ $1 == "SEARCH_FOR_ME" ]]; then
while true; do
sleep 1
done
fi
bash /etc/libvirt/hooks/qemu.d/hook.sh SEARCH_FOR_ME &
disown $!
touch /tmp/test123
exit 0
Now when I start any of my VMs this hook gets called and what I expected to happen is that a new process will be spawned and will run alongside VM.
What actually happens is that libvirt for some reason knows that forked process is still running. Note that /tmp/test123
is being created.
It seems that original bash script is being suspended.
2438 root 20 0 0 0 0 Z 0.0 0.0 0:00.00 bash
2439 root 20 0 4396 3200 2944 S 0.0 0.0 0:00.04 bash /etc/libvirt/hooks/qemu.d/hook.sh SEARCH_FOR_ME
Also while running the same hook in my terminal I can't observe the same behavior.
nohup works the same way and doesn't fix this issue.
My system:
Artix Linux (OpenRC 0.53)
Hyprland WM (Wayland)
Libvirtd + Virt Manager
Asked by user536950
Jan 16, 2024, 02:36 PM
Last activity: Jan 17, 2024, 09:28 AM
Last activity: Jan 17, 2024, 09:28 AM