• Root/
  • Linux/
  • Repairing BOOT
  • Sometimes when dual-booting Windows or while tinkering/updating Linux bootloader gets broken. Luckily repairing it does not requires reinstalling Linux. There are number of methods of repairing it:

    Guided GRUB bootloader repair

    This method requires little technical abilities; it's good starting point.

    1. Boot to live environment created from Ubuntu Desktop 24.04
    2. Select Try Ubuntu
    3. Open terminal window
    4. Add PPA for boot-repair; it's unofficial user repository designed for Ubuntu specifically by yannubuntu: sudo add-apt-repository ppa:yannubuntu/boot-repair
    5. Update APT cache. This does not install or update any package: sudo apt update
    6. Install boot-repair package sudo apt install -y boot-repair
    7. Start boot-repair boot-repair
    8. Follow on-screen instructions. You might be asked to execute some commands in terminal. boot-repair will inform you when it ends, and whether it assumes GRUB was repaired.

    Manual GRUB bootloader repair

    This method requires that you understand layout of your filesystem. Mistake will result in loss of data.

    1. Boot to live environment created from Ubuntu Server 24.04
    2. Open TTY2 (by pressing Ctrl+Alt+F2)
    3. Start tmux session
    4. Confirm layout and names of disk devices lsblk
    5. Only if root or boot is on LVM: scan for LVM partitions sudo pvscan
    6. Only if root or boot is on LVM: activate LVM partition sudo vgchange -ay /dev/ubuntu-vg/ubuntu-lv
    7. Create temporary root mount point (if you change this or any further path correct them yourself) mkdir /root/root/
    8. Mount root device to temporary root mount point sudo mount /dev/ubuntu-vg/ubuntu-lv
    9. Only if boot is on different device: create temporary boot mount point within mounted root device sudo mkdir /root/root/bootpart
    10. Only if boot is on different device: mount boot device to temporary boot mount point within mounted root device sudo mount /dev/sda2 /root/root/bootpart
    11. Mount necessary special devices within temporary root mount point sudo mount --bind /dev /root/root/dev sudo mount --bind /sys /root/root/sys sudo mount --bind /proc /root/root/proc
    12. Chroot into temporary root mount point sudo chroot /root/root
    13. Confirm layout and names of disk devices within chroot lsblk
    14. Install GRUB sudo grub-install --boot-directory=/bootpart /dev/sda
    15. Update GRUB sudo update-grub
    16. Exit and reboot

    Last update: 2024-05-20