0

I was trying to reset the password and I held down the shift key when booting didn't where I wanted to go instead it said error attempting to read or write outside disc 'hd0' entering rescue mode.... grub rescue>

  • No I hadn't been able to get it to accept any commands until I found somewhere that said type LS and that got me the errors (hd0) (hd0,msdos5) (hd0,msdos1) – Leroy Ikerd III Oct 31 '16 at 21:23

1 Answers1

0

when the grub rescue appears, type

ls

you will get partitions list like

(hd0,msdos1) and so on

now type

ls (hd0,msdos1)/

this will display the contents of that partition. you need to repeat the above step until you find Linux partition. It contains directories like boot, home, etc, var, lib, etc... once you find that partition just remember the name. I will use partition msdos1 as linux partition here. type

set root=(hd0,msdos1) now type set prefix=(hd0,msdos1)/boot/grub

insmod normal

normal

you should get the menu now to boot. if you boot into system, run update-grub and grub-install like i explained below. if you can't boot after entering normal, then, try below steps.

boot into grub rescue type the following and press enter after each line. replace partition msdos1 with your linux partition

ls (hd0,msdos1)/boot/

you should find a file with name starting with vmlinuz. it is the kernel. now type the following line replacing the kernel version and partition with yours.

linux (hd0,msdos1)/boot/vmlinuz-4.4.0-21-generic 

now type the following replacing my version with yours.

initrd initrd.img-4.4.0-21-generic

now enter

boot

you will boot into the os. now open a terminal by pressing ctrl+alt+t or simply pressing super or meta or windows key and searching for terminal. after opening terminal, type

sudo update-grub2

then install grub by typing

sudo grub-install /dev/sda

If you fail at both methods, then, boot live ubuntu disc and select try ubuntu and then install ubuntu from there. it seems to work better.

references: https://askubuntu.com/a/397520/534857