PDA

View Full Version : How To Repair Kali Linux Grub With Kali Linux Live Cd: Dual Boot With Windows 7



kaboyish
2014-03-02, 10:06
Hello. I am sure there are plenty of newbies around when it comes to linux, myself included. This is a guide of how to repair grub in the event your windows 7 removed the grub during the installation.
First thing that you'll need to do is to boot from a kali linux live cd. After that, go to gparted so that you can get to see where kali was installed: usually it's in the file system that ends with ext4, depending with the file system you used during the installation. In my case, the kali linux system was in sda3, but it varies with different systems.
From there, you'll have to use the terminal for the following commands:


mount /dev/sda3 /mnt
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub-install /dev/sda
update-grub
exit
umount /mnt/dev/pts
umount /mnt/dev
umount /mnt/proc
umount /mnt/sys
umount /mnt

This will restore the old kali linux boot loader, however, you will have to boot into kali once the live cd is out, so as to add windows into the boot loader. Once booted, go to the terminal and do the following:



os-prober
update-grub

... and thats it. hope this helps. I think this will also work with windows xp,vista, and 8, but i haven't yet tested on those systems, so i can't confirm.

kian1991
2014-07-10, 19:04
Hey, just registered here to THANK YOU! you saved me alot of time <3

Cheers

kaboyish
2014-07-13, 08:01
Hey, just registered here to THANK YOU! you saved me alot of time <3


no problem

junaidkhan73
2014-10-07, 03:10
no problem
sigh up here to say thankss u saved my life :D :D:mad:

kaboyish
2014-10-07, 09:42
you are welcome
sigh up here to say thankss u saved my life :D :D:mad:

hdcase
2014-10-22, 08:19
Tried this but there was no GRUB after the restart. Checked gparted again and saw that 'boot' is on /dev/sda2. Should I grub-install there, instead?

Update:
Boot-repair fixed the problem for me.

kaboyish
2014-11-15, 15:01
Sorry for the delay. I was a bit held up. Glad boot-repair helped


Tried this but there was no GRUB after the restart. Checked gparted again and saw that 'boot' is on /dev/sda2. Should I grub-install there, instead?

Update:
Boot-repair fixed the problem for me.

sissona
2015-03-27, 23:39
:cool:
Repair Kali Boot after installing a new OS (ex: Windows)

hello guys thanks for instructing through the boot-process repair, I wasn't unable to repair my boot for a long-time, and because I have a kali using my USB for boot, it doesn't come with grub, so to fix the boot process it should be like:
apt-get install grub
mount /dev/sda3 /mnt
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub-install /dev/sda
update-grub

and now reboot, that's it,
Thanks again.
P.S is there a way without using (apt-get install grub)?

BIOS8105
2015-04-01, 16:04
Hello. I am sure there are plenty of newbies around when it comes to linux, myself included. This is a guide of how to repair grub in the event your windows 7 removed the grub during the installation.
First thing that you'll need to do is to boot from a kali linux live cd. After that, go to gparted so that you can get to see where kali was installed: usually it's in the file system that ends with ext4, depending with the file system you used during the installation. In my case, the kali linux system was in sda3, but it varies with different systems.
From there, you'll have to use the terminal for the following commands:


mount /dev/sda3 /mnt
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub-install /dev/sda
update-grub
exit
umount /mnt/dev/pts
umount /mnt/dev
umount /mnt/proc
umount /mnt/sys
umount /mnt

This will restore the old kali linux boot loader, however, you will have to boot into kali once the live cd is out, so as to add windows into the boot loader. Once booted, go to the terminal and do the following:



os-prober
update-grub

... and thats it. hope this helps. I think this will also work with windows xp,vista, and 8, but i haven't yet tested on those systems, so i can't confirm.

hello , you should use http://sourceforge.net/projects/boot-repair-cd/ ...

kofkof
2015-05-24, 22:52
Good info so far. I dealt with this a while back --> not fun.

I'm about to try to install Kali via usb. I have Windows 7 and Ubundu on 2 separate partitions. Then, I have a 3rd partition for recovery. Windows wants to make me create a Logical Partition since I'm capped at 3. I would MUCH rather install Kali over top of Ubuntu and just have Windows and Kali. Needless to say, I dont want to run into losing my grub again. If I install Kali over Ubuntu - will it install grub in the same place and keep everything tidy? I would assume it would never be that easy..

You guys sound like you know what youre talking about when it comes to this... Just curious if you can tell me anything to keep an eye out for.

mtaiuit
2015-06-15, 16:24
/usr/sbin/grub-setup: warn: This GPT partition label has no BIOS Boot Partition; embedding won't be possible!.
/usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: will not proceed with blocklists.
???????????????????????????

kalinopae
2015-06-20, 11:57
After grub-install I get command not found and after apt-get install grub I get
E: unable to lokate package grub.

How to fix that ?

ARPcPro
2016-03-10, 16:40
Thank you for this kaboyish. After cloning the harddisk with 'mini partition wizard' to a larger hard drive, I had no grub menu. And your procedure worked just fine. In fact after "grub-install /dev/sda and update-grub" I didn't do anything else. These commands detected "Windows 8 (loader)" and added it automatically to the boot menu.

21342342
2016-03-10, 20:11
Thank you so so soooo much i had this problem for so long and spent way to long trying to fix it, so i made an account just to thank you!

K47!
2016-04-02, 16:19
Thanks for the info! This worked w/o the need to add Windows in the boot loader, it automatically put Win 10 into the Kali boot choice:

Code:
mount /dev/sda3 /mnt
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub-install /dev/sda
update-grub
exit
umount /mnt/dev/pts
umount /mnt/dev
umount /mnt/proc
umount /mnt/sys
umount /mnt


My only problem is I have to boot twice on my Presario laptop. I get the "BootDevice Not Found" ... "Hard Disk - (3F0)" ... , then a Ctrl+Alt+Del will start a normal boot to Kali boot menu. I cannot update BIOS and legacy mode is not CMOS available. <<< Any help here, thanks.
I'll post any update from my end if I can resolve this issue.

varadero129
2016-09-29, 09:13
I had the same problem. I'm using a laptop with a built-in HDD and added an mSATA SSD. On the SSD there was a Windows 10 with GPT installation. I had 3 primary partitions created by windows installer, and shrank the free space to leave some for the kali installation. At first grub was unable to install, and after reboot only win10 started. I deleted the kali partitions with diskmgmt.msc, changed the SSD from GPT to MBR format with AOMEI Partition Assistant Pro, rebooted into BIOS, set boot option to Legacy only, and then repeated the kali installation. At the end of the install it asked if it may install grub into the MBR, and let me choose the drive to which I intend to install it. I chose my SSD, and voila, it works!

pedropt
2016-10-09, 08:44
You can do all that or just burn a cd with this image :
https://sourceforge.net/projects/boot-repair-cd/

witch will fix the grub error .

Wickedspyder
2017-01-09, 03:17
I recently installed a new SSD in my computer and started with a fresh install of Kali Linux. I then partitioned the drive with GParted in order to add Windows 10. After doing so, my computer would only boot to Windows 10 when I booted from the SSD.

I found this solution tonight and tried it using the Live boot version of Kali Linux on a USB. Now on a default boot, my computer goes to the Grub menu so that I can choose Windows 10 or Kali. I registered tonight in order to update that it works for Windows 10. Thank you for the tutorial.

_defalt
2017-01-15, 11:14
What is the purpose of the first command sudo mount /dev/sda* /mnt? Is it where grub will be installed? Why do we need to mount kali-linux partition to repair grub?

_defalt
2017-01-28, 17:18
In UEFI, you have to mount EFI partition also as sudo mount /dev/sda1 /mnt/boot/efi. /dev/sda1 is your EFI partition where grub will be installed.

Ethan Baskys
2017-04-14, 08:14
PLEASE HELP!!!!!!

When I got to the Grub-install /dev/sda, it said
/bin/sh: 1: grub-install: not found

ohhellno
2017-04-15, 11:13
thanks dude youre a freaking live saver.

salman.ali.geek
2017-04-16, 19:29
This will not work with encrypted disk.

Gate Bill
2017-06-04, 07:14
I REALLY THANKS FOR YOUR HELP
BEST WISH FOR YOU:o
I just registered here to say THANK YOU

_defalt
2017-06-04, 10:35
I REALLY THANKS FOR YOUR HELP
BEST WISH FOR YOU:o
I just registered here to say THANK YOU


What exactly was your problem?

granny
2017-09-22, 14:34
Hello. I am sure there are plenty of newbies around when it comes to linux, myself included. This is a guide of how to repair grub in the event your windows 7 removed the grub during the installation.
First thing that you'll need to do is to boot from a kali linux live cd. After that, go to gparted so that you can get to see where kali was installed: usually it's in the file system that ends with ext4, depending with the file system you used during the installation. In my case, the kali linux system was in sda3, but it varies with different systems.
[...................]
[...................]
[...................]
[...................]
This will restore the old kali linux boot loader, however, you will have to boot into kali once the live cd is out, so as to add windows into the boot loader. Once booted, go to the terminal and do the following:

... and thats it. hope this helps. I think this will also work with windows xp,vista, and 8, but i haven't yet tested on those systems, so i can't confirm.

Thank you very much. I registered just so i can post this. You both helped and inspired to understand how the commands actually work :D

Itachi Uchiha
2017-09-29, 19:37
This completely works....... just remember that in UEFI you need to mount the EFI before changing to chroot directory. i.e if you get an error like "grub-install:error: cannot find EFI directory."

Add the below command before the chroot command

sudo mount /dev/sda1 /mnt/boot/efi

Provided that your EFI partition is /dev/sda1

green gouda
2018-03-26, 06:10
apt-get install grub
mount /dev/sda3 /mnt
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub-install /dev/sda
update-grub

and now reboot, that's it,
Thanks again.

Asem_Abuelhija
2018-08-13, 11:49
Thank you.. this thread helped me through my problem..
But I stuck upon some other difficulties..
First the apt-get command was kind of expired when I tried to excute it from the live usb kali..
So to solve that i had to type in this command:

wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add

And the I couldn't install the grub package..
So I think for newer versions of kali you might need to install grub2 instead.
Which means use the following command.

apt-get install grub2 #instead of grub

All steps from there shall be easy..
Thanks again.