Linux tip, Fedora tip / howto: restoring the "shutdown" and "restart" options of the logout dialog

back to notes and tips index

Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.

restoring the "shutdown" and "restart" options of the logout dialog

In Fedora Core 4, at some point the "shutdown" and "restart" options of the logout menu went missing. From searching the web, I figured that this has to do with me not running gdm.

The procedure below describes a crude method to restore this functionality, without having to use gdm:

  • check your version of gnome-session:
    rpm -q gnome-session
  • go to the Gnome ftp server, and download the appropriate tarball for your version. For example, I was running gnome-session-2.10.0-2, so I downloaded gnome-session-2.10.0.tar.gz
  • tar zxvf gnome-session-2.10.0.tar.gz
    cd gnome-session-2.10.0/gnome-session
    emacs logout.c (or use your favourite editor instead of emacs)
  • replace these lines:
    halt_supported = gdm_supports_logout_action (GDM_LOGOUT_ACTION_SHUTDOWN);
    reboot_supported = gdm_supports_logout_action (GDM_LOGOUT_ACTION_REBOOT);
    halt_supported = reboot_supported = 1;
  • replace this line:
    logout_action = GDM_LOGOUT_ACTION_SHUTDOWN;
    execl("/sbin/shutdown", "shutdown", "-h", "now", NULL);
  • replace this line:
    logout_action = GDM_LOGOUT_ACTION_REBOOT;
    execl("/sbin/shutdown", "shutdown", "-r", "now", NULL);
  • log out of your X session, change back to the gnome-session-2.10.0 directory, and run:
    rpm -e gnome-session
    make install (it's probably better to use a tool like checkinstall to create an RPM)
  • (as root): chomd +s /sbin/shutdown (so ordinary users can run shutdown)
  • now you should be able to start X again (as a regular user), and see (functioning!) options "shutdown" and "restart" in the logout menu. Note that this shuts the system down in a bit of an abrupt fashion, killing all processes immediately (so make sure to save your work before you shutdown).

← back to notes and tips index
Please do not copy the text of this tip (© Patrick Min) to your web site.