H
H
hack3p2015-10-24 00:38:53
linux
hack3p, 2015-10-24 00:38:53

How to restore GRUB Debian + Win7?

I decided to install myself a second OS - Debian, next to Windows 7. Installed it. As a result, only windows 7 was available in grub. I decided to go with live usb (xubuntu) and update grub so that debian appeared. Grub did not want to update, so I decided to reinstall it.
After that, he still does not want to update and now grub has no items at all.
Drive: sda
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Partition Boot Start Sector End Sector # of Sectors Id System
/dev/sda1 * 63 417.689 417.627 7 NTFS / exFAT / HPFS
/ dev / sda2 417,690 339,710,489 339,292,800 7 NTFS / exFAT / HPFS
/ dev / sda3 339,710,490 1,428,814,876 1,089,104,387 7 NTFS / exFAT / HPFS
/ dev / sda4 1,428,815,870 1,953,523,711 524,707,842 5 Extended
/ dev / sda5 1,428,815,872 1,446,393,855 17,577,984 83 Linux
/ dev / sda6 1,446,395,904 1,452,253,183 5,857,280 83 Linux
/ dev / sda7 1,452,255,232 1,485,613,055 33,357,824 82 the swap Linux / the Solaris
/ dev / sda8 1,485,615,104 1,486,393,343 778.240 83 Linux
/ dev / sda9 1,486,395,392 1,953,523,711 467,128,320 83 Linux
does so:
sudo the mount / dev / sda5 / mnt
sudo --bind the mount / dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install
update-grub
Errors:
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub. png
mkdir: cannot create directory '/var/lib/os-prober/mount': No such file or directory
mkdir: cannot create directory '/var/lib/os-prober/mount': No such file or directory
mkdir: cannot create directory '/var/lib/os-prober/mount': No such file or directory
mkdir: cannot create directory '/var/lib/os-prober/mount': No such file or directory
mkdir: cannot create directory '/ var/lib/os-prober/mount': No such file or directory
mkdir: cannot create directory '/var/lib/os-prober/mount': No such file or directory
mkdir: cannot create directory '/var/lib/os-prober/mount': No such file or directory
mkdir: cannot create directory '/var/lib/os-prober/mount': No such file or directory
done
Further googling did not help hope you.
Could you help me?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-10-28
@hack3p

Start the system from the LiveCD/USB and open a terminal. To do this, you can press Alt + F2 and enter the command:
Next, you need to find out your partition table. Use the command:
The following table should be displayed on the screen:

/dev/sda1 29 8369 66999082+ 83 Linux
/dev/sda2 * 8370 13995 45190845 7 HPFS/NTFS
/dev/sda3 13996 14593 4803435 5 Extended

From the table we see that Linux is (in our case) on the /dev/sda1 partition.
Now we will connect this partition to /mnt with the following command:
Then, to write grub to the MBR, enter the following command:
In case you only need to restore the MBR of the disk ( for example, after reinstalling Windows), then this is enough.
If you need to update the grub menu as well ( for example, after installing Windows ), then you need to do:
Restore finished!
How to add windows to grub list

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question