LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This 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

Tags used in this thread
Popular LQ Tags , , ,

Reply
 
Thread Tools
Old 12-07-2007, 02:48 PM   #1
DennisC31
LQ Newbie
 
Registered: May 2007
Location: Jacksonville
Distribution: Fedora 6
Posts: 19
Thanked: 0
Deleting the Bootloader Config File


[Log in to get rid of this advertisement]
This question is a bit academic, but I could see a case for this happening in real life, in a lab.

distro: Centos-5

CentOS uses /boot/grub/grub.conf as the bootloader config file. /etc/grub.conf and /boot/grub/menu.lst are both symlinks to /boot/grub/grub.conf.

I'm in the process of polishing up my linux skills and I asked, "What would happen if the /boot/grub/grub.conf file was pooched."

Here's what happened:

I boot and I am greeted with the grub prompt:

grub>

Uh oh! Now what?

Well, if your distro has /boot/vmlinuz symlinked to the most recent kernel file in /boot, then you can just run:

root
(note which device it finds for boot, possbibly root (hd0,0))

root (hd0,0) (or use the device found above)
kernel /vmlinuz
boot

Now, the problem I have is what do we do when there is no symlink and you don't know which kernel files exist AND when you don't have a cdrom available AND there's no network avalable to boot from. Are we screwed?

I'd love to be able to list the files in /boot/ so that I can see the name of the kernel file. But that functionality doesn't come with the grub find command.

I'm going to try and boot with a network image from the grub prompt so that I can then mount the /boot partition and see the files.

This seems like something they'd do to you on the RHCE test.
DennisC31 is offline  
Tag This Post , , ,
Reply With Quote
Old 12-07-2007, 03:27 PM   #2
DennisC31
LQ Newbie
 
Registered: May 2007
Location: Jacksonville
Distribution: Fedora 6
Posts: 19
Thanked: 0

Original Poster
I'm an idiot

I never thought to use tab completion.

Again, the scenario is:

Some genius deleted /boot/grub/grub.conf on a CentOS system.
The computer worked fine for weeks.
The computer had custom kernels.
Someone booted it.
The genius now works for another company.
You are the admin, you need to boot the server.
You get a grub> prompt and that's it.

1. Run root and note the location of the boot partition:
grub> root
(hd0,0): Filesystem type is ext2fs, partition type is 0x83

2. Run root (hd0,0):
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83.

3. run kernel <tab> And you'll see your list of vmlinuz-blah kernels. Pick one and finish the command line with ro:
grub> kernel /vmlinuz-2.6.18-53.1.4.el5 ro
[Linux-bzImage, setup=0x1e00, size=0x1b32d4]

4. run initrd:
grub> initrd /initrd-2.6.18-53.1.4.el5.img
[Linux-initrd @ 0xfd17000, 0x2c8dbb bytes]

5. run boot
DennisC31 is offline     Reply With Quote
Old 12-07-2007, 03:30 PM   #3
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790
Thanked: 0
Quote:
I'm in the process of polishing up my linux skills and I asked, "What would happen if the /boot/grub/grub.conf file was pooched."
I asked myself a question like this a few years ago............

My answer was to not mount the boot partition unless it was required for something like installing a new kernel. Saves a lot of possible headaches like the one you created.


FYI: Nothing is in the RHCE test that is not in the manuals.
Lenard is offline     Reply With Quote
Old 12-07-2007, 07:00 PM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,012
Blog Entries: 1
Thanked: 20
Any User can write a Grub menu.lst/grub.conf.

Any installed and health Linux can be booted up by Grub, even without a boot loader installed.

A user can use "geometry (hd0)" to examine the partition details. Usually the first Type 83 partition is the /boot for a Red Hat. It can also be located by command "find /boot/grub/grub.conf".

The vmlinuz and initrd can also be located by the "find " command in a Grub prompt. This together with using the tab key are enough for any Linux to be booted "manually.

In fact any health PC system, be it a Dos, Windows, Linux, BSD or Solaris, can be booted up by a Grub prompt. I never have run into a PC system that cannot be booted up by a Grub prompt.
saikee is offline     Reply With Quote
Old 12-10-2007, 08:51 AM   #5
DennisC31
LQ Newbie
 
Registered: May 2007
Location: Jacksonville
Distribution: Fedora 6
Posts: 19
Thanked: 0

Original Poster
Quote:
Originally Posted by Lenard View Post
I asked myself a question like this a few years ago............

My answer was to not mount the boot partition unless it was required for something like installing a new kernel. Saves a lot of possible headaches like the one you created.


FYI: Nothing is in the RHCE test that is not in the manuals.
You know, this is some really good advice. I hadn't thought of not mounting the boot partition. I've always been a fan of the linux boot partition. But the thought just never occured to me to not mount it.
DennisC31 is offline     Reply With Quote
Old 12-10-2007, 09:04 AM   #6
DennisC31
LQ Newbie
 
Registered: May 2007
Location: Jacksonville
Distribution: Fedora 6
Posts: 19
Thanked: 0

Original Poster
Quote:
Originally Posted by saikee View Post
Any User can write a Grub menu.lst/grub.conf.

A user can use "geometry (hd0)" to examine the partition details. Usually the first Type 83 partition is the /boot for a Red Hat. It can also be located by command "find /boot/grub/grub.conf".
Another really good point. I hadn't thought of looking for the 83 partition. As usual with *nix, there's many ways of solving problems.
DennisC31 is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
bootloader: can't load xp after deleting dual boot mandriva 2007 webazoid Linux - Software 2 12-29-2006 03:17 PM
Can't install drakxtools-backend : bootloader-config is permission-denied Laurent-57 Mandriva 12 03-10-2006 01:47 AM
Fedora Core 1- Config bootloader? littlewhinging Linux - Software 2 04-06-2004 10:05 AM
deleting a file intellscreen Linux - Newbie 3 11-02-2003 01:39 PM
Lan Config file / internet config file Raven_X_Neo Linux - Networking 1 10-30-2002 02:05 PM


All times are GMT -5. The time now is 08:41 AM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration