Situatie
You’re running a minimalist Linux setup using a window manager like i3, Openbox, or bspwm, and sometimes your X session crashes — maybe due to a misbehaving compositor or GPU hiccup. Instead of rebooting your whole machine, you’d like your session to automatically restart with minimal disruption.
Solutie
Solution Overview:
Use a systemd user-level service to monitor and automatically restart your X session via startx
or a custom startup script.
Steps:
-
Create a systemd user service:
Paste this:
-
Ensure your
.xinitrc
is properly set up:
Add your window manager or desktop environment launcher, e.g.:
-
Enable and start the user service:
-
Enable lingering so it works even after logout:
Benefits:
-
You no longer need to reboot your whole system after an X crash
-
Great for minimal or headless setups with a monitor attached
-
Keeps your setup resilient even without a full display manager like GDM or LightDM.
Leave A Comment?