Jump to content


Photo

How to edit and modify the grub.conf


  • Please log in to reply
8 replies to this topic

#1 ruharvey

ruharvey

    stranger

  • Members
  • 5 posts

Posted 21 June 2006 - 03:15 AM

Hi everyone,
I am trying to edit the grub.conf file. I installed a new version of Linux RedHat onto my Backup Server that I just bought. I made a copy of the original server to load on the new backup server. Everything worked fine and boots up fine. The only problem is that when it boots up it comes up with the splash screen asking if I want to boot up the 27.0.1.EL Kernel or the 20.0.1.EL Kernel. I want it to automatically boot up using the older Kernel without it asking me which Kernel to use, because I will not be at the computer locally to make sure it boots the old Kernel if I ever have to restart the computer.

So I am at the grub.conf file, but I am not sure how force it to go to the older kernel. If anyone can help me out I would greatly appreciate it. And if you need any info that I have not posted here, please just let me know.

I would like to keep the new kernel as well because I want to have a backup up if the older kernel fails on me. If it would be better and easier to just remove the new kernel, because I want to keep the old kernel, let me know what you think.

Here is a look at the grub.conf file:

#boot=/dev/sda
default=1
timeout=10
splashimage=(hs0,0)/boot/grub/splash/xpm.gz
title Red Hat Enterprise Linux ES (2.4.21-27.0.1.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.4.21-27.0.1.EL ro root=LABEL=/
initrd /boot/initrd-2.4.21-27.0.1.EL.img
title Red Hat Enterprise Linux ES (2.4.21-20.0.1.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.4.21-20.0.1.EL ro root=LABEL=/
initrd /boot/initrd-2.4.21-20.0.1.EL.img

#2 danleff

danleff

    Carpal Tunnel

  • Moderators
  • 2903 posts

Posted 21 June 2006 - 06:04 AM

Try using the hidenmenu command;

#boot=/dev/sda
default=1
timeout=10
splashimage=(hs0,0)/boot/grub/splash/xpm.gz
hiddenmenu
title Red Hat Enterprise Linux ES (2.4.21-27.0.1.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.4.21-27.0.1.EL ro root=LABEL=/
initrd /boot/initrd-2.4.21-27.0.1.EL.img
title Red Hat Enterprise Linux ES (2.4.21-20.0.1.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.4.21-20.0.1.EL ro root=LABEL=/
initrd /boot/initrd-2.4.21-20.0.1.EL.img


This should then give you the option to hit the <esc> key to show both entries, say if the older kernel fails and you want to show both entries and boot the new kernel. You will just have a few seconds to do this, before the system will try to boot the old kernel.

#3 ruharvey

ruharvey

    stranger

  • Members
  • 5 posts

Posted 21 June 2006 - 06:35 AM

Thank you for responding so quickly to my post! Greatly appreciated, but now I have a bigger problem now, I think. Well I edited the grub.conf file and added the hiddenmenu like you said and rebooted the computer. Now when it boots up and goes through the text about initializing Intel Boot Agent along with some other Brand Versions. But then it comes to 'Press <Ctrl-E> for BMC Setup within 5 sec.....' and then grub comes in caps letters and just stops and sits there with GRUB and a blinking cursor.

Did I edit the file wrong? After I edited the file I hit ':wq' and escaped out of the file. And then closed the terminal and rebooted the computer. Please get back to me when you get a chance danleff. And once again, thank you for the quick response.

#4 ruharvey

ruharvey

    stranger

  • Members
  • 5 posts

Posted 21 June 2006 - 07:20 AM

I have a Ubuntu Live CD that I have booted the server on to try and access the grub.conf files. But i'm not sure where to go or how to access the files on the harddrive from the CD. Can anyone could point me in the right direction?

#5 attenboroughp

attenboroughp

    stranger

  • Members
  • 2 posts

Posted 21 June 2006 - 07:31 AM

I can't help but feel as though i'm missing something here but anyway...

It should allready be booting the older kernel!

To boot:
"title Red Hat Enterprise Linux ES (2.4.21-27.0.1.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.4.21-27.0.1.EL ro root=LABEL=/
initrd /boot/initrd-2.4.21-27.0.1.EL.img"

You should set the line "default=1" to "default=0"

And to boot:

"title Red Hat Enterprise Linux ES (2.4.21-20.0.1.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.4.21-20.0.1.EL ro root=LABEL=/
initrd /boot/initrd-2.4.21-20.0.1.EL.img"

It should be set to "default=1"... which it allready is!

#6 ruharvey

ruharvey

    stranger

  • Members
  • 5 posts

Posted 21 June 2006 - 07:44 AM

I did notice before I added the 'hiddenmenu' in the grub.conf file. That everytime I restarted the computer it did have the old kernel selected. But I thought 'what the heck' and added the 'hiddenmenu' command. And that seemed to make things worse laugh not better. So now I am trying to back track and remove the 'hiddenmenu' command smile

I guess you live and learn from your mistakes. I should of been happy with it working and booting from the old kernel. smile

#7 danleff

danleff

    Carpal Tunnel

  • Moderators
  • 2903 posts

Posted 21 June 2006 - 08:23 AM

Oh well, I thought the same thing, as the default was what you wanted anyway.

But, it sounds like you made an error using vi to change the grub file. Did you use the "e" or "i" keyboard option to edit or input the changes, before saving them?

If this is a Dapper cd, go to System-->Administration-->Disks-->Partitions and enable the one you want, browse for a folder in which it'll be mounted and then you should be able to edit the grub file again.

I prefer to use Midnight Commander for editing (less chance for errors), but I'm not sure that it is installed in Ubuntu's live cd.

#8 ruharvey

ruharvey

    stranger

  • Members
  • 5 posts

Posted 22 June 2006 - 03:50 AM

Thank you so far for everyone's input on my problem. I was able to get and edit out the 'hiddenmenu' command that I added in the grub.conf file. But unfortunately my system comes to a complete halt during the boot up at 'GRUB'.

Do you think that reinstalling grub through the Ubuntu CD would work? And if so, how would I go about doing that?



#9 danleff

danleff

    Carpal Tunnel

  • Moderators
  • 2903 posts

Posted 22 June 2006 - 05:43 PM

Boot up the RedHat installation CD and get into the system by typing in at the installation window linux rescue

Once you are at the console as root user, then type in chroot /mnt/sysimage

You can then edit again or run the grub-install command to rescue the grub bootloader.

But before you do this, is it possible to post the grub.conf or menu.lst file, so we can have a look at it?

Did you copy and paste the original one on your first post, or hand type it in? The reason why I ask, is that there is an error in the entry.

#boot=/dev/sda
default=1
timeout=10
splashimage=(hs0,0)/boot/grub/splash/xpm.gz
title Red Hat Enterprise Linux ES (2.4.21-27.0.1.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.4.21-27.0.1.EL ro root=LABEL=/
initrd /boot/initrd-2.4.21-27.0.1.EL.img
title Red Hat Enterprise Linux ES (2.4.21-20.0.1.EL)
root (hd0,0)
kernel /boot/vmlinuz-2.4.21-20.0.1.EL ro root=LABEL=/
initrd /boot/initrd-2.4.21-20.0.1.EL.img





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

IPB Skin By Virteq