Skip to main content

Reinstall Grub after installing windows

  1. Boot from a Live Linux USB drive. You can use any Live Linux distribution for this, such as Ubuntu, Fedora, or Debian.
  2. Once you have booted into the Live Linux environment, open a terminal. For example; Ctrl+Alt+T
  3. Type the following command to list all the partitions on your system:
    sudo fdisk -l
  4. Identify the partition where your Linux operating system is installed. Note the partition name, for example, /dev/sda1>/code>.
  5. Mount the partition with the Linux operating system:
    sudo mount /dev/sdx1 /mnt

    Replace /dev/sdx1 with the actual partition name.

  6. Mount other necessary partitions:
    sudo mount --bind /dev /mnt/dev
    sudo mount --bind /proc /mnt/proc
    sudo mount --bind /sys /mnt/sys
  7. Chroot into the mounted Linux partition:
    sudo chroot /mnt
  8. Install the Grub bootloader:
    sudo grub-install /dev/sdx

    Again, replacing /dev/sdx with the actual device name of your hard drive. If you have more than one hard drive, make sure to select the one where the Linux operating system is installed.

  9. Update the Grub configuration:
    sudo update-grub
  10. Exit the chroot environment:
    exit
  11. Unmount the partitions:
    sudo umount /mnt/dev
    sudo umount /mnt/proc
    sudo umount /mnt/sys
    sudo umount /mnt
  12. Reboot your computer from the terminal.
    sudo reboot

 

My System

 sudo fdisk -l 
[sudo] password for csr:  
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors 
Disk model: Samsung SSD 850  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 18F7B150-AD7B-4AC1-9864-0391968D7FE3

Device         Start       End   Sectors   Size Type 
/dev/sda1       4096   1232895   1228800   600M EFI System
/dev/sda2    1232896   3330047   2097152     1G Linux filesystem
/dev/sda3    3330048 904714755 901384708 429.8G Linux filesystem
/dev/sda4  904714756 976768064  72053309  34.4G Linux swap


Disk /dev/nvme0n1: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors 
Disk model: addlink M.2 PCIE G3x4 NVMe               
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 753AD7B1-9E5B-4DC8-A1BF-4966F9CA2801

Device              Start        End    Sectors   Size Type 
/dev/nvme0n1p1       2048     206847     204800   100M EFI System
/dev/nvme0n1p2     206848     239615      32768    16M Microsoft reserved
/dev/nvme0n1p3     239616 1999320142 1999080527 953.2G Microsoft basic data
/dev/nvme0n1p4 1999321088 2000406527    1085440   530M Windows recovery environment


Disk /dev/zram0: 8 GiB, 8589934592 bytes, 2097152 sectors 
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 115.69 GiB, 124218507264 bytes, 242614272 sectors 
Disk model: Ultra Fit        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0d320863

Device     Boot     Start       End   Sectors   Size Id Type 
/dev/sdb1  *         2048 242548735 242546688 115.7G  7 HPFS/NTFS/exFAT
/dev/sdb2       242548736 242614271     65536    32M ef EFI (FAT-12/16/32)

mount | grep /dev/sda
/dev/sda3 on / type btrfs (rw,relatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=400,subvol=/@)
/dev/sda3 on /home type btrfs (rw,relatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=399,subvol=/@home)
/dev/sda2 on /boot type ext4 (rw,noatime)
/dev/sda1 on /boot/efi type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)