Shutting down a Debian system
From NewbieDOC
- Chris Lale
- chrislale AT users DOT berlios DOT de
Go to NewbieDOC index
Revision History
Version 1.0 | 10th February 2007 | Revised by Chris Lale | ||||||||||
Initial release | ||||||||||||
| ||||||||||||
Version 1.1 | 26th November 2007 | Revised by Chris Lale | ||||||||||
Reformatted for newbiedoc package; added Abstract and Licence appendix. | ||||||||||||
Newbies often tend to press the RESET button to stop/restart a Debian system. This is the equivalent of pulling the plug - you are risking file corruption. Here is some help about how to shut down your Debian system safely.
1 IntroductionPressing the RESET button is the equivalent of pulling the plug - you are risking file corruption. Here are some safer ways to shut down your system. Adapted from posts in a thread on the Debian-user list (http://lists.debian.org/debian-user/2007/02/msg01393.html). As with so much in GNU/Linux, there is more than one solution.
2 Shutting down from a console screenYou can use these methods even without being logged in. 2.1 Shutting down a local machineIf you are used to another operating system, you may know about the Ctrl-Alt-Del key combination. You must first switch to a virtual console (text only screen) before you can use this method for shutting down Debian. Switch to one of the six virtual consoles (Ctrl-Alt-F1, Ctrl-Alt-F2, ..., Ctrl-Alt-F6) by holding down the Ctrl and Alt keys and tapping one of the function keys "F1" - "F6". At the console screen, issue the reboot key combination Ctrl-Alt-Del (ie hold down the "Ctrl" and "Alt" keys, and tap the "Del" or "Delete" key). Ctrl-Alt-F1 Ctrl-Alt-Del Wait until the system shuts down and the restart begins,then power down the system. You can power down safely anytime before Grub begins to boot the system. Tip: One of your first post-install tasks in Debian might be to comment out the "timeout 5" line in "\boot\grub\menu.lst". This will make sure that Grub does not boot until after you press the "Enter" key.
Alternatively, if you wish Grub to boot automatically but wish to be able to prevent the system from booting, change the delay from 5 seconds (which is much too short) to 10 or 15 seconds.2.2 Shutting down an unresponsive local machineIf a machine is really not responsive (which happens once in a while) you can try these three key combinations in sequence : Alt+SysRq+S, Alt+SysRq+U and Alt+SysRq+O. They synchronise the discs ("S"), unmount the discs ("U") and turn the system off ("O"). It is important that you issue all three commands in the correct order so that you avoid data corruption. Alt+SysRq+S SysRq: Emergency Sync Emergency Sync complete Alt+SysRq+U SysRq: Emergency Remount R/O Emergency Remount R/O complete Alt+SysRq+O SysRq: Power off Shutdown This will minimize the chance of data loss but isn't a long term solution. If you wish to reboot the system rather than shutting down, use Alt+SysRq+B instead of Alt+SysRq+O. Alt+SysRq+B Resetting You can find out more about key combinations at http://linux.about.com/od/linux101/l/blnewbie5_1.htm . 3 Shutting down from a shell promptIf you are logged in to a console you can shut the system down from the shell prompt. You can also use this method from a desktop environment by first obtaining a shell prompt by running a "Terminal" application. 3.1 Shutting down a local machineAt the prompt, switch user ("su") to user root (see also the talk/discussion page). $ su (enter root's password) # The standard way to shut down is to enter # shutdown -h now An alternative is to enter # halt The System is going down for halt now! If you include the "-p" switch, the system will also poweroff. # halt -p If you wish to reboot rather than shutting down, use the "-r" switch instead. # shutdown -r now An alternative is to enter # reboot 3.2 Shutting down a remote machineIf your machine is in a network and Debian has booted, you can access the machine by SSH from another machine in the network. Log in as user root via SSH, and shut it down using one of the "shutdown" commands (see .html#Shutting down from a shell prompt). This works even if the remote keyboard or screen have locked up.
4 Shutting down from a GUI environment4.1 Shutting down from the login screenAfter X starts, but before you have logged in, you should be presented with a graphical login screen. This is provided by the display manager. The default display manager is the Gnome Display Manager ("gdm"). There is an "Actions" menu with a "Shut down the computer" item. You can use this without logging in and without needing a password. 4.2 Shutting down from the Gnome desktopOnce logged into Gnome, you should find "Shut Down" in the "Desktop" menu in the top panel. 4.3 Shutting down from the KDE desktopOnce logged into KDE, you can right click with the mouse pointer over the "desktop" (background), which produces a menu with a number of options, the one you want being "Log out user" (where user is replaced by your login name). This will bring up another window with four selections. "End Current Session" just logs you out, the next two will power down or reboot.
5 Modify the action of the POWER buttonProvided your machine is ACPI compliant, install the package "acpid". It contains a script /etc/acpi/powerbtn.sh and a symbolic link to that (/etc/acpi/events/powerbutton). With that you can just hit the power button of your machine and your system will gracefully do a shutdown to halt and then power off.
6 Appendix A: LicenceCopyright (c) 2007 Chris Lale. chrislale AT users DOT berlios DOT de
Go to NewbieDOC index |