Ubuntu - How to repair Grub

From Linux - Help
Jump to navigation Jump to search


Ubuntu.png

Download Ubuntu

You can download the latest version of Ubuntu here.

Create a bootable USB stick

After you download the ISO, you can use dd command to prepare your usb:

   $ sudo dd if=ubuntu-18.04.1-desktop-amd64.iso of=/dev/sdx

> sdx should be replaced by your usb (see dmesg)

Repair GRUB

After you boot in the Ubuntu Live cd and open a terminal:

 $ sudo su
 # cryptsetup luksOpen /dev/nvme0n1p3 root
 password:
 # mkdir /mnt/root
 # mount /dev/mapper/ubuntu--vg-root /mnt/root
 # mount /dev/mapper/ubuntu--vg-home /mnt/root/home
 # mount --bind /dev /mnt/root/dev
 # mount --bind /proc /mnt/root/proc
 # mount --bind /sys /mnt/root/sys
 # chroot /mnt/root
 # source /etc/profile
 # export PS1="(chroot) ${PS1}"
 (chroot) # mount -a
 (chroot) # grub-install /dev/nvme0n1p1
 (chroot) # update-grub 
 (chroot) # exit
 # reboot

Now you should be able to boot on your Ubuntu as expected.