+3 votes
73 views
in Linux by (242k points)
reopened
Ubuntu: Repair GRUB

1 Answer

+4 votes
by (1.6m points)
 
Best answer

Repairing GRUB - Ubuntu is still starting
Repairing GRUB - Ubuntu won't start anymore

The GRUB boot loader for Ubuntu can be damaged by various factors. We'll show you how to fix GRUB..

image image

With the aid of GRUB (Grand Unified Bootloader), the operating system can be started from a hard drive. But sometimes GRUB gets corrupted. This can happen through apps or during the actual Ubuntu installation. In most cases, it can be repaired quickly.

Repairing GRUB - Ubuntu is still starting

First of all, an update from GRUB can help. The GRUB configuration file is recreated in the process. You can achieve this with the following terminal command, which you then have to confirm with your Ubuntu password.

  • sudo update-grub

If that doesn't help, you can reinstall the Ubuntu packages. Before doing this, you should sudo apt-get update read in the package lists again using " " in order to be up to date. Often the problem can be solved with the following command under an EFI installation:

  • sudo apt-get --reinstall install grub-common grub-efi-amd64 os-prober

Enter the following command for a BIOS installation of GRUB:

  • sudo apt-get --reinstall install grub-common grub-pc os-prober

You can also try to reinstall the boot entry using

sudo grub-install or without UEFI sudo grub-install /dev/sdX (where sdX stands for the data carrier, e.g. sda )

Repairing GRUB - Ubuntu won't start anymore

This is where things get a little more complicated. In this case you need an external installation medium for the repair. This can be a disc or a USB stick with Ubuntu installed on it. Here we are going to show you how to create a Linux boot stick..

Restart your computer - if necessary with the reset button. Then boot Ubuntu from your backup media. If necessary, you have to set " German " as the language and select "Try Ubuntu ". There are two possible solutions:

Assign write rights

1st step:

image

The first thing you need to find out is which partition Ubuntu is installed on. To do this, enter the following command on the live desktop in the terminal: " fdisk -l ". In our example, Linux is /dev/sda5 installed on the partition .

2nd step:

Now enter the following command: " sudo mount /dev/sdXY /mnt " - sdXY is the root partition. For us it would be the partition sda5 . Attention: If you use a separate boot partition on your system, this must also be mounted beforehand with: " sudo mount /dev/sdXY /mnt/boot ". If you use UEFI boot on your computer (eg with dual boot), the related should esp also be attached with: " sudo mount /dev/sdXY /mnt/boot/efi "..

3rd step:

Now assign write permissions for the drive. A possible problem can be that these write permissions are missing and Ubuntu cannot start up correctly as a result. To do this, enter the following commands one after the other in the terminal:

  • sudo mount -o bind /dev /mnt/dev
  • sudo mount -o bind /sys /mnt/sys
  • sudo mount -t proc /proc /mnt/proc
  • sudo chroot /mnt /bin/bash
  • sudo cp /proc/mounts /mnt/etc/mtab

Now you can either try the method of repairing GRUB - Ubuntu is still starting or repairing Ubuntu using a repair program . After doing this, your system should start up again without any problems.

Repairing Ubuntu through a repair program

  1. Call up the terminal and enter the following lines - each with [Enter] to confirm:
  • sudo add-apt-repository ppa:yannubuntu/boot-repair
  • sudo apt-get update
  • sudo apt-get install -y boot-repair
  • boot-repair

2. The repair program has now opened. Select the setting " Recommended Repair ". The program now carries out its repair measures. After that, GRUB should boot Ubuntu correctly again.


...