7

I had Windows 8.1 and Kali Linux installed in an extended partition. For some reason, I only formatted the partition where Windows was installed and re-installed. Now it only boot into Windows and doesn't show grub.

I'm using a live USB and tried to reinstall grub:

grub-install --boot-directory=/mnt/boot /dev/sda

and getting the error:

grub-install :command not found
  • 1
    try sudo grub-install --boot-directory=/mnt/boot /dev/sda grub-install is in your /usr/sbin/ which is not in normal user's path. – Mohammad Etemaddar Feb 5 '15 at 7:00
  • 1
    I got grub-install: command not found because in CentOS 7, the command is grub2-install – Arnon Weinberg Mar 13 '17 at 19:55
4

To add to the answer provided by user @kirill-a and flesh it out a bit more:

Here is what I did recently to restore the GRUB boot loader on a Windows 8 and Debian 8 dual-boot machine, after a Windows 8 reinstallation cleared the previous GRUB boot loader entry from the beginning of the disk.

REPAIR GRUB2: Live USB/CD 'chroot' method on linux:

These instructions apply generally to an unencrypted, non-LVM disk on Debian-based distros, minor changes are needed in directory names and utilities used under RHEL/SUSE-based and possibly Arch-based distros.

Start with a bootable Live USB or CD of the distro of your choice.

  1. Use lsblk to determine the kernel name descriptor (i.e. /dev/xxyN) of the block device with a missing or damaged GRUB boot loader.

All the following actions are to be done as root (use su or sudo).

  1. Create a temporary mount point for the installed Linux:

    mkdir -p /mnt/linux
    

    (the -p option creates the parent directory /mnt if it doesn't already exist)

  2. Using /dev/xxyN from previous lsblk command:

    mount /dev/xxyN /mnt/linux
    
  3. The following command is only necessary if you have a separate /boot partition; /dev/xxyN here is representing the kernel name descriptor of your /boot partition.

    mount /dev/xxyN /mnt/linux/boot
    
  4. Then:

    mount -t proc none /mnt/linux/proc
    mount -t sysfs sys /mnt/linux/sys
    mount -o bind /dev /mnt/linux/dev
    mount -t devpts pts /mnt/linux/dev/pts
    chroot /mnt/linux /bin/bash
    grep -v rootfs /proc/mounts > /etc/mtab
    grub-install /dev/xxy
    

    (Here, dev/xxy = the device name and number on which to install the GRUB boot loader , e.g., /dev/sda, not including the root partition number as in /dev/sda1)

  5. If you wanted to make any other changes/customizations to GRUB, now is the time to edit the /etc/default/grub file, and save.

    grub-mkconfig -o /boot/grub/grub.cfg
    
  6. Reboot and verify.

Note: There are several additional steps to this procedure if your GRUB2 boot loader resides on a linux system with an LVM LV root and/or an encrypted root volume. Feel free to message me here, I have these additional instructions written down and have applied them successfully several times to an LVM LV on an ssd which contains a root volume encrypted with the kernel dm-crypt module.

1

You need to chroot to your installed system and reinstall grub from there:

mount /dev/sda(number of partition with kali) /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt bash
grub-install --boot-directory=/mnt/boot /dev/sda
update-grub
exit
reboot 
  • update-grub Generating grub.cfg ... cat: /boot/grub/video.lst: No such file or directory No volume groups found Found Windows 8 (loader) on /dev/sda1 done – sonubreeze Feb 5 '15 at 8:21
  • it's not working . – sonubreeze Feb 5 '15 at 9:05
  • try to reinstall grub or run the following command echo vbe | sudo tee /boot/grub/video.lst and update again. – kirill-a Feb 5 '15 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.