- Make a bootable device of the distribution you are using(debian,kali,ubuntu)
- Open the terminal
- Type
lsblk
to list the various blocks of the hard disk
root@sperixlabs: ~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 526.5G 0 part /
├─sda2 8:2 0 500M 0 part
├─sda3 8:3 0 396.7G 0 part
└─sda4 8:4 0 7.9G 0 part [SWAP]
- Note the name of the root partition on which your linux is installed. In this case it is
sda1
and the main block is sda
.
- Mount the root partition to the
/mnt
directory
root@sperixlabs: ~# mount /dev/sda1 /mnt
- If
/mnt
does not exist create it using the command
root@sperixlabs: ~# mkdir /mnt
- After mounting the root partition in the
/mnt
directory run the following commands
root@sperixlabs: ~# mount --bind /dev/ /mnt/dev/
root@sperixlabs: ~# mount --bind /dev/pts /mnt/dev/pts
root@sperixlabs: ~# mount --bind /proc/ /mnt/proc
root@sperixlabs: ~# mount --bind /sys/ /mnt/sys
chroot
into the /mnt
directory using the command
root@sperixlabs: ~# chroot /mnt
- Afterwards, install the grub to your main block and update the bootloader. In this case the main block is
sda
root@sperixlabs: ~# grub-install /dev/sda
root@sperixlabs: ~# update-grub
- Exit from the terminal and reboot your machine.