ObjectiveFix an Ubuntu system that won't boot properly.
RequirementsAn Ubuntu install with root privileges, and preferably a second computer to create a live CD.
- # - requires given linux command to be executed with root privileges either directly as a root user or by use of
- $ - given linux command to be executed as a regular non-privileged user
IntroductionNo one wants a system that doesn't boot. It's about as bad and frustrating as any technical problem gets, and more often than not, it feels like the system is totally shot. Fear not, though, Ubuntu has a couple of convenient ways to help repair your computer and get things back to normal.
The Easy WayBelieve it or not, there is and easy way. There's a utility that you can run from an Ubuntu live CD/USB that automatically repairs your system. You don't have to worry about the specifics or even diagnose the problem. It automatically runs through with the click of a button. So, that's probably a good first option.
Create Your Live CD/USBIf you don't already have one, create a live medium to work off of. Head over to Ubuntu's download page, and grab the latest desktop image. From there, you can either use a utility like Brasero to write it to a disk, or you can image it to a USB with
dd. If you go with
dd, find the location of your drive, and your command should look something like this:
$ sudo dd if="ubuntu-18.04-desktop-amd64.iso" of=/dev/sdX bs=8MWhen you have your live medium, insert it in your non-booting computer and start it up. Select the medium through your motherboard's boot options. When Ubuntu comes up, select the "Try Ubuntu" option.
Add The PPAIt might seem counter-intuitive, but you can enable a PPA and install software on a live CD. The utility that you need is available through a PPA, so this is the procedure that you'll need to follow in order to use it. Start by enabling the PPA and updating Apt.
Confirm that you want to install the PPA when asked.
$ sudo add-apt-repository ppa:yannubuntu/boot-repair $ sudo apt update
Install Boot-RepairNow, you can install Boot-Repair like you normally would with Apt.
$ sudo apt install boot-repair
Run The Utility
You can now shut down Ubuntu and remove the live medium when you're prompted to do so. Boot back up into your normal Ubuntu system to see if everything worked.
More OptionsIf you think you know what the problem is, you can always try the default Ubuntu way of fixing boot problems. Included with every Ubuntu install is a series of fail-safe options that allow you to more easily recover a non-booting system.
They let you take the reigns a bit more than the Boot-Repair utility, but they also allow you more options to mess up your system. If you're going to go down this road, make sure you have a pretty good idea what you're doing.
Booting Into Boot Recovery
(recovery mode)at the end. Select the recovery entry for the latest kernel.
resume, which will just boot the computer normally. The other options afford you a series of tools that let you manually repair the more common boot issues.
You can repair or reinstall GRUB to remedy and bootloader related issues. These would be any issues where the computer starts up fine, but as soon as it tries to start Ubuntu itself, it hangs or crashes. It might even present as a message saying that a kernel can't be found.
dpkgoption allows you to try to reconfigure or remove broken packages that are preventing the system from booting properly. It automatically searches for upgrades, and tries to detect any possible ways to clean up your system.
Speaking of cleaning, the
cleanoption is a great choice if you need free space or hard drive space is causing boot issues. This one can be kind of tricky, but can save you in a pinch.
fsckis the utility that you're probably already familiar with. It'll help you repair any hard drive issues or corruption that might be impacting your system. Finally, when all else fails, you can drop into a root terminal and try to fix things yourself. Like any other time you log in as root, be careful. It's very easy to make matters worse.
After you thin you have your system sorted out, you can try to boot normally with
Closing ThoughtsWith any luck, these tips helped you save your Ubuntu PC. Remember to be careful when running any kind of repair. There's always the chance of things going wrong or unintended consequences.
Nothing is perfect, and sometimes an install is just broken. If you're looking for a last resort measure to rescue your system, you can always try using a live CD and chrooting into your broken install. As always, there are no guarantees, but it will get you access to make backups and try some other methods for debugging and eventually fixing Ubuntu.