4 Easy Ways to Get Out of a Ubuntu Crash

Recover From Ubuntu Crash

There isn’t just one way to get out of a crash on Ubuntu or any other Linux system. The circumstances around a crash are always different. That said, there are a couple of tried and true methods that you can use depending on the severity of the issue.

1. Kill the X Server

Most “crashes” on Ubuntu are caused by an unresponsive X Server. If you’re not familiar, the X Server is the service that manages the Linux graphical environment. It’s a large complicated piece of software, and it tends to be the first thing to break down when something goes wrong.

Ubuntu Console

Since X is just a service like any other running on the system, you should be able to stop and restart it. In order to do that, you’re going to need to get to a different console.

There’s a fairly simple way to do that – press Ctrl + Alt + F3. On a Ubuntu system running GNOME, that will get you to an unused console. It should work with other desktop environments, too. If it doesn’t, try the different F keys. If absolutely nothing happens, try pressing Alt + SysRq + R first. In the event that none of that works, move on to a different method.

Once you’re in the console, you can use it like you would any other terminal. Sign in and try to restart the X server.

If you’re not using GNOME, replace gdm3 with “sddm” for KDE or “lightdm” for just about anything else.

Ubuntu Find Process

That should restart X, but if it doesn’t, you can try looking up the process and killing it.

In case that doesn’t work, try restarting the system.

2. SSH In

This is another solution for an unresponsive X server. Sometimes accessing the console is too much of a pain, or it’s simply not working. In that case you might still be able to get into the system over your network with SSH. If your Ubuntu install isn’t running SSH, it’s simple enough to install.

SSH Into Ubuntu

You can jump onto another computer and use SSH to access Ubuntu. Use your username and the IP address of your Ubuntu machine.

Ubuntu Restart GDM

Once you’re in, you can use the terminal like you normally would. Again, you can try to restart X.

If that doesn’t work, try killing the process or restarting the machine.

3. Alt + SysRq + REISUB

It’s not always the X server that locks up a Linux system. It could be a genuine crash of the entire system. Thankfully, the Linux kernel has built-in tools to allow you low-level control of the system in the event everything else goes wrong. These commands are accessible by pressing the combination of Alt and SysRq on your keyboard. That combination of keys tells the Linux kernel to stop listening to just about everything else and pay attention to the user’s input.

To completely bypass the crash and reboot the system, press Alt + SysRq, then enter the following keys in order REISUB . (This is the opposite of the word “BUSIER.”) That combination of keys will steal keyboard control away from X, terminate all processes running on the machine, sync up the data on your hard drives, unmount the drives, and reboot the system. Essentially, it manually simulates the shutdown process.

When your system boots up again, everything should be normal.

4. Chroot from Live CD

What happens if it’s not normal? What if something really bad happened, and the system broke and won’t boot? There’s something that you can try in that situation, too. You’ll need a Ubuntu live CD (it can be a USB), so if you don’t already have one, it’s a good idea to have one on hand anyway.

Boot your computer into the live CD. Then, from within the live CD, you’ll need to create a few directories to work from.

Mount your computer’s partitions in those directories. Check your actual partition labels.

Mount a couple of system directories in the recovery directory structure to make sure everything works properly.

Ubuntu Chroot Recovery

Finally, use chroot to change your root directory to your crashed Ubuntu system’s root. This will allow you to actually use the crashed system.

Now that you’re in the system, you can try to debug it and find exactly what’s broken. Seeing as you couldn’t boot, the GRUB bootloader would be a good place to start looking. If you have a broken upgrade, you can also run Apt from here, and it will upgrade your system or repair your broken upgrade.

Again, there isn’t going to be one universal solution from here, but at least you can access your system to figure it out.

In the rare event that your system actually is broken beyond repair, use the live CD to back up your files from your /home directory to an external or networked hard drive. That said, that method or one of the others should be able to get you back to a functional Ubuntu system.

This article was first published in September 2008 and was updated in May 2018.

3 comments

  1. If my computer doesn’t crash from all the JS scripts on this page, may I suggest not using Ubuntu? MX Linux is perfect; it’s the “Linux Mint” of Debian but with custom made applications to make administration super easy. When I started out on Ubuntu, I would have given up if I had to do any of this and now that I don’t and know what I’m doing, I’ve never had to do any of this.

  2. One more thing that may be useful to try, provided that you can at least reboot the computer: try rebooting your Linux system with an older kernel that is still installed. Press when GRUB gets control, and select one of the older kernels.

    I’m seeing quite a few (mostly older) computers either being unable to boot newer kernels or getting unstable while running them these days; seems to have started when Meltdown and Spectre patches began to occur.

  3. Finally something interesting, it doesn’t talk about stylish ubuntu wallpapers and other “cool” stuff.
    Thanks for this clear tutorial, I particularly enjoyed: “…(This is the opposite of the word “BUSIER.”)…”
    You do know linux and how to TEACH IT.

Comments are closed.