Sunday, December 22, 2019

boot - How do I repair/restore grub2?



I currently have a Windows 10 and Ubuntu 16.04 dual boot on my PC. This issue happened because i have installed windows after Ubuntu.



I have tried to boot from a live-USB and reinstalling Grub using the terminal following this link http://howtoubuntu.org/how-to-repair-restore-reinstall-grub-2-with-a-ubuntu-live-cd




Also using the grub repair tool but with no success!



And now I am stuck in this grub2 command line screen:



Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions.
grub>



I got this output after running lsblk; sudo parted -l



Model: ATA WDC WD3000HLFS-0 (scsi)
Disk /dev/sda: 300GB

Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 525MB 524MB primary ntfs boot
2 525MB 300GB 300GB primary ntfs

Model: ATA WDC WD3000HLFS-0 (scsi)
Disk /dev/sdb: 300GB

Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 300GB 300GB primary ext4

Model: ATA Samsung SSD 840 (scsi)
Disk /dev/sdc: 500GB
Sector size (logical/physical): 512B/512B

Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 8002MB 8001MB primary linux-swap(v1)
2 8003MB 500GB 492GB extended
5 8003MB 28.0GB 20.0GB logical ext4
6 28.0GB 28.5GB 500MB logical ext4
7 28.5GB 43.5GB 15.0GB logical ext4
8 43.5GB 58.5GB 15.0GB logical ext4

9 58.5GB 88.5GB 30.0GB logical ext4 boot
10 88.5GB 500GB 412GB logical ext4

Model: JetFlash Transcend 16GB (scsi)
Disk /dev/sdd: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags

1 1049kB 15.8GB 15.8GB primary fat32 boot, lba


From your Question and comments the resolution will be the following:



Boot to the live disk and run these steps. the /dev/sdXY is replaced for the specifics of the information you have provided.



The c6 in step 1 and the a in step 4 are variables. The c6 should be replaced with the partition of your Ubuntu install. The a should be replaced with the default boot that you have set in your bios.



The prefix :$ and :# are the command prompts you see on the terminal.





1:$ sudo mount /dev/sdc6 /mnt
2:$ for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt/$i"; done
3:$ sudo chroot /mnt
4:# grub-install /dev/sda
5:# update-grub
6:# exit
7:$ for i in /sys /proc /run /dev; do sudo umount "/mnt/$i"; done
8:$ exit



Reboot.



Ensure that you have UEFI enabled in your BIOS if is a later model computer with that feature.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...