Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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]
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790
Rep:
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.