1. Home
  2. Linux

How to shut down a Linux PC that won’t turn off

Have you ever attempted to shut down a Linux system, only to find that it refuses to power off? We’ve all been there! Even the greatest open source technology has problems sometimes! If you’re sick of having to hit the power switch to shut down an unresponsive Linux PC, or, maybe you can’t physically turn it off as it is a remote machine, this guide is for you! Here’s how to shut down a Linux PC that won’t turn off!

Note: when forcing a Linux system to power off, data loss can happen. Always make sure that your data is backed up regularly, to prevent loss. For help on ways, you can back up your files on Linux, click here!

Method 1 – poweroff

The first way that a Linux system can be shut down is by making use of the poweroff command. This command instantly shuts down your Linux system with no warning. To make use of this command, you must access an emergency terminal window in TTY mode.

To access the TTY mode on your Linux system, press Ctrl + Alt + F2. Once you’ve opened up the TTY emergency console, find the login screen and type “root” as the user. Alternatively, use a username, if the root account is disabled.

If you’ve logged in with the root account, type in poweroff into the command-line console to instantly shut everything off.

poweroff

Or, do sudo -s to gain root access with a normal user, then do:

poweroff

Can’t access TTY, as you’re using a remote connection? Gain root on your SSH remote console with:

su -

Or:

sudo -s

Then, with root access, type in the poweroff command to instantly shut the remote machine down.

poweroff

Method 2 – reboot

The reboot method is another way to take control of a Linux system, and force it to reboot. You may want to go with this method, as opposed to poweroff, as sometimes the poweroff command has issues working.

To make use of the reboot command, you need to have access to the TTY console. To access it, press Ctrl + Alt + F2 on the keyboard. Then, when the command-line console appears, enter “root” into the userbox to log in with root access. Or, if you disabled root access, log in with a traditional user account.

With the root account logged in, make use of the reboot command to restart the Linux system, effectively forcing it to turn off, and back on again.

reboot

The reboot command also has the ability to power off a system entirely, with the help of a command-line switch. This switch, known as “f” will to tell the reboot command to shut off the Linux system entirely, rather than restart. To use it, enter the command below.

reboot -f

Using a traditional user account, rather than the root user? Do:

sudo reboot

Or shutdown with:

sudo reboot -f

Those not able to use TTY mode should execute the following commands into a terminal session. Be sure to use “-f” if you want to make the reboot command force a shutdown.

Root:

su -
reboot

Or

sudo reboot

Method 3 – systemctl poweroff/reboot

The Systemd init system is built into most Linux operating systems these days. One of the most significant benefits to using the Systemd init system is that it has a lot of uses that are easy to understand, as the command-line syntax is simplified.

If you’re trying to shut down a Linux PC, and you can’t make use of the “poweroff” or “reboot” commands, using systemctl poweroff is just as good, as it tells the Systemd init system (the tool that helps your Linux system turn on and off and do lots of other stuff) to shut everything down.

Like all other commands in this tutorial, the best way to force a system to shut off, especially if it’s frozen, or unresponsive is to gain access to the TTY emergency console by pressing Ctrl + Alt + F2.

Once the TTY emergency console is up on the screen, enter “root” into the userbox to log into the root account and gain root command-line access. Or, log in with a traditional user if you can’t use the root account. From there, run the systemctl poweroff command to power everything off instantly.

systemctl poweroff

Or, if you’re using a traditional user, do:

sudo systemctl poweroff

Not able to use TTY mode? Enter the following commands in an SSH terminal.

su- 

systemctl poweroff

Reboot

The Systemd poweroff command forces everything to shut down, but if that doesn’t work, consider trying the systemctl reboot command to force the machine to restart.

systemctl reboot

Or, for a traditional user, make use of the sudo command.

sudo systemctl reboot

Lastly, if you’re not able to access TTY mode to reboot, try running the following command below.

su - 

systemctl reboot

Leave a comment