grub issue after moving a partition and modifying MBR


Results 1 to 5 of 5

Thread: grub issue after moving a partition and modifying MBR

  1. #1
    Join Date
    Apr 2009
    Posts
    11

    grub issue after moving a partition and modifying MBR

    I am in the process of building a multiboot system. Here is my tale of woe..

    I used the System Rescue CD to create the following partitions:

    hda1 for Knoppix 6.1 formatted for reiserfs
    hda2 for CentOs 5.3
    hda3 for grub
    hda4 extended partition
    hda5 swap
    hda6 for Ubuntu 9.04
    hda7 for Fat 32 data

    I then tried installing Knoppix and for some reason it would not recognize my hda1 reiserfs partition. According to some participants on the Knoppix forums, this is a common problem since "Knoppix is designed to be used as a live CD".

    I ended up using the entire disk for the install and blowing away my partitions. Oddly, Knoppix created two partitions: swap in hda1 and the Knoppix partition hda2.

    So, after the install, I went about recreating my original partitions. I had to use the System Rescue CD since Knoppix's partition editor kept on failing. I created a new swap partition in partition 5 and by editing Knoppix's /etc/fstab, I was able to get Knoppix to use that swap partition. I then deleted hda1. When I did that, the Knoppix partition remained at hda2, but was shown as the first partition. I had to use fdisk in expert mode to renumber the partition's correctly. After renumbering the partitions and moving the swap, Knoppix still booted correctly using the MBR that it created during the installation. Feeling exuberant, I then decided to use grub's multiboot features. So, I copied the grub partition and my menu.lst to the MBR and tried to boot.


    Code:
    mkdir /mnt/sda3
    mount /dev/sda3 /mnt/sda3
    mkdir /mnt/sda3/boot
    mkdir /mnt/sda3/boot/grub
    cp /usr/lib/grub/i386-pc/* /mnt/sda3/boot/grub
    
    root#grub
    grub>root (hd0,2)
    grub>setup (hd0)
    grub>reboot
    Here is the menu.lst that I created and placed on my grub partition.
    Code:
    color purple/black red/light-gray
    title Three Linux Multiboot System with one shared fat 32 data partition
    boot
    timeout 10
    default 0
    fallback 1
    fallback 5
    title Knoppix 6.1 @ hda1
    root (hd0,0)
    chainloader     +1
    
    title CentOS 5.3 @ hda2
    root (hd0,1)
    chainloader     +1
    
    #hda3 is the grub partition
    
    #hda4 is the extended parttition
    
    #hda5 is the common swap partition for all Linux
    
    title Ubuntu 9.0.4 @ hda 6
    root (hd0,5)
    
    #hda6 is the common fat32 data partition
    However, I get the following error when booting:

    Code:
    Booting 'knoppix 6.1 @ hda1
    root (hd0,0)
    Filesystem type is reiserfs, partition type 0x83
    chainloader + 1
    Error 13; Invalid or unsupported executable format
    press any key to continue
    From this display, it is obvious that my system is reading the boot code in the MBR, that is, it is reading my menu.lst file and not Knoppix's boot/grub/menu.lst file. But, I wanted to see what that looked like, so I then booted the System Rescue CD and mounted the Knoppix partition to take a look at its /boot/grub/menu.lst...

    Code:
    default 0
    timeout 30
    color cyan/blue white/blue
    title KNOPPIX
    root (hd0,0)
    kernel /boot/vmlinuz root=/dev/hda1 lang=us apm=power-off vga=791 nomce loglevel=0 quiet rw
    So, I rebooted to see if I could manually boot KNOPPIX using grub.

    At the grub prompt, I typed:

    Code:
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.28.5
    boot
    As the system booted, the screen filled with dmesg info and ended at:

    Code:
    No filesystem could mount root, tried reiserfs ext3 ext2 vfat iso9660 fuseblk
    Kernel panic - not syncing: VFS unable to mount root fs on unknown block (3,2)
    So, my question is, what needs to be modified to get my grub to boot Knoppix? I was able to boot Knoppix when it used its own boot loader (that was copied to the MBR). Obviously, I messed up things copying my grub and menu.lst to the MBR.

    If I issue the fdisk -lcommand, hda1 is shown as ID 83. From my research, reiserfs, ext3, ext2 are all shown as ID 83 partitions. There are only two entries in the /etc/fstab file, one for the floppy and one other that I can't quite recall as I am writing this.
    Last edited by justmgd; 06-09-2009 at 06:47 PM.

  2. #2
    Join Date
    Apr 2009
    Posts
    11

    Bailed

    After much frothing around and other failed installations and reboots, I decided to bail on this machine and do a simple one distro install with a separate data partition for backups.

    There were just too many anomalies. I installed a second distro on sda2 and got the exact same boot error. I tried to install a third distro on sda6 and it failed suggesting I had a bad CD drive or hard drive. Just wasting too much time...

  3. #3
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    Think you go about it the wrong way.

    You can use any Live CD to create the partitions. The best program to use is from the terminal. I use mainly cfdisk. When i check the partitions I use the command "fdisk -l".

    If your hard disk is recognised as hda you must be on a pretty old distro or one with an old kernel. Most modern distro should name your disk as sda.

    There is no need to format any of the partition. Let the installer format it for you. Many installers do not trust you.

    When you want to install a distro you activate its installer and tell the installer which partition it should install itself into. That is it.

    You can let every one install the boot loader in the MBR. This may cause some systems unbootable when you install the next but this is alright.

    When you finish you can ask Grub to boot all the systems in one operation.

    You don't let the installer to use the whole disk. You are supposed in command!
    Last edited by saikee; 06-12-2009 at 05:10 PM.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  4. #4
    Join Date
    Apr 2009
    Posts
    11

    Errors of my way...

    I think I finally found out how I should have fixed my problem with Knoppix. Since my last post, I started to build a multiboot system using the same methodology. I installed OpenBSD in sda1 and the FreeBSD in sda2. Grub boots those distros without issue. That system is still a work in progress and there are no issues with grub.

    However, I then took an old IBM R40 with XP on it and pared that system down to a 15gb partition. I then created two unformatted partitions, one in sda2 and one in sda6. Grub was on sda3 and swap on sda5. I copied the grub files to the MBR and created a menu.lst file to handle the boot selection.

    I then installed Ubuntu 9.04 on sda2. I was going to tell it to install its boot loader on its own partition, but I instead told it to install it in the MBR. As an exercise in learning grub, after the install, I wanted to use grub to recreate my MBR.

    I let Ubuntu boot so that I could see its boot selection. I logged onto Ubuntu, mounted the grub partition and copied the grub files again to the MBR.

    I then rebooted. Lo and behold, here is what I was greeted with when I selected the Ubuntu distro:

    File system type is ext2fs partition type is 0x83.

    I then rebooted from the System Rescue CD and mounted the Ubuntu to take a look at its /boot/grub/menu.lst file. I copied down the relevant info and then booted using the HDD grub menu.

    At the grub selections, I switched to the grub prompt and issued the following commands using an abbreviated kernel command:

    Code:
    root (hd0,1)
    kernel /boot/vmlinux-2.6.28-11-generic ro quiet splash
    initrd /boot/initrd.img-2.6.28-11-generic
    boot
    The Ubunutu splash screen appeared, but then screen fulls of text errors scrolled by. I then rebooted again and issued the full kernel command:

    Code:
    root (hd0,1)
    kernel /boot/vmlinux-2.6.28-11-generic root=UUID=57adf91b-354e-4699-8507-1517ccaafe47 ro quiet splash
    initrd /boot/initrd.img-2.6.28-11-generic
    boot
    Ubuntu booted correctly this time. See Saikee's first post in:

    http://www.justlinux.com/forum/showt...hreadid=152677

    I stumbled upon this when I came to the site to complete this post. Something else to learn: UUID.

    So, then I remembered that I needed to tell Ubuntu that it was bootable from its own partition. I am not sure that is the best way to explain it, but once again, from the grub prompt, I issued the following commands:

    Code:
    root (hd0,1)
    setup (hd0,1)
    I then rebooted and at the grub menu, chose Ubuntu. I was then met with the Ubuntu menu.lst and chose the main boot option. Ubuntu booted!

    At this point, I could go into the Ubuntu menu.lst and edit that to remove selections or tell Ubuntu to boot the first selection automatically.

    So, was that all I had to do to fix the Knoppix issue?

    Code:
    root (hd0,0)
    setup (hd0,0)
    Sigh...
    Last edited by justmgd; 07-02-2009 at 11:39 AM.

  5. #5
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    The commands
    Code:
    root (hd0,0)
    setup (hd0,0)
    instruct Grub that the root partition (the one that stores Grub and the kernel) is the 1st partition of the 1st disk, as Grub counts from zero.

    The setup statement is to set it inside the same partition. This makes the Linux "chainloadable" by any other Linux using commands
    Code:
    title Linux ins 1st partition of 1st disk
    root (hd0,0)
    chainloader +1
    If you setup at (hd0) that means the whole of the 1st hard disk which is the MBR. The Linux will boot directly when you power up the PC.

    Needless to say you can put any Grub from any Linux into the MBR.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •