LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   Problems booting from USB HD using grub 0.97 (http://www.linuxquestions.org/questions/red-hat-31/problems-booting-from-usb-hd-using-grub-0-97-a-874839/)

gunhed 04-13-2011 02:52 PM

Problems booting from USB HD using grub 0.97
 
I have a working server running CentOS 5.5 (similar to RedHat EL) with the 2.6.18-194.el5 kernel. The hardware is a few years old, but we were able to accomplish this following goal using CentOS 4.4. What I'm trying to do is to back the system up to an external USB hard drive such that it can be booted from for recovery or to then take that drive and restore its contents to a second server with identical hardware. We have been successful implementing this on other server pairs, but I'm having a great deal of trouble getting this to work on this hardware and OS. I'm not using LVM or dual-booting with another OS.

The USB drive is set up with identical partitions to the RAID set, and all the files have been successfully copied over, but I can't get the system to boot from it. Below is what I get when trying to boot from the USB drive:

Code:

  Booting 'CentOS (2.6.18-194.el5)'
root (hd0,0)
  Filesystem type is ext2fs, partition type 0x83
kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/
Error 13: Invalid or unsupported executable format
Press any key to continue...

I saw that the 'root=LABEL=/' is wrong for the USB drive, so I entered the menu and edited that entry to read 'root=LABEL=/root-backup' and tried again, but got the same results.

Here are the config files and details:
The RAID set is on /dev/i2o/hda.
The USB drive is /dev/sda.

I used the Boot Info Script (http://sourceforge.net/projects/bootinfoscript/) to provide some helpful info for troubleshooting. Everything looks right to me, but I don't have a lot of experience with grub. Here are the script's results:

Code:

                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 boot drive #2
    in partition #1 for /grub/stage2 and /grub/grub.conf.

sda1: _________________________________________________________________________

    File system:      ext3
    Boot sector type:  -
    Boot sector info:
    Operating System:
    Boot files/dirs:  /grub/menu.lst /grub/grub.conf

sda2: _________________________________________________________________________

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

sda3: _________________________________________________________________________

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

sda4: _________________________________________________________________________

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

sda5: _________________________________________________________________________

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

sda6: _________________________________________________________________________

    File system:      ext3
    Boot sector type:  -
    Boot sector info:
    Operating System:  System started from backup
                      drive
    Boot files/dirs:  /etc/fstab

=========================== 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


Partition  Boot        Start          End          Size  Id System

/dev/sda1    *            63      208,844      208,782  83 Linux
/dev/sda2            208,845    42,154,559    41,945,715  83 Linux
/dev/sda3          42,154,560    52,645,004    10,490,445  83 Linux
/dev/sda4          52,645,005  143,364,059    90,719,055  5 Extended
/dev/sda5          52,645,068    56,837,969    4,192,902  82 Linux swap / Solaris
/dev/sda6          56,838,033  143,364,059    86,526,027  83 Linux


blkid -c /dev/null: ____________________________________________________________

Device          UUID                                  TYPE      LABEL

/dev/fd0        4DA3-6E16                              vfat
/dev/i2o/hda1    d4102e9e-cb0f-48cb-b0dd-8cb4afccc7c2  ext3      /boot
/dev/i2o/hda2    aa1fb026-9136-4ae6-9968-29250349cc54  ext3      /var
/dev/i2o/hda3    bcd15ed4-c686-4ea3-b978-54121b246436  ext3      /tmp
/dev/i2o/hda5                                          swap      SWAP-i2o/hda5
/dev/i2o/hda6    fdf74837-2a62-4a10-9d78-5a639ec1ec51  ext3      /
/dev/sda1        0d189538-02b4-4b0f-bc15-32a13d953aea  ext3      /boot-backup
/dev/sda2        a30423a3-cc66-4c31-aab5-d59b3cf4646c  ext3      /var-backup
/dev/sda3        7388a479-9371-4868-9cef-1fe7e0293268  ext3      /tmp-backup
/dev/sda5                                              swap      SWAP-backup
/dev/sda6        cd6b03be-9a85-4a6a-b556-6f98d4aee380  ext3      /root-backup

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

Device          Mount_Point              Type      Options

/dev/i2o/hda6    /                        ext3      (rw)
/dev/i2o/hda3    /tmp                    ext3      (rw)
/dev/i2o/hda2    /var                    ext3      (rw)
/dev/i2o/hda1    /boot                    ext3      (rw)


============================= sda1/grub/menu.lst: =============================

default=0
timeout=5
hiddenmenu
title CentOS (2.6.18-194.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/root-backup
        initrd /initrd-2.6.18-194.el5.img

============================= sda1/grub/grub.conf: =============================

default=0
timeout=5
hiddenmenu
title CentOS (2.6.18-194.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/root-backup
        initrd /initrd-2.6.18-194.el5.img

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


    .0GB: grub/grub.conf
    .0GB: grub/menu.lst
    .0GB: grub/stage2
    .0GB: initrd-2.6.18-194.el5.img
    .0GB: vmlinuz-2.6.18-194.el5

=============================== sda6/etc/fstab: ===============================

LABEL=/root-backup  /                      ext3    defaults        1 1
LABEL=/tmp-backup  /tmp                    ext3    defaults        1 2
LABEL=/var-backup  /var                    ext3    defaults        1 2
LABEL=/boot-backup  /boot                  ext3    defaults        1 2
tmpfs                  /dev/shm                tmpfs  defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                  /sys                    sysfs  defaults        0 0
proc                    /proc                  proc    defaults        0 0
LABEL=SWAP-backup  swap                    swap    defaults        0 0
/dev/fd0                /media/floppy          auto    pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
=========================== Unknown MBRs/Boot Sectors/etc =======================

Unknown BootLoader  on sda4                           

00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ||
*
00000020  ff ff ff ff ff ff f0 00  00 00 00 0f ff ff ff ff  |.....|
00000030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ||
*
00000050  ff ff ff ff ff ff ff ff  ff ff 0f ff ff ff ff ff  |.|
00000060  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ||
*
00000080  ff ff ff ff ff ff ff ff  ff f0 00 ff ff ff ff ff  |.|
00000090  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ||
*
000000b0  ff ff ff ff ff ff ff ff  ff 00 00 0f ff ff ff ff  |...|
000000c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ||
*
000000e0  ff ff ff ff ff ff ff ff  ff ff 0f ff ff ff ff ff  |.|
000000f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ||
*
00000110  ff ff ff ff ff ff ff ff  ff ff 0f ff ff ff ff ff  |.|
00000120  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ||
*
00000140  ff ff ff ff ff ff ff ff  ff ff 0f ff ff ff ff ff  |.|
00000150  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ||
*
00000170  ff ff ff ff ff ff ff ff  ff ff 0f ff ff ff ff ff  |.|
00000180  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  ||
*
000001a0  ff ff ff ff ff ff ff ff  ff ff 0f ff ff ff ff ff  |.|
000001b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff 00 fe  |.|
000001c0  ff ff 82 fe ff ff 3f 00  00 00 86 fa 3f 00 00 fe  |.?....?..|
000001d0  ff ff 05 fe ff ff c5 fa  3f 00 8a 48 28 05 00 00  |.?..H(...|
000001e0  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==============
       
hdc   
=============================== StdErr Messages: ===============================

  /dev/hdc: open failed: No medium found
mdadm: No arrays found in config file


onebuck 04-15-2011 07:31 AM

Moved: This thread is more suitable in <Red Hat> and has been moved accordingly to help your thread/question get the exposure it deserves.

gunhed 04-15-2011 08:29 AM

Thanks, onebuck. I wasn't sure where to put this. Hopefully, some experienced folks out there can help me out with this one.

gunhed 04-18-2011 03:06 PM

Alternatively... a boot floppy?
 
I'm still having no luck with booting from the USB drive, however, something that has been done in the past was to create a boot floppy with grub installed on it that would then boot from the USB drive. I've made an attempt or two at this, but I'm not getting anywhere. It seems to still be trying to boot from the RAID set, yet fails even that.

Can anyone give me some pointers on properly configuring grub for the floppy to load the OS on the USB drive?

gunhed 04-19-2011 09:14 AM

I've gotten to a point booting from the USB drive, and it fails. Here is the last bit of activity from the screen:

Code:

Scanning and configuring dmraid supported devices
Trying to resume from LABEL=SWAP-i2o/hda5
No suspend signature on swap, not resuming.
Creating root device.
Mounting root filesystem.
mount: could not find filesystem '/dev/root'
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: moving /proc failed: No such file or directory
setuproot: moving /sys failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!

First off, it looks like "LABEL=SWAP-i2o/hda5" is incorrect - I'm not wanting to involve the RAID set when booting from USB, so somehow this is wrong, yet it's not the main problem.

For whatever reason, it can't find the root partition on the USB drive, so it freaks out. After many attempts to configure grub, fstab and other files, I can't train it to boot properly.

Any ideas on where I need to look next?

gunhed 04-19-2011 01:58 PM

I recently had a friend pass on this link:
http://fungliding.blogspot.com/2005_...g_archive.html

I'm trying to use this as a method to build a boot floppy to then start the boot process on the USB drive.

I've gotten a little (?) further, I think, but it still fails. This opens up a few more avenues to explore. I never knew that the initrd file could be de-constructed and reconfigured, so that helped a bit, but the only thing that changed from the previous result is choosing the correct swap label (however, it couldn't find it). Below is my current init file so far:

Code:

#!/bin/nash

setquiet
echo Preparing to boot from USB drive...
mount -t proc /proc /proc
echo Mounting proc filesystem
echo Mounting sysfs filesystem
mount -t sysfs /sys /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/urandom c 1 9
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/rtc c 10 135
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
mknod /dev/tty5 c 4 5
mknod /dev/tty6 c 4 6
mknod /dev/tty7 c 4 7
mknod /dev/tty8 c 4 8
mknod /dev/tty9 c 4 9
mknod /dev/tty10 c 4 10
mknod /dev/tty11 c 4 11
mknod /dev/tty12 c 4 12
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/ttyS3 c 4 67
echo Setting up hotplug.
hotplug
echo Creating block device nodes.
mkblkdevs
echo "*** Loading usb-storage ***"
insmod /lib/usb-storage.ko
echo "Loading ehci-hcd.ko module"
insmod /lib/ehci-hcd.ko
echo "Loading ohci-hcd.ko module"
insmod /lib/ohci-hcd.ko
echo "Loading uhci-hcd.ko module"
insmod /lib/uhci-hcd.ko
mount -t usbfs /proc/bus/usb /proc/bus/usb
echo "*** Sleeping 5 seconds ***"
/bin/sleep 5
echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko
echo "Loading i2o_core.ko module"
insmod /lib/i2o_core.ko
echo "Loading i2o_block.ko module"
insmod /lib/i2o_block.ko
echo "Loading dm-mem-cache.ko module"
insmod /lib/dm-mem-cache.ko
echo "Loading dm-mod.ko module"
insmod /lib/dm-mod.ko
echo "Loading dm-log.ko module"
insmod /lib/dm-log.ko
echo "Loading dm-region_hash.ko module"
insmod /lib/dm-region_hash.ko
echo "Loading dm-message.ko module"
insmod /lib/dm-message.ko
echo "Loading dm-raid45.ko module"
insmod /lib/dm-raid45.ko
mkblkdevs
echo Scanning and configuring dmraid supported devices
resume LABEL=SWAP-backup
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro sda6
echo "*** Reread partition table ***"
/sbin/sfdisk -R /dev/sda
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot

Any ideas on why it still can't find my root partition in the USB drive?


All times are GMT -5. The time now is 04:59 AM.