Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: [SOLVED] Grub Error 2 while trying to boot into Gentoo

  1. #1
    Join Date
    Sep 2008
    Location
    USA Pacific Coast
    Beans
    68
    Distro
    Ubuntu

    [SOLVED] Grub Error 2 while trying to boot into Gentoo

    Hey everyone. I wanted to try out Gentoo to see what all the fuss was about, so I've installed it on a separate partition, and edited my menu.lst file within my Ubuntu partition. The goal is to use configfile to launch Gentoo's grub.conf file, and launch it from there.

    Here is how the relavent partitions are set up:

    Code:
    /dev/sda2   ubuntu (flagged bootable)
    /dev/sda4   gentoo (tried boot flagged/unflagged)
    Within grub, booting gentoo:
    Code:
    title Gentoo Linux
    configfile (hd0,3)/boot/grub/grub.conf
    With this, I'm getting "Grub Error 2: Bad file or directory type" when selecting that option. I've also tried using the interactive mode in grub, and it gives the same error for trying to autocomplete "configfile (hd0,3)/".

    Anyone have any idea what could be causing this? I haven't seen anything on the web or any forums.
    Last edited by Morrad; October 11th, 2008 at 05:57 AM.

  2. #2
    Join Date
    Nov 2007
    Location
    Ft. Lauderdale, FL
    Beans
    35
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Grub Error 2 while trying to boot into Gentoo

    I've never used "configfile" in Grub, so no idea here.

  3. #3
    Join Date
    Nov 2005
    Location
    Lilongwe, Malawi
    Beans
    349
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub Error 2 while trying to boot into Gentoo

    Morrad, could you please boot into your ubuntu system, open a terminal and post the output of the following commands:
    Code:
    sudo fdisk -l
    sudo blkid
    tail -n 40 /boot/grub/menu.lst
    cat /boot/grub/configfile
    That should provide information which will enable someone to help you. You may possibly have to get into your Gentoo partition for further information but we'll come to that.

    By the way, a very useful Australian wrote a very useful Guide to Grub.

    Cheers, Pat.
    It's never too late to have a happy childhood! (Bumper sticker - Zimbabwe)
    To mark your thread solved, go to Thread Tools and select Mark this thread as solved

  4. #4
    Join Date
    Sep 2008
    Location
    USA Pacific Coast
    Beans
    68
    Distro
    Ubuntu

    Re: Grub Error 2 while trying to boot into Gentoo

    Sure thing, Patb.

    Code:
    sudo fdisk -l
    
    320.0 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x70447044
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1       13731   110294226    7  HPFS/NTFS
    /dev/sda2   *       13732       20670    55737517+  83  Linux
    /dev/sda3           26796       38913    97337835    5  Extended
    /dev/sda4           20671       26795    49199062+  83  Linux
    /dev/sda5           28445       38913    84092211   83  Linux
    /dev/sda6           26796       27188     3156709+  82  Linux swap / Solaris
    /dev/sda7           27189       28444    10088788+  83  Linux
    
    Partition table entries are not in disk order
    Code:
    sudo blkid
    
    /dev/sda1: UUID="01C74CF9D583C9A0" LABEL="DSK1_VOL1" TYPE="ntfs" 
    /dev/sda5: LABEL="/home" UUID="0465644f-0560-4141-bb30-d4f46687c4be" SEC_TYPE="ext2" TYPE="ext3" 
    /dev/sda2: UUID="a7f98cb8-6953-49a2-b8fc-8047f05ad2de" TYPE="ext3" LABEL="ubuntu" 
    /dev/sda4: LABEL="gentoo" UUID="5edb7d82-75ef-428c-82af-16907d68982d" SEC_TYPE="ext2" TYPE="ext3" 
    /dev/sda6: TYPE="swap" LABEL="swap" UUID="fad1c708-6b5a-4a6c-a857-1377a0444a8c" 
    /dev/sda7: LABEL="/tmp" UUID="59defd57-f7e5-4a54-8dbd-f834d293692c" SEC_TYPE="ext2" TYPE="ext3"
    Code:
    sudo tail -n 51 /boot/grub/menu.lst
    
    title Ubuntu 8.04, kernel 2.6.24-19-generic
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=a7f98cb8-6953-49a2-b8fc-8047f05ad2de ro
    initrd /boot/initrd.img-2.6.24-19-generic
    savedefault
    makeactive
    
    title Gentoo 2008.0
    title=Gentoo Linux
    configfile (hd0,3)/boot/grub/grub.conf
    
    title Windows XP Professional x64 Edition
    root (hd0,0)
    chainloader +1
    
    title Ubuntu 8.04, kernel 2.6.24-19-generic (recovery mode)
    root (hd0,1)
    kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=a7f98cb8-6953-49a2-b8fc-8047f05ad2de ro single
    initrd /boot/initrd.img-2.6.24-19-generic
    
    title Ubuntu 8.04, memtest86+
    root (hd0,1)
    kernel /boot/memtest86+.bin
    
    title Other operating systems:
    
    title Ubuntu 8.04.1, kernel 2.6.24-19-generic
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=a7f98cb8-6953-49a2-b8fc-8047f05ad2de ro quiet splash
    initrd /boot/initrd.img-2.6.24-19-generic
    
    title Ubuntu 8.04.1, kernel 2.6.24-19-generic (recovery mode)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=a7f98cb8-6953-49a2-b8fc-8047f05ad2de ro single
    initrd /boot/initrd.img-2.6.24-19-generic
    
    title Ubuntu 8.04.1, kernel 2.6.24-16-generic
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=a7f98cb8-6953-49a2-b8fc-8047f05ad2de ro quiet splash
    initrd /boot/initrd.img-2.6.24-16-generic
    
    title Ubuntu 8.04.1, kernel 2.6.24-16-generic (recovery mode)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=a7f98cb8-6953-49a2-b8fc-8047f05ad2de ro single
    initrd /boot/initrd.img-2.6.24-16-generic
    
    title Ubuntu 8.04.1, memtest86+
    root (hd0,0)
    kernel /boot/memtest86+.bin
    Code:
    cat /boot/grub/configfile
    
    cat: /boot/grub/configfile: No such file or directory
    EDIT:
    Actually, now that I think about it, I don't have any grub command files in my /boot/grub/ directory. I know I haven't deleted anything in there, so I'm going to venture a guess that that isn't my issue then.
    Last edited by Morrad; October 11th, 2008 at 06:41 PM.

  5. #5
    Join Date
    Nov 2005
    Location
    Lilongwe, Malawi
    Beans
    349
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub Error 2 while trying to boot into Gentoo

    Thanks Morrad. Grub is looking for a configuration file at (hd0,3)/boot/grub/grub.conf (sorry, I didn't read your first post closely enough to work that out). This file might not exist, which would perhaps account for the grub error you are getting. To check, look in the directory where /dev/sda4 (not sda3) is mounted. If it is not mounted or you have trouble finding it try:
    Code:
    sudo mkdir /media/sda4/
    sudo mount /dev/sda4 /media/sda4
    cat /media/sda4/boot/grub/grub.conf
    This will show you whether grub.conf exists where Grub is looking for it.

    Also, I've never used Gentoo but you can probably back up and edit your menu.lst file to follow the same pattern as for your Ubuntu option.
    Code:
    sudo cp /boot/grub/menu.lst /boot/grub/menu.bk1
    sudo gedit /boot/grub/menu.lst
    Edit the Gentoo entry to look something like the code below. Check the exact name of the kernel files in the directory /media/sda4/boot/ and replace the x's accordingly. (Note that I have already used the corrrect UUID).
    Code:
    title Gentoo
    kernel /boot/vmlinuz-xxxxxxxx root=UUID=5edb7d82-75ef-428c-82af-16907d68982d ro
    initrd /boot/initrd.img-xxxxxxxx
    savedefault
    makeactive
    In this setup, grub will ignore any /boot/grub/grub.conf file that might exist in the Gentoo partition, which might have its own problems. But at least then you can perhaps work out from the config file what Grub is trying to do; or post the contents if you can't work it out. Let us know how you go.

    Hope this helps. Cheers, Pat.
    Last edited by Patb; October 12th, 2008 at 12:59 AM.
    It's never too late to have a happy childhood! (Bumper sticker - Zimbabwe)
    To mark your thread solved, go to Thread Tools and select Mark this thread as solved

  6. #6
    Join Date
    Sep 2008
    Location
    USA Pacific Coast
    Beans
    68
    Distro
    Ubuntu

    Thumbs down Re: Grub Error 2 while trying to boot into Gentoo

    Thank you, Patb, for coming back to check on me. I believe you are mistaken about the source of my difficulty, however.

    My understanding is that that (hdx,y) refers to hard drive x+1, partition y+1, so (hd0,3) really is looking at /dev/sda4 as it should. The grub guide you shared (which is quite nice, by the way, thanks) explains this here.

    Previously, in my own problem solving, I have mounted the gentoo partition, and I can verify that /boot/grub/grub.conf does indeed exist and is the correct file to point to, akin to Ubuntu's menu.lst file.

    I've also tried the alternative approach you mentioned, having ubuntu's grub look directly for the gentoo kernel as you've described, by I will give that a try again. I don't think I tried the "savedefault" and "makeactive" commands previously. I'll update in a little bit with my results.

  7. #7
    Join Date
    Nov 2007
    Location
    Ft. Lauderdale, FL
    Beans
    35
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Grub Error 2 while trying to boot into Gentoo

    I've done a multiboot setup on my system for some time, using my Gentoo partition's grub.conf to load my Ubuntu (or Debian, now) kernel and root. Here are the relevant parts of my grub.conf:

    Code:
    # For booting Gentoo with suspend
    title  Gentoo Linux 2.6.25-protect-r7 (fb+ suspend+)
    root (hd0,0)
    kernel /kernel-2.6.25-protect-r7.1 root=/dev/sda5 video=uvesafb:1280x800-32,mtrr:3,ywrap acpi_sleep=s3_bios fbcon=scrollback:128K splash=fadein,silent,theme:natural_gentoo CONSOLE=/dev/tty1 resume=/dev/mapper/crypt-swap-hd
    initrd /boot/fbsplash-natural_gentoo-1280x800
    
    #<snipping out some different Gentoo options>
    
    # For booting Debian
    title  Debian GNU/Linux Sid
    root (hd0,7)
    kernel /vmlinuz root=/dev/sda8
    initrd /initrd.img
    If the above didn't make sense, I've got my Gentoo /boot on sda1, Gentoo / (root) on sda5, and my whole Debian system (/boot and all) on sda8. Doing something like that, to have your Ubuntu menu.lst boot Gentoo directly (rather than call Gentoo's grub.conf), may be easier.

  8. #8
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: Grub Error 2 while trying to boot into Gentoo

    How about rebooting, and when you get the grub menu, press "c" for the command line, and then type:
    Code:
    grub> cat (hd0,3)/
    Then press TAB for tab-completion, and it should list your Gentoo root directory. If that works, proceed to the boot directory:
    Code:
    grub> cat (hd0,3)/boot/
    Again press TAB. If that works do the grub directory:
    Code:
    grub> cat (hd0,3)/boot/grub/
    TAB, and if it shows your grub.conf, do:
    Code:
    grub> cat (hd0,3)/boot/grub/grub.conf
    and hit enter this time. Does it show your grub.conf?

  9. #9
    Join Date
    Sep 2008
    Location
    USA Pacific Coast
    Beans
    68
    Distro
    Ubuntu

    Re: Grub Error 2 while trying to boot into Gentoo

    Hmm. No good trying to boot gentoo directly. Here's what I was trying.

    I appologize, I'm on my laptop staring at my grub screen, so I don't want to type in the actual numbers.
    Code:
    title Gentoo
    root(hd0,3)
    kernel /boot/kernel-genkernel-####### root=UUID=(hex ID for /dev/sda4) ro
    initrd /boot/initramfs-genkernel-#######
    makeactive
    Interesting find while messing with grub's command line though. I decided to see if grub could even see the linux kernel in

    Code:
    find /vmliuz
    
    (hd0,1)
    So it only sees a linux kernel in my ubuntu partition then.

  10. #10
    Join Date
    Sep 2008
    Location
    USA Pacific Coast
    Beans
    68
    Distro
    Ubuntu

    Re: Grub Error 2 while trying to boot into Gentoo

    Quote Originally Posted by caljohnsmith View Post
    How about rebooting, and when you get the grub menu, press "c" for the command line, and then type:
    Code:
    grub> cat (hd0,3)/
    Then press TAB for tab-completion, and it should list your Gentoo root directory. If that works, proceed to the boot directory:
    I get an error:
    Code:
    Error 2: Bad file or directory type.

    EDIT:
    I've gotten this error whenever trying to do any autocompletes for files not in my Ubuntu '/' partition in /dev/sda2, by the way.
    Last edited by Morrad; October 12th, 2008 at 02:18 AM.

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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