Questions tagged [shutdown]

a command to turn off or reboot the system

96
votes
11answers
367k views

How to find out from the logs what caused system shutdown?

E.g. I'm seeing this in /var/log/messages: Mar 01 23:12:34 hostname shutdown: shutting down for system halt Is there a way to find out what caused the shutdown? E.g. was it run from console, or ...
95
votes
5answers
111k views

What is the difference between Halt and Shutdown commands?

What is the difference between the halt and shutdown commands?
95
votes
4answers
275k views

What is the difference between reboot , init 6 and shutdown -r now?

I just want to know difference between in reboot init 6 shutdown -r now and which is the safest and the best?
63
votes
6answers
10k views

Why does reboot and poweroff require root privileges? [duplicate]

To restart or shut off Linux from the terminal, one can use reboot and poweroff, respectively. However, both of these commands require root privileges. Why is this so? What security risk is posed by ...
63
votes
3answers
20k views

What is the difference between these commands for bringing down a Linux server?

Reading "What is the difference between Halt and Shutdown commands?" , I generally have an idea what does the command shutdown does, with or without -h/-r options. The "halt" command performs ...
55
votes
4answers
70k views

How to run a script with systemd right before shutdown?

What do I need to put in the [install] section, so that systemd runs /home/me/so.pl right before shutdown and also before /proc/self/net/dev gets destroyed? [Unit] Description=Log Traffic [Service] ...
51
votes
4answers
83k views

Execute a command before shutdown

I want to execute a simple command just before the computer shuts down (timing is not essential). For startup, I can use /etc/rc.local; is there something similar for shutdown? Note that I would ...
48
votes
7answers
80k views

A stop job is running for Session c2 of user

The following message appears almost every time I shutdown my computer: A stop job is running for Session c2 of user ... (1min 30s) It waits for 1min30s then continues the shutdown process. I follow ...
42
votes
3answers
133k views

How to shutdown Linux at a specific datetime from terminal?

It seems I can shutdown using sudo shutdown by specifying a time or minutes. Is there a way to specify datetime for shutdown?
36
votes
2answers
3k views

How does the power button shut the computer down without root permission?

When I try to shutdown the computer from a command line or terminal I must have root privileges: amy@amy:~$ shutdown now shutdown: Need to be root and amy@amy:~$ halt halt: Need to be root but ...
34
votes
4answers
4k views

Why can't I execute shutdown when the permission is rwxr-xr-x?

I'm in /sbin and I see that shutdown has permissions rwxr-xr-x. Doesn't this mean that anyone can execute it?
30
votes
2answers
4k views

What is the difference between shutdown 18:00 and at 18:00 shutdown?

at 18:00 shutdown now and shutdown 18:00 , are they starting the same service? Do they work the same way?
27
votes
7answers
65k views

Stop program running at startup in Linux

How do I stop a program running at startup in Linux. I want to remove some apps from startup to allow them to be managed by supervisord e.g apache2
25
votes
3answers
2k views

How can I shutdown a RHEL server at 06:45 tomorrow morning?

I just received notification that our site has a power outage tomorrow morning. I am a Windows admin but I have to cover for our Linux admin who's not around until tomorrow evening. I need to ...
24
votes
5answers
21k views

How to shut down the computer after a task has been completed?

I usually start a download before I go to school. Which command should I use to automatically make the necessary saves and turn off the computer after a particular task has been completed? (Say, ...
23
votes
2answers
26k views

How does the system shutdown of a linux kernel work internally?

I have somehow an rough idea of how the userspace and init-system (be it classic init sysV /upstart/ systemd) work at system shutdown. (Essentially there is an order succession of "Stop!", "Please ...
22
votes
3answers
29k views

Is it possible to stop a shutdown command?

Assuming you've just entered the command shutdown -h now (or something equivalent), is there realistically anything you can do (if you're quick enough) to prevent the machine shutting down?
22
votes
3answers
53k views

What exactly is “a stop job”, as in “A stop job is running…”?

After a shutdown command is issued, sometimes one gets a status message like this: A stop job is running for Session 1 of user xy and then the system hangs for awhile, or forever depending on ??? ...
21
votes
3answers
6k views

Graceful shutdown in ArchLinux

I'm trying to get a graceful shutdown/reboot in ArchLinux with GNOME Shell. Now, when I ask for shut-down, it immediately shuts down without giving open programs time to gracefully close / save open ...
20
votes
4answers
7k views

Is there a fastest way to shutdown the system?

Or is shutdown -h now the fastest it can get? I look for some syscall or similar that will allow to skip lots of the stuff done prior to shutdown (in particular to care about the running proccesses). ...
20
votes
3answers
3k views

How to prevent shutdown when an SSH user is logged in?

I'm administrating a networked environment and I had an interesting situation arise yesterday. When a host is required to shutdown by a regular user, it refuses to do so if other users are logged in ...
17
votes
10answers
8k views

How do I shut down a Linux server after running for 60 minutes?

I have a server that it is normally switched off for security reasons. When I want to work on it I switch it on, execute my tasks, and shut it down again. My tasks usually take no more than 15 minutes....
17
votes
3answers
39k views

message at shutdown: watchdog did not stop!

At shutdown I often get the message watchdog did not stop! and then the laptop freezes after few other lines without shutting down. Any idea on how to fix this? Recently it happened very often, ...
16
votes
8answers
9k views

How to read the shut down messages afterwards?

I'm using Lubuntu 11.10. Every time I shut down I can read FAIL in red letters, but I can not read more. So, how to read the log messages and try to solve the problem?
15
votes
2answers
30k views

Is halt the same as “shutdown -H” and poweroff the same as “shutdown -P”?

I haven't found a clear answer to the differences between the two options to the command shutdown. Is halt the same as shutdown -H and poweroff the same as shutdown -P?
15
votes
1answer
3k views

What happens when I press “Shut Down” from the GUI?

I have been banging my head against this for quite a while now. It's related to this question. I would like to find out exactly what happens when I choose to shut down my Linux box from the GUI. This ...
14
votes
4answers
39k views

Poweroff or Reboot as normal User

To run the command poweroff or reboot one needs to be super user. Is there anyway I can run this as a normal user? I just don't want to sudo and enter my password every time I reboot or power off.
13
votes
4answers
9k views

systemd: How to check scheduled time of a delayed shutdown?

I like to use shutdown -h TIME/+DELAY sometimes. However, since the switch to systemd (on Ubuntu), things seem to have changed quite a bit. Apart from the fact that a previous shutdown command no ...
12
votes
3answers
2k views

How to halt a script at a specific time until it is started again by cron?

I have a Raspberry Pi running OSMC (Debian based). I have set a cron job to start a script, sync.sh, at midnight. 0 0 * * * /usr/local/bin sync.sh I need to stop the script at 7am. Currently I am ...
12
votes
3answers
765 views

Why do we need the reboot function in different binaries?

Why do we need the reboot function in different binaries? shutdown -r and reboot Or do they differ in something?
12
votes
3answers
13k views

How to simulate unplugged network cable or down server?

I have simulated network latency with netem and It's great. Now I want to simulate unplugged network cable or when server goes down. I need this to make testing of my application easier and I couldn't ...
12
votes
4answers
2k views

Eject CD on shutdown

OK, so I have a simple problem: I have a live CD, and I want the CD to eject when the computer is rebooted or halted. Executing /usr/bin/eject -m makes the CD eject just fine... trouble is, as you ...
11
votes
4answers
13k views

Shutdown from login prompt in tty

Suppose I boot a Linux machine without GUI. When it displays a tty login prompt, can I shutdown the machine with a keyboard sequence? Of course I could type in my username and password and then sudo ...
11
votes
2answers
9k views

After sending shutdown command, ssh session doesn't terminate

Whenever I send the command to turn off or restart my Debian servers, my shell is left hanging and unresponsive (can't type any commands). Performing the same action in Ubuntu results in the session ...
11
votes
3answers
10k views

BunsenLabs (Debian derrivative) won't shut down (Failed to start poweroff.target: Transaction is destructive)

I stumbled upon a weird behaviour of my BunsenLabs GNU/Linux (which is based on Debian). Sometimes I cannot turn off the OS. I doesn't matter whether I use sudo poweroff or the GUI approach. This is ...
10
votes
6answers
1k views

shutdown at specific date

I know that you can schedule a shutdown for a specific time via shutdown -h 21:45 and that you shouldn't use crontabs for such things because of their repetitive nature. How can I schedule a shutdown ...
10
votes
4answers
3k views

How do I shutdown, reboot and logout the system from the command-line?

I would like to do that using the command-line, because sometimes my computer freezes and I need to force a shutdown (I know it's not good to the hardware). And: What is the difference between Halt ...
10
votes
5answers
7k views

On Linux, is there an rc.local equivalent for shutdown?

I've got a few commands that I run in rc.local so they are run last in the startup sequence. I would like to know if there is a similar facility for undoing the results of those commands at shutdown, ...
10
votes
8answers
25k views

Linux mint 18 hangs at shutdown

I am being troubled by the infamous shutdown hang/freeze error. Whenever I shutdown mint, only the first dot on the splash screen turns green and then it kind of freezes. I also had this prob on ...
10
votes
1answer
23k views

“A stop job is running…” on shutdown [duplicate]

Almost every time when I'm shutting down or rebooting the system I get the following message before the system actually shuts down: A stop job is running for Session 1 of user xy It waits for 1:...
9
votes
1answer
923 views

Don't let users reboot while root's logged in

On my system users can reboot and shut down the system. From time to time I need to update software (or do anything else) and I don't want users to reboot/shutdown the system until I've finished. Is ...
9
votes
3answers
4k views

How can I set that only root + a given user can shut down my pc?

If I'm using Ubuntu 11.04, how can I configure it such that that only two users can shut down/suspend/hibernate my PC: the root user and one regular user?
9
votes
1answer
2k views

Does `shutdown -P now` safely unmount a USB drive mounted to `/dev/sdb1`?

I typically unmount my USB drive (using umount) from /dev/sdb1 before I shutdown my computer but if I shut it down using shutdown -P now and then restart it, the drive is no longer mounted. Is this ...
8
votes
5answers
9k views

Can I allow a non-root user to log in when /etc/nologin exists?

Suppose a non-root user with sudo privileges executes a delayed shutdown (shutdown +10 or whatever) and logs out. Then, before the shutdown occurs, he wants to log back in and cancel the shutdown. The ...
8
votes
6answers
12k views

How to disable shutdown so that an important process cannot be interrupted?

What is the simplest way to disable or temporarily suspend reboot/shutdown when an important process is running? The process takes too long to finish and cannot be paused/resumed so I like to avoid ...
8
votes
6answers
36k views

Find last shutdown time

This is the command I am using: last -x|grep shutdown | head -1 but it's giving me the duration with +2 hours: shutdown system down 3.14-1-amd64 Mon Jul 21 08:43 - 22:19 (13:36) the last ...
8
votes
1answer
6k views

Why does halt not turn the machine off? [duplicate]

shutdown now kills everything and then powers down the machine. halt kills everything and then... there is no step 2. It will sit, running but not doing anything, until people stop arguing over ...
8
votes
1answer
4k views

How to find out what turned off the computer?

Yesterday, after getting back home I found out my computer is turned off. Since it appeared it was cold shutdown (a lot of disk repairs were shown during boot up) I am wondering what was the cause. ...
8
votes
1answer
1k views

How to shutdown with consolekit without sysvinit (but with systemd)

I have systemd (and no sysvinit) installed on a Arch Linux box. However, I cannot shutdown/reboot with consolekit (dbus interface). # systemctl {shutdown,reboot} work just fine, so I guess it's ...
8
votes
1answer
495 views

Battery drains while powered off after upgrade to kernel 4.13

After upgrading to kernel 4.13, the battery of my laptop started to drain while powered off (about 30% in one day). This didn't happen if I booted the laptop from kernel 4.12 or Windows 8.1, so the ...