LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   PROBLEM with grub and my newly compiled kernel! (http://www.linuxquestions.org/questions/linux-newbie-8/problem-with-grub-and-my-newly-compiled-kernel-141174/)

maestro52 02-01-2004 08:41 PM

PROBLEM with grub and my newly compiled kernel!
 
I am using mdk 9.2

I know that may have been a slightly vague question, but I wasn't sure how to address it.

My situation is this; I appear to have actually been successful with compiling a a kernel. The instructions I used tell me that I must change the boot and such in grub or lilo. Since I use grub, I looked for the grub.config and there isn't one.

Upon further research I discovered that grub uses what looks like menu.lst or menu.Ist. As you should be able to see they both look the same but the first one is a short L and the second one is a capital i. So I am not sure which is correct.

Before I state my last question I want you to see the instruction I have for grub and it is as follows;
____________________________________________
title New Kernel
kernel /vmlinuz-x.x.x ro root=LABEL=/ hdd=ide-scsi
initrd /initrd-x.x.x.img
(Note: )
look at the previous parameters in the grub.conf file and note what "root=" and use what is existing.

Exit and Save grub.conf
type "/sbin/grub-install"
____________________________________________

Now I put the following into the menu.lst;
____________________________________________
title 2422-21mm1gsw
kernel (hd0,4)/boot/vmlinuz-2.4.22-21mm.1gsw devfs=mount hdc=ide-scsi
acpi=ht splash=silent vga=788 root=/dev/hda5
initrd (hd0,4)/boot/initrd-2.4.22-21mm.1gsw.img
____________________________________________

BUT when I tried to do the "/sbin/grub-install" I get the following error;
____________________________________________
[root@localhost linux]# /usr/sbin/grub-install
install_device not specified.
Usage: grub-install [OPTION] install_device
Install GRUB on your drive.

-h, --help print this message and exit
-v, --version print the version information and exit
--root-directory=DIR install GRUB images under the directory DIR
instead of the root directory
--grub-shell=FILE use FILE as the grub shell
--force-lba force GRUB to use LBA mode even for a buggy
BIOS
--recheck probe a device map even if it already exists

INSTALL_DEVICE can be a GRUB device name or a system device filename.
____________________________________________

So now I have absolutely no idea of what to do. Can someone please help me? I have so far not shut down my computer or rebooted for fear of a this kernel screwing up the boot. PLEASE HELP!

:confused: :newbie: :confused:

jtshaw 02-01-2004 08:45 PM

The configuration file is either called grub.conf or menu.lst (as in lowercase L). It should be in the /boot/grub directory unless you have a wierd install of grub. Sometimes it is also linked into /etc on some distributions.

maestro52 02-01-2004 10:26 PM

Thankyou BUT??
 
You have only answered part of my question. It is very good to know that it is supposed to be menu.(small L)st, but what about the problem with the instructions for /sbin/grub-install? I did that first and it went like this,
__________________________________________________________________________
[root@localhost linux]# /sbin/grub-install
bash: /sbin/grub-install: No such file or directory
__________________________________________________________________________

Then I tried,
__________________________________________________________________________
[root@localhost linux]# /usr/sbin/grub-install
install_device not specified.
Usage: grub-install [OPTION] install_device
Install GRUB on your drive.

-h, --help print this message and exit
-v, --version print the version information and exit
--root-directory=DIR install GRUB images under the directory DIR
instead of the root directory
--grub-shell=FILE use FILE as the grub shell
--force-lba force GRUB to use LBA mode even for a buggy
BIOS
--recheck probe a device map even if it already exists

INSTALL_DEVICE can be a GRUB device name or a system device filename.
________________________________________________________________________

Neither of the above worked. So what am I supposed to do now. Is it perhaps not necessary to do the grub-install with mdk9.2?

If I must do the grub-install, how do I do it?

:confused: :newbie: :confused:

NewtonMan 02-01-2004 11:42 PM

just # vim /etc/grub.conf

you can edit and point another line to your new kernel. there is an examle at the top of the conf file. also i like to use the list from http://www.newtolinux.org.uk/wiki/in...20own%20kernel

to run myself through a recompile

if this isn't clear enough i'll try to walk you through it a little more

maestro52 02-02-2004 12:49 AM

Sounds great, BUT!
 
You are using SLACKWARE, I am using Mandrake. Mdk does a lot of things differently. I am not having a problem with my compile itself. IT WORKED!

In MDK they have the grub config file renamed as menu.lst.

I have established that info three times now. The point is ONLY this, and I will reword it slightly due to the compile instructions you referred me to.

First: MDK requires that IT WE USE LILO (after we input new info to lilo) WE MUST do a lilo at the command prompt to cause lilo to rebuild itself with the new information from the new compile and input.

However, there is no information about what to do with grub!!

The compile instructions I have tell me to input info inot the grub config, even the instructions you referred me to tell me to input new info in the grub config, bUT THAT IS menu.lst in Mandrake 9.2.

BUT THAT IS NO PROBLEM!!

The problem is that the first instructions mention the necessity to do a grub-install and I think it is assuming I do not already have it installed. Mandrake iso comes with it already installed and I AM USING IT.

The instructions you referred me to say nothing about a grub-install. So is it or is it not necessary for some kind of grub-install to be done FOR MANDRAKE? If so, HOW?

NewtonMan 02-02-2004 02:44 PM

if you'll notice i also use CPUbuilders, which is derived from redhat, like a brother to mandrake so to speak. but your right i use another distro, i obviously have no clue. have fun figureing it out then.

jtshaw 02-02-2004 03:30 PM

Ok....

grub does not, if properly installed, require you to run anything after you change the configure file, no matter what distro you run. That is a lilo thing because lilo installs the boot configuration to the boot sector. Grub can actually access the partition the menu.lst file is on and read it, which is exactly how it was intended to work. So edit the file, reboot, and have fun.

grub-install is only to be done the FIRST time you install grub on a machine.

maestro52 02-02-2004 05:59 PM

jtshaw ??
 
This may sound like a stupid question, but with all the confusing thinngs I have been reading I just want to be safe. :scratch:

I am truly happy to know that I can trust grub to pretty much pick up things on it's own. However, you mentioned, "So edit the file, reboot, and have fun."

Should I understand that to mean I should remove the new kernel info I placed into the grub menu.lst and THEN reboot?


Another question!

I did all that I mentioned and then rebooted (I became impatient...a serious problem I have) . When the boot menu came up it had my new kernel on the list of kernels, but it stated it could not find the new kernel file. I chose the old kernel and went in to investigate and found that the vmlinz for my new kernel and the System.map for my new kernel were not in the boot as they should have been.

I managed to get the vmlinuz and System.map entry for my new kernel, but am am trying to be a little more patient for skilled information this time. So I thought I would let you know what I have done and see if everything is ok for reboot.

FIRST:
It says, **"make a new link to the new kernel"**
ln -s /usr/src/linux-x.x.x /usr/src/linux (before the kernel config)

Which I did not have to do since mdk had already done so.

Then: (after mrproper and the kernel config), it says to make dep
change Extraversion in the makefile
make clean
make bzmage
make modules
make
make modules_install
Then/part 2: It says to;

Remove the following links:
rm -rf /boot/System.map
rm -rf /boot/vmlinuz

Then copy the newly created kernel and system.map to /boot
cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-x.x.x
cp /usr/src/linux/System.map /boot/System.map-x.x.x

Make the new links:
ln -s /boot/vmlinuz-x.x.x /boot/vmlinuz
ln -s /boot/System.map-x.x.x /boot/System.map

(I did all of the above again)

Next remove existing initrd.img file:
rm -rf /boot/initrd.x.x.x.img

..And create the new one:
/sbin/mkinitrd /boot/initrd-x.x.x.img x.x.x
(Note: )
The last set of x.x.x is the eqivalent to your new kernel version and it looks to /lib/modules for that version.

I did all of the above and somehow the new vmlinuz and System.map were not input into the boot, even though the old ones were removed.

As I said I did mange to get the new vmlinuz and System.map in the boot and then I input info into the grub menu.lst and also input info into lilo.config (to be safe), but everytime I do a lilo at the command prompt it tells me there is no /boot/vmlinuz and I see it there right this moment.

So my final questions are what do I do about the lilo part and do I actually remove the new kernel entry from the menu.lst?


I sure do hope you will forgive this apparent stupidity, but I am really trying to learn. So I appreciate all your help.


:scratch: :newbie: :scratch:

jtshaw 02-02-2004 06:14 PM

Where are you getting all this information from? My suggestion is to always keep your old kernel until you are sure the new one boots. I name my system.map file system.map.<kernelversion> and I name my kernel image vmlinuz-<kernelversion>. Whenever I make a new kernel I always keep the old known good one around in case I made a mistake, because trust me, they happen.

You don't need both grub and lilo. Grub and Lilo are designed to do the same thing, pick one and go with it. I recommend grub because it is easier to configure, and if you make a mistake you can type commands into to boot any kernel on your hard drive at boot up. There are some great docs at www.gnu.org/software/grub if you want more information on it.


All times are GMT -5. The time now is 09:22 PM.