PDA

View Full Version : Grub2 rescue



xabilo
May 9th, 2013, 02:16 PM
I have Windows 7 and Pinguy OS on the 80 GB SSD. Last year on June 14 I had exactly the same problem after partitioning my Solid state Drive but I managed to find the solution in the Ubuntu online Documentation. So back then I successfully installed Pinguy OS 12.04 LTS. A few days ago, on Monday the 6th, I decided to create an installable Pinguy backup according to http://pinguyos.tumblr.com/post/8701652563/backing-up-your-pinguy-os-install-into-an-installable
I suddenly realised when I was removing Orphaned Packages that I had to stop. When I rebooted my pc, Pinguy OS didn't boot. I had to reinstall it. I selected the first installation method: replacing the Ubuntu partition but the installation went so slow that i pushed my Reset button on my pc. A second installation also failed because I had checked the 'Encrypt home folder'. So I had to resize the partitions myself. They are as follows:


/dev/sda
/dev/sda1 ntfs 42000 MB
/dev/sda2 ext4 / 19614 MB
/dev/sda4 ext4 18408 MB

/dev/sdb

Pinguy OS boots with the following commands:

grub rescue> ls
(hd0) (hd0,msdos2) (hd0,msdos1) (hd1) (hd1,msdos5) (hd1,msdos4) (hd1,msdos3) (hd1,msdos1) (fd0)
grub rescue> set
prefix=(hd0,3)/boot/grub
root=hd0,3
grub rescue> ls (hd1,msdos3)
./ ../ lost+found/ etc/ media/ var/ .Trash-0/ .conkyapp/ bin/ boot/ cdrom/ dev/ home/ lib/ lib32/ lib64/ mnt/ opt/ proc/ root/ run/ sbin/ selinux/ srv/ sys/ tmp/ usr/ .Pinguy OS Search.html startconky.sh initrd.img vmlinuz
grub resue> set root=(hd1,msdos3)
grub rescue> set prefix=(hd1,msdos3)/boot/grub
grub rescue> insmod ext2
grub rescue> insmod linux
grub rescue> linux /vmlinuz root=/dev/sda3 ro
grub rescue> initrd /initrd.img
grub rescue> boot

Then I followed the instructions in the Ubuntu Grub2 Documentation under Post Boot Follow Up:
1. Update the GRUB 2 configuration file :
sudo update-grub
2. Reinstall GRUB 2 :
sudo grub-install /dev/sda
3. Inspect the GRUB 2 configuration file. The default is /boot/grub/grub.cfg
I read in this GRUB configuration file: Do not edit this file !
4. Verify the existence and contents of the system boot folders.
1. / should contain the symlinks vmlinuz and initrd.img : OK
2. /boot/ should contain the actual kernel (vmlinuz-x.x.x.-xx...) and initrd image (initrd.img-x.x.x-xx...) : OK
3. /boot/grub should contain grub.cfg and numerous module files (*.mod) : OK

The only thing in the grub.cfg file that isn't correct is this: set root='(hd0,msdos3)' and this is of course repeated several times when the root is set. How can Pinguy OS properly boot with this wrong information? hd0,msdos3 is a partition that does not exist. The correct partition is hd1,msdos3 ! How can I fix this when the grub configuration file is automatically generated by grub-mkconfig using templates and from /etc/grub.d and settings from /etc/default/grub ? So at the end of the day (yesterday) when I rebooted, I was getting this:

error: no such device: a956c6ed-444e-4ca1-ad47-b4d35b3e3683
grub rescue>

I downloaded Boot-repair and here's the results file:


Boot Info Script 0.61 [1 April 2012]


============================= Boot Info Summary: ===============================

=> Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and looks
for (,msdos3)/boot/grub on this drive.
=> Grub2 (v1.99) is installed in the MBR of /dev/sdb and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and uses an
embedded config file:

---------------------------------------------------------------------------
search.fs_uuid a956c6ed-444e-4ca1-ad47-b4d35b3e3683 root
set prefix=($root)/boot/grub
---------------------------------------------------------------------------
-----.

sda1: __________________________________________________ ________________________

File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 7
Boot files: /Windows/System32/winload.exe

sda2: __________________________________________________ ________________________

File system: Extended Partition
Boot sector type: Unknown
Boot sector info:

sda5: __________________________________________________ ________________________

File system: swap
Boot sector type: -
Boot sector info:

sda3: __________________________________________________ ________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 12.04 LTS
Boot files: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda4: __________________________________________________ ________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files:

sdb1: __________________________________________________ ________________________

File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files: /bootmgr /Boot/BCD

sdb2: __________________________________________________ ________________________

File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files:

============================ Drive/Partition Info: =============================

Drive: sda __________________________________________________ ___________________

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sda1 * 2,048 82,033,297 82,031,250 7 NTFS / exFAT / HPFS
/dev/sda2 82,034,686 91,043,839 9,009,154 5 Extended
/dev/sda5 82,034,688 91,043,839 9,009,152 82 Linux swap / Solaris
/dev/sda3 91,043,840 120,342,527 29,298,688 83 Linux
/dev/sda4 120,344,576 156,299,263 35,954,688 83 Linux


Drive: sdb __________________________________________________ ___________________

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sdb1 * 2,048 206,847 204,800 7 NTFS / exFAT / HPFS
/dev/sdb2 206,848 242,394,347 242,187,500 7 NTFS / exFAT / HPFS


"blkid" output: __________________________________________________ ______________

Device UUID TYPE LABEL

/dev/loop0 squashfs
/dev/sda1 341E3B4A1E3B0500 ntfs
/dev/sda3 fb9c1b2e-6b86-443d-952d-8012acf7bead ext4
/dev/sda4 c53e189c-0ac8-49bb-b5fa-fe0f277c82d8 ext4
/dev/sda5 461f823d-71fd-49ea-982d-61b2a8078e07 swap
/dev/sdb1 BC80392F8038F20E ntfs Door systeem gereserveerd
/dev/sdb2 DE4684D74684B1B7 ntfs Data
/dev/sr0 iso9660 Pinguy OS 12.04 x64
/dev/zram0 062aaaf5-6be3-4f5a-93d5-eafeb62d0ab9 swap
/dev/zram1 853ce389-144f-4dcb-9b6b-5e7f8ab32c93 swap
/dev/zram2 37487e2a-4332-48f2-a2e3-38310d73df19 swap
/dev/zram3 f49263fa-50ed-4c63-b378-04f43a495a53 swap

================================ Mount points: =================================

Device Mount_Point Type Options

/dev/loop0 /rofs squashfs (ro,noatime)
/dev/sr0 /cdrom iso9660 (ro,noatime)


=========================== sda3/boot/grub/grub.cfg: ===========================

--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}

function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set=root fb9c1b2e-6b86-443d-952d-8012acf7bead
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set=root fb9c1b2e-6b86-443d-952d-8012acf7bead
set locale_dir=($root)/boot/grub/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="${1}"
if [ "${1}" = "keep" ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
}
if [ "${recordfail}" != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "${linux_gfx_mode}" != "text" ]; then load_video; fi
menuentry 'Pinguy OS, with Linux 3.2.0-25-generic' --class pinguy --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set=root fb9c1b2e-6b86-443d-952d-8012acf7bead
linux /boot/vmlinuz-3.2.0-25-generic root=UUID=fb9c1b2e-6b86-443d-952d-8012acf7bead ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.2.0-25-generic
}
menuentry 'Pinguy OS, with Linux 3.2.0-25-generic (recovery mode)' --class pinguy --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set=root fb9c1b2e-6b86-443d-952d-8012acf7bead
echo 'Loading Linux 3.2.0-25-generic ...'
linux /boot/vmlinuz-3.2.0-25-generic root=UUID=fb9c1b2e-6b86-443d-952d-8012acf7bead ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.2.0-25-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set=root fb9c1b2e-6b86-443d-952d-8012acf7bead
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set=root fb9c1b2e-6b86-443d-952d-8012acf7bead
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sdb1)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd1,msdos1)'
search --no-floppy --fs-uuid --set=root BC80392F8038F20E
chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

=============================== sda3/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda3 during installation
UUID=fb9c1b2e-6b86-443d-952d-8012acf7bead / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=461f823d-71fd-49ea-982d-61b2a8078e07 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
--------------------------------------------------------------------------------

=================== sda3: Location of files loaded by Grub: ====================

GiB - GB File Fragment(s)

45.546226501 = 48.904888320 boot/grub/core.img 1
45.546241760 = 48.904904704 boot/grub/grub.cfg 1
47.077148438 = 50.548703232 boot/initrd.img-3.2.0-25-generic 2
46.386466980 = 49.807089664 boot/vmlinuz-3.2.0-25-generic 1
47.077148438 = 50.548703232 initrd.img 2
46.386466980 = 49.807089664 vmlinuz 1

======================== Unknown MBRs/Boot Sectors/etc: ========================

Unknown BootLoader on sda2

00000000 48 83 ec 28 e8 37 4b db ff 90 48 83 c4 28 f3 c3 |H..(.7K...H..(..|
00000010 cc cc cc cc cc cc cc cc cc cc cc cc 30 1e 05 00 |............0...|
00000020 48 83 ec 28 48 8b 49 08 48 8d 05 31 5c ce ff 80 |H..(H.I.H..1\...|
00000030 39 00 4c 8b d8 ff 10 90 48 83 c4 28 f3 c3 cc cc |9.L.....H..(....|
00000040 cc cc cc cc cc cc cc cc cc cc cc cc 10 1e 05 00 |................|
00000050 53 57 48 83 ec 28 48 8b fa 48 8b d9 48 8b cb e8 |SWH..(H..H..H...|
00000060 6c e8 d9 ff 48 8d 4b 08 48 8b d7 e8 00 16 da ff |l...H.K.H.......|
00000070 90 48 83 c4 28 5f 5b f3 c3 cc cc cc f0 1d 05 00 |.H..(_[.........|
00000080 53 48 83 ec 20 48 8b d9 e8 f3 09 dc ff 48 8d 4b |SH.. H.......H.K|
00000090 08 48 8b d0 e8 d7 15 da ff e8 d2 59 dd ff 48 8d |.H.........Y..H.|
000000a0 4b 10 48 8b d0 e8 c6 15 da ff 90 48 83 c4 20 5b |K.H........H.. [|
000000b0 f3 c3 cc cc cc cc cc cc cc cc cc cc c0 1d 05 00 |................|
000000c0 53 57 48 83 ec 28 48 8b da 48 8b f9 e8 6f 7b dd |SWH..(H..H...o{.|
000000d0 ff 80 38 00 4c 8d 0d 5d 13 db ff 4c 8b c3 48 8b |..8.L..]...L..H.|
000000e0 d7 48 8b c8 49 8b c1 48 83 c4 28 5f 5b 48 ff e0 |.H..I..H..(_[H..|
000000f0 48 83 c4 28 5f 5b f3 c3 cc cc cc cc 90 1d 05 00 |H..(_[..........|
00000100 88 51 09 f3 c3 cc cc cc cc cc cc cc 90 1d 05 00 |.Q..............|
00000110 8a 41 09 f3 c3 cc cc cc cc cc cc cc cc cc cc cc |.A..............|
00000120 cc cc cc cc cc cc cc cc cc cc cc cc 80 1d 05 00 |................|
00000130 8a 41 08 f3 c3 cc cc cc cc cc cc cc cc cc cc cc |.A..............|
00000140 cc cc cc cc cc cc cc cc cc cc cc cc 70 1d 05 00 |............p...|
00000150 53 57 48 83 ec 28 0f b6 41 09 85 c0 74 05 88 51 |SWH..(..A...t..Q|
00000160 08 eb 0d 0f b6 c2 85 c0 0f 85 92 59 10 00 66 90 |...........Y..f.|
00000170 48 83 c4 28 5f 5b f3 c3 cc cc cc cc 50 1d 05 00 |H..(_[......P...|
00000180 c6 41 09 01 f3 c3 cc cc cc cc cc cc 50 1d 05 00 |.A..........P...|
00000190 53 56 57 48 83 ec 20 49 8b f2 48 8b fa 48 89 4c |SVWH.. I..H..H.L|
000001a0 24 40 48 8b 4c 24 40 e8 7c e6 d9 ff 48 8b d8 4c |$@H.L$@.|...H..L|
000001b0 8d 05 62 bb e2 ff 45 33 c9 33 d2 48 8b cf 00 fe |..b...E3.3.H....|
000001c0 ff ff 82 fe ff ff 02 00 00 00 00 78 89 00 00 00 |...........x....|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200


========= Devices which don't seem to have a corresponding hard drive: =========

sdc sdd sde sdf

=============================== StdErr Messages: ===============================

xz: (stdin): Compressed data is corrupt
xz: (stdin): Compressed data is corrupt

grahammechanical
May 9th, 2013, 03:09 PM
hd0, msdo3 = sda3 = third partition on first hard disk. You say that hd0, msdos3 does not exist, yet boot repair says "/ was on /dev/sda3 during installation." The Grub configuration file 10_linux has a menu entries for Pinguy OS on hd0,msdos3 and with a UUID (Universal Unique Identifer) for a hard disk that matches the UUID that boot repair has for sda3.

I would guess that you are trying to boot a Pinguy OS on the second hard disk when you should be trying to boot Pinguy OS on the third partition of the first hard disk. What evidence do you have that Pinguy OS is installed on the second hard disk?

grub rescue>set root=(hd1,msdos3) is the third partition on the second hard disk. It will look in the wrong place.

Regards.

xabilo
May 9th, 2013, 03:33 PM
This morning (when booting) when I got the grub rescue command I accidentally typed:

grub rescue>set root=(hd0,msdos3) and then I got this: error, no such partition.

oldfred
May 9th, 2013, 04:11 PM
It is like your drives have changed order. Sometimes BIOS will also bring drives up in a different order particularly mixed IDE & SATA or USB drives.

But it looks like you have BIOS set to boot from sdb. And this UUID does not exist.


=> Grub2 (v1.99) is installed in the MBR of /dev/sdb and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and uses an
embedded config file:

---------------------------------------------------------------------------
search.fs_uuid a956c6ed-444e-4ca1-ad47-b4d35b3e3683 root
set prefix=($root)/boot/grub



You also have the Windows boot partition on sdb, but your main Windows install on sda. That may have occurred if you have BIOS set to boot from sdb when you installed Windows to sda. It puts the hidden 100MB boot/repair partition on the drive in BIOS to boot from. I might copy boot files into main Windows install so you have Windows fully bootable from one drive.
Grub just defaults to install to the drive that is sda whether that is really the boot drive or not.

xabilo
May 10th, 2013, 11:22 PM
Yes it was indeed the drives that changed order. The SSD was set as 2nd drive to boot which was wrong. I changed that, saved and exit. The computer rebooted and then the menu to select Pinguy OS (as 1st one on top), linux-generix, mem-test and as last one windows 7 appeared. So problem solved now. Thanks very much for helping me! :smile:

chkneater
May 10th, 2013, 11:36 PM
And that's exactly why you install the MBR instead of individual partiions.