PDA

View Full Version : [SOLVED] Help booting in grub



Googie2149
November 14th, 2010, 12:44 AM
I have been in the process of moving from Fedora 14 and finished installing. When I restarted, I got the grub command line. I have never used grub before (the grub boot loader has always been graphical in the past) so I have no idea what to type to boot to Ubuntu.

drs305
November 14th, 2010, 12:47 AM
I have been in the process of moving from Fedora 14 and finished installing. When I restarted, I got the grub command line. I have never used grub before (the grub boot loader has always been graphical in the past) so I have no idea what to type to boot to Ubuntu.

HiGoogie2149, Welcome to Ubuntu and the Ubuntu forums.

If you have a LiveCD or can boot into linux, go to this site, download and run the boot info srcript, and post the contents of the RESULTS.txt here. It will show where your boot files are located and give us a pretty good ideal of what needs to be done:
http://bootinfoscript.sourceforge.net

Googie2149
November 14th, 2010, 01:10 AM
I've been using the live CD. Here's the file:


Boot Info Script 0.55 dated February 15th, 2010

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

=> Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in
partition #6 for (,msdos6)/boot/grub.

sda1: __________________________________________________ _______________________

File system: ntfs
Boot sector type: Windows XP
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs: /boot.ini /ntldr /ntdetect.com /io.sys /MSDOS.SYS
/command.com

sda2: __________________________________________________ _______________________

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

sda5: __________________________________________________ _______________________

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

sda6: __________________________________________________ _______________________

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

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

Drive: sda ___________________ __________________________________________________ ___

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 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 214,843,812 214,843,750 7 HPFS/NTFS
/dev/sda2 214,845,438 312,580,095 97,734,658 5 Extended
/dev/sda5 214,845,440 215,820,287 974,848 82 Linux swap / Solaris
/dev/sda6 215,822,336 312,580,095 96,757,760 83 Linux


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/loop0 squashfs
/dev/ramzswap0 swap
/dev/sda1 C08C49A78C499934 ntfs Windows Xp
/dev/sda2: PTTYPE="dos"
/dev/sda5 5e108822-9435-421d-89db-454c9f9c40bb swap
/dev/sda6 ed17eddb-0188-4f98-8682-477cd1d6b308 ext4
/dev/sda: PTTYPE="dos"
error: /dev/sdb: No medium found

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

Device Mount_Point Type Options

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


================================ sda1/boot.ini: ================================

[boot loader]
timeout=0
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOW S
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn
C:\wubildr.mbr = "Ubuntu"

=========================== sda6/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 part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set ed17eddb-0188-4f98-8682-477cd1d6b308
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set ed17eddb-0188-4f98-8682-477cd1d6b308
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.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set ed17eddb-0188-4f98-8682-477cd1d6b308
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=ed17eddb-0188-4f98-8682-477cd1d6b308 ro quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set ed17eddb-0188-4f98-8682-477cd1d6b308
echo 'Loading Linux 2.6.35-22-generic ...'
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=ed17eddb-0188-4f98-8682-477cd1d6b308 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-22-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,msdos6)'
search --no-floppy --fs-uuid --set ed17eddb-0188-4f98-8682-477cd1d6b308
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set ed17eddb-0188-4f98-8682-477cd1d6b308
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set c08c49a78c499934
drivemap -s (hd0) ${root}
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 ###

=============================== sda6/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 nodev,noexec,nosuid 0 0
/dev/sda6 / ext4 errors=remount-ro 0 1
/dev/sda5 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

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


136.4GB: boot/grub/core.img
157.9GB: boot/grub/grub.cfg
149.8GB: boot/initrd.img-2.6.35-22-generic
110.9GB: boot/vmlinuz-2.6.35-22-generic
149.8GB: initrd.img
110.9GB: vmlinuz
=======Devices which don't seem to have a corresponding hard drive==============

sdb

drs305
November 14th, 2010, 01:32 AM
From the grub prompt, after a failed boot, if you type the following, do they return "grub.cfg"?


ls (hd0,6)/boot/grub/grub.cfg
ls /boot/grub/grub.cfg

Googie2149
November 14th, 2010, 01:46 AM
Both return the file.

drs305
November 14th, 2010, 01:49 AM
Try booting from the grub prompt:



set prefix=(hd0,6)/boot/grub
set root=(hd0,6)
linux /vmlinuz root=/dev/sda6 ro
initrd /initrd.img
boot

If it fails, provide the error message if possible. If it boots, run:

sudo update-grub

Googie2149
November 14th, 2010, 02:05 AM
When I type "initrd /initrd.img" I get this error:

error: couldn't read file.

drs305
November 14th, 2010, 02:16 AM
Is it possible your BIOS is limited to seeing only the first 137GB of the disk? When I was looking at your RESULTS.txt some of the files that are often updated exist beyond the 137GB limit. If you BIOS is restricted, those files won't be found until after the system boots. The problem is that the system won't boot without the files.

If you aren't sure, enter the BIOS setup during boot (normally by pressing the DEL or one of the Function keys). See if the BIOS identifies your drive as 137GB. Next, see if there is a setting to enable large files - the name and location of the setting varies with the motherboard/BIOS.

If you don't find anything that might help, but believe the issue might be a "large file" issue, try cleaning out your cache (sudo apt-get clean) and then purge/reinstall grub. This might place all the files in the first part of the disk. The other option is to create a /boot partition.

HOWTO: Purge and Reinstall Grub 2 from the Live CD (http://ubuntuforums.org/showthread.php?t=1581099)

I cannot guarantee this is the problem, but it's a possibility.

Googie2149
November 14th, 2010, 02:29 AM
I looked in the BIOS setup and it does show it as 137GB but I couldn't find any fixes for it. I have an old Dell Dimension 4100 that originally came with Windows ME. I'll see if there is a patch on the Dell website. If not, I'll try purging and reinstalling Grub.

drs305
November 14th, 2010, 02:43 AM
I looked in the BIOS setup and it does show it as 137GB but I couldn't find any fixes for it. I have an old Dell Dimension 4100 that originally came with Windows ME. I'll see if there is a patch on the Dell website. If not, I'll try purging and reinstalling Grub.

The best option would be to get a BIOS update.

The second best option would be to create a small boot partition near the start of the disk. It would take time to move your current partition (unless you could shrink your current partition to less than 130GB or so) and could create the boot partition in the first 137GB. The advantage would be that it's a permanent solution.

Another option would be to install Grub2 on a thumb drive, but you would have to always have it inserted and be the first to boot. The advantage would be that it's a permanent solution.

The reinstall might initially work but eventually some of the boot files might migrate outside the 137GB limit after updates.

Googie2149
November 14th, 2010, 02:47 AM
The BIOS updates seem to be for windows only. Do you think that installing WINE would work to make a set of floppies? And I can't boot from a USB drive normally. I can boot to one using a CD that I found a link to a long time ago (and need to re-find) that lets me boot to a USB or any drive. Wait, couldn't I use that to get to Windows and make the floppies if WINE doesn't work?

drs305
November 14th, 2010, 02:52 AM
The BIOS updates seem to be for windows only. Do you think that installing WINE would work to make a set of floppies?

Rather than install wine, you can restore a Windows bootloader from the LiveCD:


sudo apt-get install lilo
sudo lilo -M /dev/sda mbr
Don't worry about lilo warnings complaining about not being fully installed. You just need it to write to the MBR.

This should allow you to boot into Windows. You can fix the BIOS, then reboot the LiveCD and reinstall grub with this command. Note you do not include the partition number in the second command:

sudo mount /dev/sda6 /mnt
sudo grub-install --root-directory=/mnt /dev/sda

Googie2149
November 14th, 2010, 03:20 AM
It didn't fix the BIOS, so how would I make a boot partition?

Googie2149
November 14th, 2010, 03:45 AM
Can't I run an installer from inside Windows and make it use the same boot loader that Windows would use? I remember it doing that in an earlier release.

drs305
November 14th, 2010, 03:53 AM
I'm about to log off, so I don't have the time to give you the details - only the outline.

[Note that the option other than below is to reinstall Ubuntu and make a separate /boot partition first. Then install using manual partitioning to designate the /boot and / partitions.]

It appears your swap partition is within the first 137GB. I would use that as your new /boot partition. It will be simple since you don't have to move any partitions around.

Boot the LiveCd.
Open Gparted.
Unmount the swap partition.
Delete the swap partition.
Create a new partition in the unallocated space prior to sda6. This will be your new boot partition.
Mount your new /boot partition. (sudo mkdir /mnt/boot && sudo mount /dev/sdXY /mnt/boot) Change XY to the new values of the partition.
Mount your existing Ubuntu partition (sudo mount /dev/sda6 /mnt)
Copy the contents of the boot folder to the new boot partition. Note you won't have a "boot" folder, just the files within and subfolders (including grub).
At some point, shrink Ubuntu (sda6) a bit and create a new swap file at the end. Do this later.
Edit fstab, make it look like this. It would be better to use UUIDS. For now, make sure you have the correct location for /boot (it may not be sda5):


# /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 nodev,noexec,nosuid 0 0
/dev/sda6 / ext4 errors=remount-ro 0 1
/dev/sda5 /boot ext4 defaults 0 1
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

Save the file.

Reinstall Grub. This assumes /boot is on sda5 and Ubuntu is on sda6. These may have changed during repartitioning. Your Ubuntu partition (sda6) should be mounted on /mnt and your new /boot partition should be mounted on /mnt/boot before running the following command.


sudo grub-install --root-directory=/mnt /dev/sda

Good night.

Googie2149
November 14th, 2010, 04:46 AM
That solved it, thank you for the help!

drs305
November 14th, 2010, 12:43 PM
That solved it, thank you for the help!

Glad you have it working.

A few of follow-up items if you didn't do a reinstall:

1. Create a new swap partition. If you haven't already made a new one, you can shrink your Ubuntu partition by a GB or two and create a new swap partition with Gparted (Partition, New, linux-swap).

2. Once you have created a new swap partition, add it to fstab and then update your initrd file. Commands later.

3. Change your /etc/fstab entries to UUID. Although not required, identifying your partitions by either UUID or labels is a better option than identifying them by device, which can change (as you may have seen when you changed the partitions).

4. Run "sudo fdisk -l". If you get a "disks not in order message" and it bothers you, this error can be eliminated with fdisk. After fixing the order, you should check the device designations since they may have changed (sda7 may now be sda5, etc). If your fstab still lists device names, you would need to correct any changes.

Here are the commands to accomplish the above, after you have created the new swap partition:


gksu gedit /etc/fstab & # Open fstab for editing. The & allows you to keep using the same terminal window.
Check the new UUIDs:

sudo blkid -c /dev/null
Find the UUIDs for each partition listed in fstab and make the changes:
Example Old:

/dev/sda6 / ext4 errors=remount-ro 0 1
Example New:

UUID=ed17eddb-0188-4f98-8682-477cd1d6b308 / ext4 errors=remount-ro 0 1
Add the swap partition to fstab, with the correct UUID:

UUID=<new UUID> none swap sw 0 0
Save the fstab file.
Update the initrd image:


sudo update-initramfs -u

If the "sudo fdisk -l" command shows the table is not in disk order and you want to 'fix' it:


sudo fdisk /dev/sda
at the prompt, type the following letters
m (for help)
x (extra functionality - experts only)
f (fix)
w (write to disk and exit)
You may get a warning that devices are in use and the new table will be used at the next boot.

Run "sudo fdisk -l" once more and check that your fstab either doesn't contain device names (sdXY) or they are still correct.

Incorporate all the changes in G2:

sudo update-grub

I'll stop now... ;-)