PDA

View Full Version : [ubuntu] Problem with Grub - not booting and can't upgrade grub



vocoder42
November 7th, 2012, 05:10 PM
When I reboot my server, it always says something like OS not found. If I boot from a livecd and select 'boot from first disk' it will boot into ubuntu server 12.04 without issue.

after a recent apt-get upgrade, grub was updated but it comes back with the error:

warn: Attempting to install GRUB to a partitionless disk or to a partition. This is a BAD idea..
warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
error: will not proceed with blocklists.

how can I fix this? here is part of my boot info 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 (,msdos1)/grub on this drive.

sda1: __________________________________________________ ________________________

File system: ext2
Boot sector type: Grub2 (v1.97-1.98)
Boot sector info: Grub2 (v1.97-1.98) is installed in the boot sector of
sda1 and looks at sector 78954 of the same hard drive
for core.img, but core.img can not be found at this
location.
Operating System:
Boot files: /grub/grub.cfg /grub/core.img /boot/grub/core.img

sda2: __________________________________________________ ________________________

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

sda5: __________________________________________________ ________________________

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

dev-root': __________________________________________________ ___________________

File system:
Boot sector type: Unknown
Boot sector info:
Mounting failed: mount: unknown filesystem type ''

dev-swap_1': __________________________________________________ _________________

File system:
Boot sector type: Unknown
Boot sector info:
Mounting failed: mount: unknown filesystem type ''
mount: unknown filesystem type ''

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

Drive: sda __________________________________________________ ___________________

Disk /dev/sda: 1200.3 GB, 1200264314880 bytes
64 heads, 32 sectors/track, 1144661 cylinders, total 2344266240 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 499,711 497,664 83 Linux
/dev/sda2 501,758 2,344,265,727 2,343,763,970 5 Extended
/dev/sda5 501,760 2,344,265,727 2,343,763,968 8e Linux LVM


"blkid" output: __________________________________________________ ______________

Device UUID TYPE LABEL

/dev/mapper/dev-root 4aee45a5-befc-437d-ae5f-7153b7b95c19 ext4
/dev/mapper/dev-swap_1 62c7010d-d69b-4448-9abb-1160435b5181 swap
/dev/sda1 b16fe7a4-0d99-4df9-978c-f117c6981624 ext2
/dev/sda5 ImPJQS-3i1J-MvCe-M0XQ-Rgpa-KWgO-rE5y7j LVM2_member
/dev/sr0 iso9660 Ubuntu-Server 10.04.1 LTS i386

========================= "ls -R /dev/mapper/" output: =========================

/dev/mapper:
control
dev-root
dev-swap_1

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

Device Mount_Point Type Options

/dev/mapper/dev-root / ext4 (rw,errors=remount-ro)
/dev/sda1 /boot ext2 (rw)


============================= sda1/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 lvm
insmod part_msdos
insmod ext2
set root='(dev-root)'
search --no-floppy --fs-uuid --set=root 4aee45a5-befc-437d-ae5f-7153b7b95c19
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
set locale_dir=($root)/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 'Ubuntu, with Linux 3.2.0-30-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
linux /vmlinuz-3.2.0-30-generic root=/dev/mapper/dev-root ro quiet
initrd /initrd.img-3.2.0-30-generic
}
menuentry 'Ubuntu, with Linux 3.2.0-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
echo 'Loading Linux 3.2.0-30-generic ...'
linux /vmlinuz-3.2.0-30-generic root=/dev/mapper/dev-root ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-3.2.0-30-generic
}
submenu "Previous Linux versions" {
menuentry 'Ubuntu, with Linux 2.6.32-42-server' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
linux /vmlinuz-2.6.32-42-server root=/dev/mapper/dev-root ro quiet
initrd /initrd.img-2.6.32-42-server
}
menuentry 'Ubuntu, with Linux 2.6.32-42-server (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
echo 'Loading Linux 2.6.32-42-server ...'
linux /vmlinuz-2.6.32-42-server root=/dev/mapper/dev-root ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-2.6.32-42-server
}
menuentry 'Ubuntu, with Linux 2.6.32-41-server' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
linux /vmlinuz-2.6.32-41-server root=/dev/mapper/dev-root ro quiet
initrd /initrd.img-2.6.32-41-server
}
menuentry 'Ubuntu, with Linux 2.6.32-41-server (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
echo 'Loading Linux 2.6.32-41-server ...'
linux /vmlinuz-2.6.32-41-server root=/dev/mapper/dev-root ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-2.6.32-41-server
}
menuentry 'Ubuntu, with Linux 2.6.32-40-server' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
linux /vmlinuz-2.6.32-40-server root=/dev/mapper/dev-root ro quiet
initrd /initrd.img-2.6.32-40-server
}
menuentry 'Ubuntu, with Linux 2.6.32-40-server (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
echo 'Loading Linux 2.6.32-40-server ...'
linux /vmlinuz-2.6.32-40-server root=/dev/mapper/dev-root ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-2.6.32-40-server
}
menuentry 'Ubuntu, with Linux 2.6.32-38-server' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
linux /vmlinuz-2.6.32-38-server root=/dev/mapper/dev-root ro quiet
initrd /initrd.img-2.6.32-38-server
}
menuentry 'Ubuntu, with Linux 2.6.32-38-server (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
echo 'Loading Linux 2.6.32-38-server ...'
linux /vmlinuz-2.6.32-38-server root=/dev/mapper/dev-root ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-2.6.32-38-server
}
menuentry 'Ubuntu, with Linux 2.6.32-21-server' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
linux /vmlinuz-2.6.32-21-server root=/dev/mapper/dev-root ro quiet
initrd /initrd.img-2.6.32-21-server
}
menuentry 'Ubuntu, with Linux 2.6.32-21-server (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
echo 'Loading Linux 2.6.32-21-server ...'
linux /vmlinuz-2.6.32-21-server root=/dev/mapper/dev-root ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-2.6.32-21-server
}
}
### 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,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
linux16 /memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root b16fe7a4-0d99-4df9-978c-f117c6981624
linux16 /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/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 ###
--------------------------------------------------------------------------------

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

GiB - GB File Fragment(s)

0.142247200 = 0.152736768 boot/grub/core.img 2
0.032884598 = 0.035309568 grub/core.img 2
0.042098045 = 0.045202432 grub/grub.cfg 3
0.021048546 = 0.022600704 initrd.img-2.6.32-21-server 39
0.037429810 = 0.040189952 initrd.img-2.6.32-38-server 47
0.060047150 = 0.064475136 initrd.img-2.6.32-40-server 38
0.083660126 = 0.089829376 initrd.img-2.6.32-41-server 40
0.097358704 = 0.104538112 initrd.img-2.6.32-42-server 55
0.126993179 = 0.136357888 initrd.img-3.2.0-30-generic 63
0.009683609 = 0.010397696 vmlinuz-2.6.32-21-server 18
0.021489143 = 0.023073792 vmlinuz-2.6.32-38-server 19
0.051209450 = 0.054985728 vmlinuz-2.6.32-40-server 19
0.064984322 = 0.069776384 vmlinuz-2.6.32-41-server 19
0.079745293 = 0.085625856 vmlinuz-2.6.32-42-server 19
0.090455055 = 0.097125376 vmlinuz-3.2.0-30-generic 22

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

Unknown BootLoader on dev-root'


Unknown BootLoader on dev-swap_1'



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

xz: (stdin): Compressed data is corrupt
One or more specified logical volume(s) not found.
One or more specified logical volume(s) not found.
One or more specified logical volume(s) not found.
hexdump: /dev/mapper/dev-root': No such file or directory
hexdump: /dev/mapper/dev-root': No such file or directory
One or more specified logical volume(s) not found.
One or more specified logical volume(s) not found.
One or more specified logical volume(s) not found.
hexdump: /dev/mapper/dev-swap_1': No such file or directory
hexdump: /dev/mapper/dev-swap_1': No such file or directory

darkod
November 7th, 2012, 05:51 PM
You see that you also have a grub install on the partition sda1. It seems it tried to upgrade/use that one as primary, hence the message it's not recommended to install onto partitions.

Boot the system once since you can boot it by selecting "boot from first disk", open terminal and try reconfiguring grub-pc with:
sudo dpkg-reconfigure grub-pc

Use the Space bar to deselect sda1 and any other partition, leave only /dev/sda as selected (the MBR of the disk).

After that, to make sure you have the correct grub on the MBR (it seems to boot fine, but just in case), you can do:
sudo grub-install /dev/sda