PDA

View Full Version : [ubuntu] Faulty grub.cfg files



sapeurcamembert
January 29th, 2011, 12:46 AM
grub.cfg file generated by update-grub makes the system unbootable.
The system starts and keep rebooting without showing grub2 boot menu.
I got that AFTER applying a batch of fixes from ubuntu.
To make the system rebootable i got a copy of the previous grub.cfg and simply copy it at the rigt place and it works.
I did some experiments and prove that using now update-grug generates a faulty grub.cfg file.
update-grub version is /usr/sbin/grub-mkconfig (GNU GRUB 1.98-1ubuntu9)
A diff (diff -i -- command between the old grub.cfg and the faulty one shows
--------------------------------------------------------------

root@am-desktop:/home/am# diff -y --suppress-common-lines grub.cfg grub.cfg.oldone
terminal usb_keyboard | # terminal usb_keyboard
set root='(/dev/sdc,1)' | set root='(hd1,1)'
set gfxmode=1280x1024x24 | set gfxmode=640x480
set root='(/dev/sdc,1)' | set root='(hd1,1)'
set root='(/dev/sdc,1)' | set root='(hd1,1)'
set root='(/dev/sdc,1)' | set root='(hd1,1)'
set root='(/dev/sdc,1)' | set root='(hd1,1)'
set root='(/dev/sdc,1)' | set root='(hd1,1)'
set root='(/dev/sdc,1)' | set root='(hd1,1)'
set root='(/dev/sdc,1)' | set root='(hd1,1)'
menuentry "Ubuntu, with Linux 2.6.32-26-generic-pae (on /dev/ | menuentry "Ubuntu, Linux 2.6.31-22-generic-pae (on /dev/sda3)
search --no-floppy --fs-uuid --set 4314cbf8-37b5-41a8 | search --no-floppy --fs-uuid --set fd4d6a07-c41f-4e2b
linux /boot/vmlinuz-2.6.32-26-generic-pae root=UUID=d <
initrd /boot/initrd.img-2.6.32-26-generic-pae <
} <
menuentry "Ubuntu, with Linux 2.6.32-26-generic-pae (recovery <
insmod ext2 <
set root='(hd0,3)' <
search --no-floppy --fs-uuid --set 4314cbf8-37b5-41a8 <
linux /boot/vmlinuz-2.6.32-26-generic-pae root=UUID=d <
initrd /boot/initrd.img-2.6.32-26-generic-pae <
} <
menuentry "Ubuntu, with Linux 2.6.31-22-generic-pae (on /dev/ <
insmod ext2 <
set root='(hd0,3)' <
search --no-floppy --fs-uuid --set 4314cbf8-37b5-41a8 <
menuentry "Ubuntu, with Linux 2.6.31-22-generic-pae (recovery | menuentry "Ubuntu, Linux 2.6.31-22-generic-pae (recovery mode
search --no-floppy --fs-uuid --set 4314cbf8-37b5-41a8 | search --no-floppy --fs-uuid --set fd4d6a07-c41f-4e2b
--------------------------------------------------------------

set root='(hd1,1)' on the good grub.cfg are now replaced by
set root='(/dev/sdc,1)'

Missing kernels on the good grub.cfg are absent because I cannot anymore use update-grub...Using it makes the system unbootable.

Here are the results of boot_info_script055.sh (shows boot parameters and files and drives...)

Booting is 10.04 from /dev/sdc1

Any idea ?

-----------------------------------------------------------------
Boot Info Script 0.55 dated February 15th, 2010

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

=> Grub 0.97 is installed in the MBR of /dev/sda and looks on the same drive
in partition #3 for /boot/grub/stage2 and /boot/grub/menu.lst.
=> No boot loader is installed in the MBR of /dev/sdb
=> Grub 2 is installed in the MBR of /dev/sdc and looks on the same drive in
partition #1 for /boot/grub.

sda1: __________________________________________________ _______________________

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

sda3: __________________________________________________ _______________________

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

sdb1: __________________________________________________ _______________________

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

sdc1: __________________________________________________ _______________________

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

sdc2: __________________________________________________ _______________________

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

sdc5: __________________________________________________ _______________________

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

sdc3: __________________________________________________ _______________________

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

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

Drive: sda ___________________ __________________________________________________ ___

Disk /dev/sda: 400.1 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders, total 781422768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sda1 63 679,019,354 679,019,292 83 Linux
/dev/sda3 * 679,019,355 781,417,664 102,398,310 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 End Size Id System

/dev/sdb1 1 1,953,525,167 1,953,525,167 ee GPT


GUID Partition Table detected.

Partition Start End Size System
/dev/sdb1 34 1,953,525,134 1,953,525,101 Linux or Data

Drive: sdc ___________________ __________________________________________________ ___

Disk /dev/sdc: 150.0 GB, 150039945216 bytes
255 heads, 63 sectors/track, 18241 cylinders, total 293046768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sdc1 * 63 83,827,169 83,827,107 83 Linux
/dev/sdc2 83,827,170 117,001,394 33,174,225 5 Extended
/dev/sdc5 83,827,233 117,001,394 33,174,162 82 Linux swap / Solaris
/dev/sdc3 117,001,395 293,041,664 176,040,270 83 Linux


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/sda1 e7cd5504-de34-498f-9c96-42223f53d99e ext4 WDsda1
/dev/sda3 4314cbf8-37b5-41a8-b190-37e9fc174aa8 ext4 copysys
/dev/sda: PTTYPE="dos"
/dev/sdb1 d3581280-04bc-423d-b990-b1f0fdf46b2b ext4 JumboWD
/dev/sdb: PTTYPE="gpt"
/dev/sdc1 d4e02d10-da27-4638-9476-b9ba58bad171 ext4 ubuntu9.10
/dev/sdc2: PTTYPE="dos"
/dev/sdc3 f2998edb-47ed-49c5-811e-d77f52b1531e ext4 userhome
/dev/sdc5 a4667c59-7156-4842-bf8a-c5fade414e0c swap
/dev/sdc: PTTYPE="dos"

============================ "mount | grep ^/dev output: ===========================

Device Mount_Point Type Options

/dev/sdc1 / ext4 (rw,errors=remount-ro)
/dev/sda1 /media/sda1 ext4 (rw)
/dev/sdc3 /home ext4 (rw)
/dev/sdb1 /media/sdb1 ext4 (rw)


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

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/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
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
}
if terminal_input usb_keyboard ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_input
# terminal usb_keyboard
fi
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
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 ###
menuentry 'Ubuntu, with Linux 2.6.32-26-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
linux /boot/vmlinuz-2.6.32-26-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro quiet splash
initrd /boot/initrd.img-2.6.32-26-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.32-26-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
echo 'Loading Linux 2.6.32-26-generic-pae ...'
linux /boot/vmlinuz-2.6.32-26-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-26-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.31-22-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
linux /boot/vmlinuz-2.6.31-22-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro quiet splash
initrd /boot/initrd.img-2.6.31-22-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.31-22-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
echo 'Loading Linux 2.6.31-22-generic-pae ...'
linux /boot/vmlinuz-2.6.31-22-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.31-22-generic-pae
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Ubuntu, Linux 2.6.31-22-generic-pae (on /dev/sda3)" {
insmod ext2
set root='(hd0,3)'
search --no-floppy --fs-uuid --set fd4d6a07-c41f-4e2b-986d-609f3cbb6b00
linux /boot/vmlinuz-2.6.31-22-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro quiet splash
initrd /boot/initrd.img-2.6.31-22-generic-pae
}
menuentry "Ubuntu, Linux 2.6.31-22-generic-pae (recovery mode) (on /dev/sda3)" {
insmod ext2
set root='(hd0,3)'
search --no-floppy --fs-uuid --set fd4d6a07-c41f-4e2b-986d-609f3cbb6b00
linux /boot/vmlinuz-2.6.31-22-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro single
initrd /boot/initrd.img-2.6.31-22-generic-pae
}
### 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 ###

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

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' 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 defaults 0 0
# / was on /dev/sdb1 during installation
UUID=d4e02d10-da27-4638-9476-b9ba58bad171 / ext4 errors=remount-ro 0 1
# /home was on /dev/sdb3 during installation
UUID=f2998edb-47ed-49c5-811e-d77f52b1531e /home ext4 defaults 0 2
# /dev/sda1 400 GB
UUID=e7cd5504-de34-498f-9c96-42223f53d99e /media/sda1 ext4 defaults 0 2
# swap was on /dev/sdb5 during installation
UUID=a4667c59-7156-4842-bf8a-c5fade414e0c none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
# Jumbo 1TB WD
UUID=d3581280-04bc-423d-b990-b1f0fdf46b2b /media/sdb1 ext4 defaults 0 2

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


362.9GB: boot/grub/core.img
362.8GB: boot/grub/grub.cfg
362.8GB: boot/initrd.img-2.6.31-22-generic-pae
362.8GB: boot/initrd.img-2.6.32-26-generic-pae
362.8GB: boot/initrd.img-2.6.32-27-generic-pae
362.8GB: boot/vmlinuz-2.6.31-22-generic-pae
362.8GB: boot/vmlinuz-2.6.32-26-generic-pae
362.8GB: boot/vmlinuz-2.6.32-27-generic-pae
362.8GB: initrd.img.old
362.8GB: vmlinuz.old

=========================== sdc1/boot/grub/grub.cfg: ===========================

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/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
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
}
if terminal_input usb_keyboard ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_input
# terminal usb_keyboard
fi
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
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 ###
menuentry 'Ubuntu, with Linux 2.6.32-26-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
linux /boot/vmlinuz-2.6.32-26-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro quiet splash
initrd /boot/initrd.img-2.6.32-26-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.32-26-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
echo 'Loading Linux 2.6.32-26-generic-pae ...'
linux /boot/vmlinuz-2.6.32-26-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-26-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.31-22-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
linux /boot/vmlinuz-2.6.31-22-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro quiet splash
initrd /boot/initrd.img-2.6.31-22-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.31-22-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
echo 'Loading Linux 2.6.31-22-generic-pae ...'
linux /boot/vmlinuz-2.6.31-22-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.31-22-generic-pae
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set d4e02d10-da27-4638-9476-b9ba58bad171
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Ubuntu, Linux 2.6.31-22-generic-pae (on /dev/sda3)" {
insmod ext2
set root='(hd0,3)'
search --no-floppy --fs-uuid --set fd4d6a07-c41f-4e2b-986d-609f3cbb6b00
linux /boot/vmlinuz-2.6.31-22-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro quiet splash
initrd /boot/initrd.img-2.6.31-22-generic-pae
}
menuentry "Ubuntu, Linux 2.6.31-22-generic-pae (recovery mode) (on /dev/sda3)" {
insmod ext2
set root='(hd0,3)'
search --no-floppy --fs-uuid --set fd4d6a07-c41f-4e2b-986d-609f3cbb6b00
linux /boot/vmlinuz-2.6.31-22-generic-pae root=UUID=d4e02d10-da27-4638-9476-b9ba58bad171 ro single
initrd /boot/initrd.img-2.6.31-22-generic-pae
}
### 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 ###

=============================== sdc1/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' 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 defaults 0 0
# / was on /dev/sdb1 during installation
UUID=d4e02d10-da27-4638-9476-b9ba58bad171 / ext4 errors=remount-ro 0 1
# /home was on /dev/sdb3 during installation
UUID=f2998edb-47ed-49c5-811e-d77f52b1531e /home ext4 defaults 0 2
# /dev/sda1 400 GB
UUID=e7cd5504-de34-498f-9c96-42223f53d99e /media/sda1 ext4 defaults 0 2
# swap was on /dev/sdb5 during installation
UUID=a4667c59-7156-4842-bf8a-c5fade414e0c none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
# Jumbo 1TB WD
UUID=d3581280-04bc-423d-b990-b1f0fdf46b2b /media/sdb1 ext4 defaults 0 2

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


34.4GB: boot/grub/core.img
34.5GB: boot/grub/grub.cfg
34.5GB: boot/initrd.img-2.6.31-22-generic-pae
34.5GB: boot/initrd.img-2.6.32-26-generic-pae
34.5GB: boot/vmlinuz-2.6.31-22-generic-pae
34.4GB: boot/vmlinuz-2.6.32-26-generic-pae