İçeriğe geç

Repair Grub 2 from a live DVD

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

Olmazsaa 😀

Insert your Live DVD, or Live USB, and reboot your system. Select the live media, and boot from it.

Once the Live media is booted select the option to “Try Ubuntu Mate” and wait for it to finish loading.

From the live session open a terminal and run

sudo fdisk -l

This should return a output similar to this

ubuntu-mate@ubuntu-mate:~$ sudo fdisk -l
Disk /dev/loop0: 1.6 GiB, 1656864768 bytes, 3236064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 8 GiB, 8589934592 bytes, 16777216 sectors
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:

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 15728639 15726592 7.5G 83 Linux
/dev/sda2 15730686 16775167 1044482 510M 5 Extended
/dev/sda5 15730688 16775167 1044480 510M 82 Linux swap / Solaris
ubuntu-mate@ubuntu-mate:~$

In the example above /dev/sda is the hard drive of the machine that the live DVD, or Live USB booted from.

Now find the Linux partition. In the example above it would be /dev/sda1 which is labled as Linux

Next, you need to mount the Linux partition.

From the terminal run

sudo mount /dev/sda1 /mnt

This will temporarily mount the Linux partition so there is access to the Grub configuration files that are necessary to reinstall Grub on your system.

Next, to reinstall Grub run the following in the terminal

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

This command is going to tell Grub to install the configuration located in the Linux partition /boot directory, which is mounted at /mnt, and install to the MBR of the hard drive on your system represented here as /dev/sda

This should return a output similar to the following if everything worked correctly

Installing for i386-pc platform.
Installation finished. No error reported.

At this point Grub should be repaired, and you should be able to boot into your system normally once again.

Kategori:Linux

İlk Yorumu Siz Yapın

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir