PDA

View Full Version : [SOLVED] 13.04 boot to grub> prompt



Brian_Reuter
September 8th, 2013, 12:03 AM
I did a fresh install of Ubuntu 13.04 server (64-bit) from a usb key to my boot disk (also a USB key). I was able to get the system working and reliably booting. I may have had to rerun "update-grub" after the first boot, I can no longer recall, but I booted the system several times. I then did


sudo apt-get update
sudo apt-get upgrade

At this point the system would boot to the grub> prompt with no error message or explanation. I can continue to boot the system manually without issue:


linux /boot/vmlinux-whatever root=/dev/sda1
initrd /boot/initrd-whatever
boot

At the suggestion of everyone I would do:


sudo update-grub

No luck. After trying a wide variety of things I noticed the following from the grub> prompt:


cat /boot/grub/gfxblacklist.txt
(dumps the contents of that file normally)
cat /boot/grub/grub.cfg
error: attempt to read or write outside of disk `hd0'

Below is the output of bootinfoscript, you will see the raid disks plugged back in, but all of the above was done without them. Other details: This is an HP Proliant Gen8 microserver, I have 4 3TB HD's which are eventually going to be software raided (I've tried all this with/without them, no difference). My boot source is the internal SDCard (presented to the system as a USB drive). I've also tried installing to external USB keys instead, always end up with this or similar problems. I have a hunch this will work fine if I install to the first hard disk, I'm just reluctant to do so (but if that's all that's left...).



Boot Info Script 0.61 [1 April 2012]




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


=> No boot loader is installed in the MBR of /dev/sda.
=> No boot loader is installed in the MBR of /dev/sdb.
=> No boot loader is installed in the MBR of /dev/sdc.
=> No boot loader is installed in the MBR of /dev/sdd.
=> Grub2 (v1.99) is installed in the MBR of /dev/sde and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and looks
in partition 94 for .


sda1: __________________________________________________ ________________________


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


sdb1: __________________________________________________ ________________________


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


sdc1: __________________________________________________ ________________________


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


sdd1: __________________________________________________ ________________________


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


sde1: __________________________________________________ ________________________


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


sde2: __________________________________________________ ________________________


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


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


Drive: sda __________________________________________________ ___________________


Disk /dev/sda: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes


Partition Boot Start Sector End Sector # of Sectors Id System


/dev/sda1 1 4,294,967,295 4,294,967,295 ee GPT




GUID Partition Table detected.


Partition Start Sector End Sector # of Sectors System
/dev/sda1 2,048 2,639,306,751 2,639,304,704 RAID partition (Linux)


Drive: sdb __________________________________________________ ___________________


Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes


Partition Boot Start Sector End Sector # of Sectors Id System


/dev/sdb1 1 4,294,967,295 4,294,967,295 ee GPT




GUID Partition Table detected.


Partition Start Sector End Sector # of Sectors System
/dev/sdb1 2,048 2,639,306,751 2,639,304,704 RAID partition (Linux)


Drive: sdc __________________________________________________ ___________________


Disk /dev/sdc: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes


Partition Boot Start Sector End Sector # of Sectors Id System


/dev/sdc1 1 4,294,967,295 4,294,967,295 ee GPT




GUID Partition Table detected.


Partition Start Sector End Sector # of Sectors System
/dev/sdc1 2,048 2,639,306,751 2,639,304,704 RAID partition (Linux)


Drive: sdd __________________________________________________ ___________________


Disk /dev/sdd: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes


Partition Boot Start Sector End Sector # of Sectors Id System


/dev/sdd1 1 4,294,967,295 4,294,967,295 ee GPT




GUID Partition Table detected.


Partition Start Sector End Sector # of Sectors System
/dev/sdd1 2,048 2,639,306,751 2,639,304,704 RAID partition (Linux)


Drive: sde __________________________________________________ ___________________


Disk /dev/sde: 31.9 GB, 31914983424 bytes
255 heads, 63 sectors/track, 3880 cylinders, total 62333952 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/sde1 * 2,048 31,250,431 31,248,384 83 Linux
/dev/sde2 31,250,432 62,332,927 31,082,496 82 Linux swap / Solaris




"blkid" output: __________________________________________________ ______________


Device UUID TYPE LABEL


/dev/sda1 e3756989-8f81-a948-bf69-aa077a415c3f linux_raid_member tarvalon:0
/dev/sdb1 e3756989-8f81-a948-bf69-aa077a415c3f linux_raid_member tarvalon:0
/dev/sdc1 e3756989-8f81-a948-bf69-aa077a415c3f linux_raid_member tarvalon:0
/dev/sdd1 e3756989-8f81-a948-bf69-aa077a415c3f linux_raid_member tarvalon:0
/dev/sde1 612df651-4420-4ea8-ac4c-2a201436f8c3 ext4
/dev/sde2 566923a1-778b-4f17-b656-11c5e6942eca swap


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


Device Mount_Point Type Options


/dev/sde1 / ext4 (rw,errors=remount-ro)




=========================== sde1/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 [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi


export menuentry_id_option


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 {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}


if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_msdos
insmod ext2
set root='hd4,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1 612df651-4420-4ea8-ac4c-2a201436f8c3
else
search --no-floppy --fs-uuid --set=root 612df651-4420-4ea8-ac4c-2a201436f8c3
fi
font="/usr/share/grub/unicode.pf2"
fi


if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/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
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-612df651-4420-4ea8-ac4c-2a201436f8c3' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='hd4,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1 612df651-4420-4ea8-ac4c-2a201436f8c3
else
search --no-floppy --fs-uuid --set=root 612df651-4420-4ea8-ac4c-2a201436f8c3
fi
linux /boot/vmlinuz-3.8.0-19-generic root=UUID=612df651-4420-4ea8-ac4c-2a201436f8c3 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.8.0-19-generic
}
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-612df651-4420-4ea8-ac4c-2a201436f8c3' {
menuentry 'Ubuntu, with Linux 3.8.0-19-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.8.0-19-generic-advanced-612df651-4420-4ea8-ac4c-2a201436f8c3' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='hd4,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1 612df651-4420-4ea8-ac4c-2a201436f8c3
else
search --no-floppy --fs-uuid --set=root 612df651-4420-4ea8-ac4c-2a201436f8c3
fi
echo 'Loading Linux 3.8.0-19-generic ...'
linux /boot/vmlinuz-3.8.0-19-generic root=UUID=612df651-4420-4ea8-ac4c-2a201436f8c3 ro quiet splash $vt_handoff
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.8.0-19-generic
}
menuentry 'Ubuntu, with Linux 3.8.0-19-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.8.0-19-generic-recovery-612df651-4420-4ea8-ac4c-2a201436f8c3' {
recordfail
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd4,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1 612df651-4420-4ea8-ac4c-2a201436f8c3
else
search --no-floppy --fs-uuid --set=root 612df651-4420-4ea8-ac4c-2a201436f8c3
fi
echo 'Loading Linux 3.8.0-19-generic ...'
linux /boot/vmlinuz-3.8.0-19-generic root=UUID=612df651-4420-4ea8-ac4c-2a201436f8c3 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.8.0-19-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='hd4,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1 612df651-4420-4ea8-ac4c-2a201436f8c3
else
search --no-floppy --fs-uuid --set=root 612df651-4420-4ea8-ac4c-2a201436f8c3
fi
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='hd4,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,msdos1 --hint-efi=hd4,msdos1 --hint-baremetal=ahci4,msdos1 612df651-4420-4ea8-ac4c-2a201436f8c3
else
search --no-floppy --fs-uuid --set=root 612df651-4420-4ea8-ac4c-2a201436f8c3
fi
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###


### BEGIN /etc/grub.d/30_os-prober ###
if [ "x${timeout}" != "x-1" ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep --interruptible 3 ; then
set timeout=0
fi
fi
fi
### END /etc/grub.d/30_os-prober ###


### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###


### 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 ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------


=============================== sde1/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>
# / was on /dev/sdb1 during installation
UUID=612df651-4420-4ea8-ac4c-2a201436f8c3 / ext4 errors=remount-ro 0 1
# swap was on /dev/sdb2 during installation
UUID=566923a1-778b-4f17-b656-11c5e6942eca none swap sw 0 0
--------------------------------------------------------------------------------


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


GiB - GB File Fragment(s)


8.235473633 = 8.842772480 boot/grub/grub.cfg 1
1.672271729 = 1.795588096 boot/initrd.img-3.8.0-19-generic 1
1.361434937 = 1.461829632 boot/vmlinuz-3.8.0-19-generic 1
1.672271729 = 1.795588096 initrd.img 1
1.672271729 = 1.795588096 initrd.img.old 1
1.361434937 = 1.461829632 vmlinuz 1
1.361434937 = 1.461829632 vmlinuz.old 1

carlwsnyder
September 8th, 2013, 01:27 AM
Have you actually done:
grub-install /dev/sdX/dev/sdX should be replaced with the proper device name for your SD. You should also make sure that your SDCard is pointed to by the EFI or BIOS as your first boot device.

If anything, the best method would be to disconnect every storage device from your system except your SD and your USB key during the operating system installation if you are not expecting to dual-boot or multi-boot your system.

Brian_Reuter
September 8th, 2013, 01:39 AM
Yes, I've done both of those things to no effect. I even removed every possible device and then reinstalled from scratch.

carlwsnyder
September 8th, 2013, 01:48 AM
Is your SD card called /dev/hd0 or /dev/sda1 ? From your error messages and inclusions, it isn't clear. You can also use fdisk -l (that is a lower case L for the option) to find out which device(s) are connected/partitioned and which are set to be bootable from a terminal command line.

Brian_Reuter
September 8th, 2013, 01:55 AM
The ext4 partition containing /boot is /dev/sda1 and the boot flag is set.
grub calls this (hd0,msdos1).

carlwsnyder
September 8th, 2013, 02:36 AM
GRUB should be installed to /dev/sda

Note: NOT /dev/sda1 for a proper GRUB installation.

Brian_Reuter
September 8th, 2013, 03:48 AM
Yes, grub is installed to /dev/sda. I did it exactly using the command you mentioned and it installed w/o error.

I'm fairly certain the issue is not grub's bootloader, as it loads properly and dumps me at the grub> prompt. It seems like the problem is that it cannot read grub.cnf, and gives the error I listed above (read/write outside hd0). I have no idea why it cannot read that file.

Brian_Reuter
September 8th, 2013, 05:29 AM
Solution:

Reinstalled one more time, partitioned my USB drive as 256MB to /boot, 15.7GB as /
Problem solved, even after updating and upgrading.

Theory:

The error message "attempt to read or write outside of disk" appears 3 times in the grub source code. All are when grub is forced to use CHS access of the boot device because LBA access is unavailable, and the file being accessed is not within the ~8GB addressable region of CHS. What I believe was happening was that, by either pure luck or design, the /boot structure was all being initially placed within the first 8GB of the 16GB partition I had originally used. When I did an upgrade, the new kernel/initrd combined with no doubt a call to update-grub by the package system, was pushing my grub.cfg outside of that 8GB region. Grub was then unable to read the file and was failing. I was able to boot only because vmlinuz/initrd happened to be within the first 8GB.

By allocating a 256MB partition for /boot, I'm guaranteed that no update will ever be outside 8GB and will thus always be bootable by grub. The rest of my / filesystem can go on a 15.7GB partition, as the linux kernel itself has no such limitations.

It is TBD if this is an issue specific to HP's BIOS which is unable to provide an emulated LBA access to removable disks, or if this is just a general problem with all BIOSes. I'm not knowledgeable about how that's done these days. Anyway I leave this for posterity to future victims, this is not the only way to solve this problem, but it's easy enough.

oldfred
September 8th, 2013, 05:30 AM
When I installed to a flash drive from a flash drive the hdX settings seemed to get confused. And UUID is supposed to override any incorrect hdX setting but it does not seem to always work with flash drives.

When booting from BIOS the drive you boot from is always hd0. But if you look at your grub menu, it is showing hd4 as suggested default.
While we never edit grub.cfg, I think you need to violate rules and edit to replace hd4 with hd0 for first boot stanza. Then a sudo update grub if it boots, and that should fix the rest and make it permanent.

Not sure what drive flash drive will mount from. maybe sde again?
#Normally we do not directly edit grub.cfg. Edit from live-CD/DVD/USB.
mount /dev/sde1 /mnt
gksu gedit /mnt/boot/grub/grub.cfg
#May have to do this first as it is write protected also:
sudo chmod +w /mnt/boot/grub/grub.cfg
#Or even this first:
sudo chmod 777 /mnt/boot/grub/grub.cfg

Brian_Reuter
September 8th, 2013, 05:43 AM
oldfred,

Yes I actually had tried that just to see if that was the problem but it did not help with this issue as I had UUIDs enabled. IF I turn those off (and I tried), then you are exactly right and I had that problem! Changing grub.cfg as you indicate did fix that. But of course when I ran "upgrade", it broke again. The failure looked pretty much the same, but entirely different root cause.

See my previous post for that, I think I'm all set now.

oldfred
September 8th, 2013, 03:09 PM
We have seen similar issues with some USB hard drives drives. But usually two things help. Once is to make sure BIOS is not in IDE mode and to have entire boot within the first 100GB. But your 8GB is the CHS limit with IDE.

My install to a flash drive I used gpt partitioning just to learn about gpt, but did install into a 8 GB root and 8GB data partition. So I have not had your particular issue, and my two systems are not HP.

Grub did have an official bug on very large drives over 500GB with just root where it also would not find files. But that supposed was fixed a long time ago.