Hot answers tagged shutdown
22
Generally, one uses the shutdown command. It allows a time delay and warning message before shutdown or reboot, which is important for system administration of multiuser shell servers; it can provide the users with advance notice of the downtime.
As such, the shutdown command has to be used like this to halt/switch off the computer immediately (on Linux and ...
20
The hardware power button triggers an ACPI event that acpid (the ACPI daemon) notices and reacts to; in this case by shutting down the system, although you could have it do whatever you want. The ACPI daemon runs as root, so it has permission to shutdown the system. Desktop environments (e.g. gdm for Gnome) typically run as root as well, so I suspect they ...
15
Linux Mint is based on Ubuntu, so I'm guesing the runlevel system is probably the same. On Ubuntu, scripts for the different runlevels are executed according to their presence in the /etc/rc[0-6].d directories. Runlevel 0 corresponds to shutdown, and 6 to reboot.
Typically the script itself is stored in /etc/init.d, and then symlinks are placed in the ...
14
We don't necessarily need them both, but we have them both because of the history of Unix, and its multiplicity of versions.
From their respective man pages:
The shutdown utility appeared in 4.0BSD.
A reboot utility appeared in Version 6 AT&T UNIX.
shutdown is more general-purpose, and more powerful, while reboot is friendlier and easier to ...
14
It depends you started task. If it is some command line tool you could simply run halt or shutdown -h now:
wget http://..../somelargefile; halt - halt will be executed after wget
wget http://..../somelargefile && halt - halt will be executed if wget return no errors
wget http://..../somelargefile || halt - halt will be executed if wget return ...
12
On most Linux systems, the Ctrl+Alt+Del key sequence action is configured in either /etc/inittab or /etc/init/control-alt-delete.conf.
Usually, this will reboot the system, but you could modify the command to halt the system instead.
In /etc/inittab:
ca::ctrlaltdel:/sbin/shutdown -t3 -h now
Or /etc/init/control-alt-delete.conf:
start on ...
10
There is no difference in them. Internally they do exactly the same thing:
reboot uses the shutdown command (with the -r switch). The shutdown command used to kill all the running processes, unmount all the file systems and finally tells the kernel to issue the ACPI power command. The source can be found here.
In older distros the reboot command was ...
9
Depending on your distro use the chkconfig or update-rc.d tool to enable/disable system services.
On a redhat/suse/mandrake style system:
sudo chkconfig apache2 off
On Debian:
sudo update-rc.d -f apache2 remove
Checkout their man pages for more info.
9
If you can still access a text mode console, or if you can log in remotely:
You can use ps or other process listing tools and kill to try killing some processes. A few programs will save your work (at least to a recovery file) if they receive a kill -HUP or plain kill. They might not have time to do it if you go straight for rebooting.
Run sudo kill ...
9
It's a bit historical.
halt was used before ACPI (which today will turn off the power for you)*. It would halt the system and then print a message to the effect of "it's ok to power off now". Back then there were physical on/off switches, rather than the combo ACPI controlled power button of modern computers.
poweroff, naturally will halt the system and ...
8
Try the following commands:
Display list of last reboot entries:
last reboot | less
Display list of last shutdown entries:
last -x | less
or more precisely:
last -x | grep shutdown | less
You won't know who did it however. If you want to know who did it, you will need to add a bit of code which means you'll know next time.
I've found this resource ...
7
Which installed package provides /sbin/shutdown on my system?
$ dpkg -S /sbin/shutdown
sysvinit: /sbin/shutdown
Which package in the distribution provides /sbin/shutdown? Install the apt-file package and run apt-file update if necessary, then
$ apt-file search /sbin/shutdown
molly-guard: /usr/sbin/shutdown
sysvinit: /sbin/shutdown
upstart: /sbin/shutdown
...
6
If your system uses PAM, the login denial when /etc/nologin exists is triggered by the pam_nologin module.
You can skip the pam_nologin invocation for users matching certain criteria with pam_succeed_if. For example, if you want to allow users in the adm group to log in on a text console even if /etc/nologin exists, add the following line to ...
6
The shutdown binary will only work for the root user. The typical approach to this is to set up sudo rules to allow the user to execute shutdown as root. Assuming the user doesn't already have full sudo permissions
(the first user on an Ubuntu desktop system does, for example) you might add the following line to /etc/sudoers (using the visudo utility, for ...
6
If you use D-Bus sessions and ConsoleKit (which is a default component of most modern desktop systems, so you may already have it installed), a system poweroff approach that is slightly cleaner than sudo shutdown and that does not require any sort of root privilege is:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" \
...
6
Here's a nice little trick that kind of surprised me (life saver if you freeze a remote system with no iLO (or KVM).
The Magic SysRq key. If it is active on your system, I believe hitting ALT + SysRq + o should turn off your system. This is a hard shutdown (if I recall correctly, don't want to test it right now!) so you can press:
ALT + SysRq + e (nicely ...
5
The two commands do something different, however they can end up calling each other, which is why they seem to do the same thing!
reboot will invoke the kernel to actually trigger a hardware reboot. However, it will only do this if the system is ready for shutdown - all daemons and user processes should be stopped, file systems unmounted, etc. So it checks ...
5
In addition to what Brandon wrote, there's an important distinction between the two programs: shutdown is in /sbin, while reboot is in /usr/bin.
Why does this matter, you ask? I will tell you.
Things under /usr are those that do not have to be available until the system is booted up far enough that the system is minimally functional. Top-level directories ...
5
You're supposed to run shutdown -h, or its alias halt, to turn off the system; on some machines you need shutdown -P or poweroff. In fact, without -h (or -P or -r), shutdown is not supposed to turn the computer off, it's supposed to drop into single user mode (at least with the traditional Linux SysVinit, I don't know how compatible Ubuntu's upstart is).
...
5
I suspect this is somewhat dependant on which version of UNIX/Linux you are using. On Centos (and I expec other modern Linux) halt calls shutdown (providing you're not at runlevel 0 or 6) so your system will be shutdown cleanly. On Solaris 10 halt is more brutal, it just flushes the disk caches and powers off the system - no attempt is made to run any ...
5
If you are fast enough you can issue an init 2 (or whatever runlevel you want) and that will likely stop the shutdown. Anything involving killing the shutdown command will fail as the command runs too quickly
I tried this with the script below and and even it's not fast enough to stop the shutdown
#!/bin/bash
shutdown -h now
shutdown -c "Aborting ...
4
Sounds like a feature of kexec. If you don't like it, try coldreboot (from kexec-tools) or set LOAD_KEXEC=false in /etc/default/kexec (as mentioned here).
You could proably also just remove the packagekexec-tools
4
Very strange for the shutdown to get to that point and not work.
Things to try:
Apply any available BIOS updates to the board. Try also resetting BIOS options to default.
See if there is an updated kernel in your distribution. Might try compiling your own.
I think there's a kernel compiling option that tells the kernel not to overwrite the first ...
4
For Ubuntu Linux we have the solution as:
For after boot, before X is initialized: Ubuntu starts X-Windows from GDM (those using the ubuntu-desktop) or from KDM (those using kubuntu-desktop)
To run a script prior to GDM/KDM, you have to write your own upstart script. For this, you can read Upstart Cookbook.
After user switching: You have to add the ...
4
That would generally depend on your operating system, the type of computer you're using, and how abrupt the reboot was.
Many Unix-like operating systems (including the popular Linux-based ones) keep their logs in /var/log. On some others, /var/adm is the standard location. The specific files stored there depend on the OS, distribution and configuration. ...
4
They're not the same thing, just very closely related. In practice, unless you want to specify a particular time to shutdown or to force an immediate unclean reboot/halt/poweroff, it really doesn't matter whether you run "shutdown -h" or "halt"...or "shutdown -r" vs "reboot". Things weren't so nicely convenient in the past, but this is the way it works now ...
4
The shutdown will gently "close" (SIGTERM) all open applications, giving the opportunity to terminate gracefully. Then, after a time, if the process does not respond, a hard kill (SIGKILL) - not giving time to close files or, more importantly, databases.
A shutdown is an autonomous procedure. It is not expected to respond to user input. So it would not ...
4
You need to use rc.shutdown the shutdown script for the Linux Kernel.
Quoting the OpenBSD man page:
When the system is shut down using the reboot(8) or halt(8) commands,
or
when init(8) is signalled to do so, or when a keyboard-requested halt is
issued (if the architecture supports it), rc(8) is invoked with the
argument ...
4
No system is immune to improper shutdowns.
That's why you have UPS that when connected to a system informs it that the main power is no longer available and the system will start a controlled shutdown. (Assuming that has been configured for it).
Although the previous info warns against power loss nothing stops a user of pressing the power off and shutting ...
4
Sounds like a hardware problem.
Have you added anything to the system? E.g. RAM, new GPU, HDD, PCI cards?
Physical:
Check all cables.
Check mounting of RAM.
Check mounting of all PCI's.
Remount CPU (If nothing else works).
Check powercables, both external and internal.
[Edit]: And as pointed out by @vonbrand
Ensure the cooling etc. and do a cleanup ...
Only top voted, non community-wiki answers of a minimum length are eligible

