[BUG] Session logout/re-login freezes system due to leftover background daemons
Describe the bug
Hey everyone,
I ran into a persistent issue where trying to log out and then log back into my Hyprland session completely freezes the system. After a bit of testing, it looks like the terminate_clients() function in power.sh successfully handles foreground client windows, but misses crucial background components like waybar, quickshell widgets, and notification daemons (swaync).
Because they aren't fully killed, these daemons stick around as zombie processes. When a fresh login session tries to spin them up again, they conflict over sockets/buses, deadlocking the window manager and graphics server on the login screen.
Also, there is a minor typo in your power.sh script: it uses $home, which bash does not recognize, instead of the system variable $HOME
I’ve already patched this locally on my machine by forcing a pkill -9 on the system daemons (waybar, quickshell, swaync, hypridle) right inside the exit, reboot, and shutdown blocks. It completely solves the re-login freeze and leaves the display manager with a totally clean slate.
If you're open to it, give me the go-ahead and I'd be happy to open a quick PR with the fix!
Steps to reproduce
- First logging to hyprland.
- logout
- enter password
- system freezes
- have to manually restart
Expected behavior
The re-logging in to the hyprland should have worked without any crash.
Screenshots
No response
Distribution
EndeavourOS
If Other, specify
No response
Additional context
No response
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
I experience this myself as well. Every now and then, however. So NOT each time...
Anyway, I will copy the solution you presented here to my own configuration and see what will happen with this freezing issue. Thanks!
@Gaurav5189 Can you quote the exact pkill -9command that you execute in $HOME/.mydotfiles/com.ml4w.dotfiles/.config/hypr/scripts/power.sh in the the exit, reboot, and shutdown blocks, please?
@eljejer sure, just put these pkill commands inside the exit, reboot, and shutdown blocks and fix the lowercase $home to $HOME.
pkill -9 waybar
pkill -9 quickshell
pkill -9 swaync
pkill -9 hypridle
@Gaurav5189 / @eljejer - Are you using wlogout to manage power events? Right now ~/.config/ml4w/scripts/ml4w-power is the most recent way of handling those events, and they use more Hyprland-recommended methods for handling those activities. If so, we could update ~/.config/wlogout/layout to call the new script.
@hurlbutt - I am using the Quickshell Power Menu Widget and not wlogout itself.
I checked my local configuration and realized that the layout file (~/.config/wlogout/layout) was still pointing to the legacy ~/.config/hypr/scripts/power.sh script(which i also corrected). I also noticed that the official repository hasn't been updated to point the wlogout layout to ml4w-power yet either.
I have updated my local wlogout layout to call the new script(ml4w-power).
Since I have hyprshutdown installed, ml4w-power automatically uses it to gracefully shut down the session. This completely resolves the re-login freeze issue!
If you'd like, I can open a PR to update the wlogout layout template in the repository to use ml4w-power so other users don't run into this legacy script issue.
@Gaurav5189 - Regarding updating wlogout, I'd defer to @mylinuxforwork and what he wants to do with any references to that dependency given it's been removed. He may want to delete all outstanding references and leave only the QS solution in place.