gdm-safe-restart
Restart GDM display manager safely
TLDR
Restart the GNOME Display Manager application when all users have logged out
SYNOPSIS
gdm-safe-restart
DESCRIPTION
gdm-safe-restart is a utility script distributed with the GNOME Display Manager (GDM), the default display manager for GNOME-based Linux distributions. It provides a controlled method to restart the GDM service, ensuring a clean shutdown of the current instance and a smooth startup of a new one. This is particularly useful after editing GDM configuration files (e.g., /etc/gdm/custom.conf) or updating the GDM package, avoiding issues like stale processes, hanging virtual terminals, or incomplete session terminations that can occur with a direct systemctl restart gdm.
The command leverages systemd targets to perform the restart: it temporarily isolates the system to the multi-user.target (stopping graphical services cleanly), resets the default to graphical.target, and then isolates back to graphical, restarting GDM. This minimizes disruptions compared to abrupt service restarts.
Primarily used in distributions like Fedora, RHEL, and derivatives, it requires root privileges (typically via sudo). While designed to be 'safe,' it may still log out active users and terminate graphical sessions, switching to a console temporarily during the process.
CAVEATS
Requires root privileges via sudo.
May log out users and terminate sessions.
Not universal; availability varies by distro and GDM version.
Use in a TTY (Ctrl+Alt+F3) if graphical session is unstable.
INTERNAL MECHANISM
Executes systemctl isolate multi-user.target to stop GDM, then systemctl set-default graphical.target and systemctl isolate graphical.target to restart safely.
USAGE CONTEXT
Common in package managers: e.g., %post scripts for gdm RPMs. Switch to console TTY before running to avoid lockups.
HISTORY
Introduced in GDM around version 3.8 (2013) as part of GNOME evolution. Gained prominence in RPM-based distros (Fedora/RHEL) for post-install package scripts. Enhanced in GDM 40+ (2021) with better systemd integration for Wayland/X11 transitions.


