Skip to content
September 22, 2010 / ftth

Restarting gdm from within X

When typing “sudo /etc/init.d/gdm restart” from within X itself (e.g., when using gnome-terminal), gdm only stops.When doing the same from a virtual console (CTR+ALT+F1), gdm effectively restarts.

This happens because when the X server dies, the last command (being “/etc/init.d/gdm restart”) stops in the middle (at “/etc/init.d/gdm stop”). This also happens with variants such as “service gdm restart”, “invoke-rc.d gdm restart” etc. Using nohup does not help either.

I needed to have a python GUI program restart gdm by itself. I finally found how to restart gdm “properly” (after an Xorg.conf change for instance) without needing a manual intervention (CTR+ALT+BACK or CTRL+ALT+F1):

pkill -HUP -f gdm

This command will find gdm by it’s name (you can also replace “-f gdm” by gdm’s PID), and send the HUP signal directly to the daemon, resulting in a single-operation daemon restart.

Resources: gdm usage

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: