LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-12-2009, 06:20 PM   #1
msc8127
Member
 
Registered: Jan 2009
Posts: 42

Rep: Reputation: 15
how to find kernel for distro to create grub entry


I just installed gentoo to the last remaining partition on one of my hard drives. That gives me (hd1,0) as swap, (hd1,1) as debian, (hd1,2) as FreeBsd, and (hd1,3) as gentoo. On my other hard drive I have vista (hd0,0).

When I boot up the computer all OS's show, and all will boot except Gentoo. The grub entry for gentoo is :

title Gentoo 2008r1
root (hd1,3)
chainloader +1

If my understanding of grub is correct, I need a line between root (hd1,3) and chainloader +1 for the kernel.

Can someone assist me with what information goes on that line, and how to find the specifics to the kernel for my gentoo installation to allow grub to boot into gentoo on startup?

If there is more information that I need to post, please tell me what commands to run from Debian and I will get the information posted.

Thank you for your help!

Last edited by msc8127; 03-12-2009 at 08:48 PM. Reason: funky typo
 
Old 03-12-2009, 08:41 PM   #2
scmbg
Member
 
Registered: Oct 2008
Location: Mexico City
Distribution: Fedora
Posts: 65

Rep: Reputation: 15
title Gentoo 2008r1
root (hd1,3)
chainloader +1

mmm... the last line looks like, the Windows entry in grub, except that "rootnoverify" is used.

Well if you see the others Linux opctions you need something like this

title Entry title
root HD and partition
kernel kernel-path and option
initrd initial RAM disk [to load modules]

----

Next, and example

title Gentoo Linux 2.6.24-r5
root (hd0,0)
kernel /boot/kernel-genkernel-x86-2.6.24-gentoo-r5 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/sda3 # you can tell the kernel where is the root [/]
initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r5

just need to replace the files with yours.
 
Old 03-12-2009, 08:50 PM   #3
msc8127
Member
 
Registered: Jan 2009
Posts: 42

Original Poster
Rep: Reputation: 15
how do I find those last two lines' data for my gentoo system?

Thanks for the reply!
 
Old 03-12-2009, 09:44 PM   #4
scmbg
Member
 
Registered: Oct 2008
Location: Mexico City
Distribution: Fedora
Posts: 65

Rep: Reputation: 15
mmm... this:

ramdisk=8192 real_root=/dev/sda3 # you can tell the kernel where is the root [/]

is not another line, is part of the second [kernel] line.

in the last line you passing the ram-disk path, usually is /boot/, you find it there, if you dont see this file, maybe you dont use the "genkernel" of gentoo, and you kernel dont need a ramdisk, and can start alone without any modules.

So this line:

initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r5

should not be used.
 
Old 03-12-2009, 09:56 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The gentoo grub entry expects that you installed grub (in gentoo) to the gentoo partition. If there isn't a grub boot loader on (hd1,3), it won't boot. If it isn't installed there, you could manually locate the gentoo kernel & initrd file in the grub shell, boot up to gentoo, and then run "grub-install /dev/sdb4" to install it there. Another option is to copy the gentoo boot stanza in the gentoo install's /boot/grub/menu.lst file and add it to the menu.lst file of your main grub distro. It is usually best to either chainload the other distro's or to update grub in only you first Linux distro.

The grub shell has auto-completion which helps to locate the kernel & initrd file and save you from having to type everything.

example booting Gentoo from the grub shell. Use the correct versions of course, or the shortcut.
kernel (hd1,3)/boot/vmlinuz-<version>
initrd (hd1,3)/boot/initrd-<version>
boot
 
Old 03-12-2009, 11:02 PM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
How are you booting, from the Grub in Debian?

If that's the case, all you need to do is mount whatever partition Gentoo is actually on and navigate to the /boot/ directory to find the vmlinuz file and /boot/grub to find the menu.lst for Grub and copy its entry to the Debian. I assume you are using Debian Grub to boot?
 
Old 03-13-2009, 01:38 PM   #7
msc8127
Member
 
Registered: Jan 2009
Posts: 42

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by yancek View Post
How are you booting, from the Grub in Debian?

If that's the case, all you need to do is mount whatever partition Gentoo is actually on and navigate to the /boot/ directory to find the vmlinuz file and /boot/grub to find the menu.lst for Grub and copy its entry to the Debian. I assume you are using Debian Grub to boot?
I installed Gentoo from the 2008r1 livecd and during it's installation it said that is was installing GRUB to the MBR.

At that point I figured it would overwrite the current GRUB on the MBR which was installed by debian that is booting Vista, Debian, and BSD.

However when I restarted after the Gentoo installation was completed I got the same boot options as what I had before (Debian GRUB).

So I logged into Debian and added what I posted in the initial post in this thread for Gentoo and that of course isn't letting me boot gentoo. That is where my confusion is coming from...what information I need for the Debian boot/grub/menu.lst that I need to get Gentoo to boot from Grub.

Gentoo shows up as a boot option, but it gets error 13 I believe when I select Gentoo, whereas vista, Debian and BSD all will boot with their current configurations.

Hopefully that all makes sense.
 
Old 03-13-2009, 07:27 PM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
Quote:
Grub Error 13 : Invalid or unsupported executable format
This error is returned if the kernel image being loaded is not recognized as Multiboot or one of the supported native formats (Linux zImage or bzImage, FreeBSD, or NetBSD).
Does the quote below mean you had all prior options at boot but NONE for Gentoo?? If that's the case, it would seem it did not install to mbr?

Quote:
However when I restarted after the Gentoo installation was completed I got the same boot options as what I had before (Debian GRUB).
You said you could boot into Debian so you could run 'fdisk -l' command to make sure of the Gentoo partition (if you don't know it), mount that partition in Debian and navigate to the /boot/grub/ directory to see if the files are there. If you find your Gentoo menu.lst, you could just copy its entry to Debian.


The entry for Gentoo in Debian you posted earlier (below) should work. No reason you can't chainload Linux. I would add (hd1,3) after chainloader but I'm not sure that's necessary. This obviously assumes that Gentoo is install on your second drive, fourth partition.

Quote:
title Gentoo 2008r1
root (hd1,3)
chainloader +1
I've never used Gentoo so I'm not sure if there is anyting unusual about its boot process?
 
Old 03-13-2009, 08:12 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Go get the bootinfoscript from sourceforge, run it and post the output. That way we'll have some actual data to discuss.
 
Old 03-14-2009, 09:32 AM   #10
msc8127
Member
 
Registered: Jan 2009
Posts: 42

Original Poster
Rep: Reputation: 15
Here's what I get from fdisk -l

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x1549f232

Device Boot Start End Blocks Id System
/dev/sda1 1 182 1461883+ 82 Linux swap / Solaris
/dev/sda2 183 19549 155565427+ 83 Linux
/dev/sda3 19550 28667 73240177+ a5 FreeBSD
/dev/sda4 28668 38913 82300995 83 Linux

Disk /dev/hdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8f8004b1

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 38914 312568832 7 HPFS/NTFS


In that the /dev/sda4 is the gentoo installation. I'll try chainloading it again.

When I initially rebooted the computer, no entry for gentoo showed up. At that point I went into Debian and added the lines listed in the first post for Gentoo. From there I got the error 13 when I selected Gentoo from the grub list.

On the boot info script I have that script downloaded to my desktop, but I'm still trying to figure out what to enter command wise to make it run.

the download page at sourceforge.net said as root to run /home/shane/boot_info_script27.sh but for whatever reason that doesn't work when I run that command as su

I'll keep trying to figure it back and will post the details if I do get it figured out.
 
Old 03-14-2009, 10:31 AM   #11
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,492

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
If your Gentoo is on sda4, your Grub entry for it in menu.lst should be:

root (hd0,3)

If that doesn't work, I would also suggest you keep trying to run the boot_info_script as it provides a lot more detailed info.
 
Old 03-14-2009, 11:08 AM   #12
msc8127
Member
 
Registered: Jan 2009
Posts: 42

Original Poster
Rep: Reputation: 15
debian:/home/shane# /home/shane/boot_info_script27.sh
bash: /home/shane/boot_info_script27.sh: No such file or directory

I guess I can't figure out what command runs the script. I've tried every variation I could find on google of running the script after downloading it to my desktop and I am having no luck getting it to work.

I am trying the command as su in terminal.

so, since i'm sure it's something obvious, what am I doing wrong?

Thank you!
 
Old 03-14-2009, 01:07 PM   #13
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
==========
so, since i'm sure it's something obvious, what am I doing wrong?
==========

msc8127:

There is nothing wrong with installing gentoo at the beginning of logical partition sdb4. what is wrong now is that your grub at the mbr and sda2 cannot point (cannot pass duty) to the gentoo kernel.

At the grub boot prompt, before timeout expires, press Esc or Tab, you'll be taken to a blue listing of "default O.S options", try create new entry for gentoo there, just to boot for that session, there are options for help offered by Grub at that stage, try F1, F2 etc, also "e" "o" and "O" capital O, as well as "b" to boot. Just take time to learn to take control of the options offered by grub at that stage.

Find out how to edit and create this new entry there:

root (hd0,3)
kernel /root/<gentoo-kernel> root=/dev/sdb4 ro
boot

there is no need for grub to chainload a linux kernel located within the same device, only when grub passes the duty to another bootloader like for example an ntloadr.sys to load an XP or non-linux kernel.

Note: editing at this prompt does not affect your menu.lst on the drive; at reboot the former record is restored.

If above entry cannot trigger your gentoo kernel waiting at /dev/sda4 you may again Ctl+Alt+Del and repeat the process by specifying another target drive, say:

root (hd0,4)
kernel /root/<gentoo-kernel root=/dev/sda5 ro
boot

If still no good, try to check your next line, the syntax of the kernel line, if your entry misses just one character to the name of gentoo kernel sitting at sda4 the latter will not acknowledge and will never boot. Usually, kernels are named as "linuz-2.26.xxxx-<architecture>-<blah>" or a link to it is created at the / usually named as "vmlinuz". Either of these names if found you can apply to the grub prompt.

Note: the entry for "initrd" should be after the kernel line. But if you have a good RAM there is no need to use initrd. You can compile an initrd later when things are going already and add the same to the gentoo entry at the menu.lst.

If you have not yet installed grub at gentoo you must install it now for it to become "grub-aware" but do not apply "grub-install" command in order not to change your current mbr.

If you want to back up your current MBR, just in case, at debian issue this command:

dd if=/dev/sda of=/boot/MYMBR bs=512 count=1

keep the mbr file safe, to be restored this way if needed:

dd if=/boot/MYMBR of=/dev/sda

I have tried fresh install slackware at the last slice of logical drive, without LILO and without grub, I used the Mint (@sda1) grub prompt (edit) to point at the slackware kernel, and indeed it triggered the new kernel. That's how good Grub is.

You can make it. Goodluck.

Hope this can help a bit.

Last edited by malekmustaq; 03-14-2009 at 01:19 PM.
 
Old 03-15-2009, 05:00 AM   #14
meierfra
LQ Newbie
 
Registered: Jun 2008
Posts: 20

Rep: Reputation: 1
If you downloaded the boot info script to your desktop, then you can run the script via

Code:
su -
bash /home/shane/Desktop/boot_info_script27.sh
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't find kernel - grub help please (long post...sorry) TreeDragon60 Fedora - Installation 6 03-15-2009 07:13 AM
Help me create a grub entry for slackware Raccoon1400 Slackware 6 05-21-2008 03:06 PM
cannot find entry.S file in Ubuntu kernel kernelchase Linux - Newbie 2 01-21-2008 03:02 PM
Cant find a linux base kernel to create my own OS johnux Linux - General 6 08-24-2006 10:40 AM
create init.d entry grimse Linux - Newbie 2 12-21-2004 07:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration