Boot with GRUB
Using the GRUB command line is cool, but after a few thousand system starts, you will probably get a little tired of entering the same commands at the GRUB prompt and long for something a little more automated. Good news from the GRUB gang: you get a fully configurable menu interface at no extra charge! The GRUB boot menu gives you point-and-shoot boot selection, unattended default boot after a configurable timeout, any number of fallback boots if previous boots fail, toggle between command-line and menu modes, and interactive editing of menu selections and password protection. These features give GRUB an ease of use to match its tremendous functionality.
When GRUB boots, it automatically looks for the /boot/grub/menu.lst file on its boot device (the last three letters are “ELL ess tee” and not “one ess tee”). If the file is found, GRUB automatically enters its menu mode and presents the user with a stunning interface, as shown in Figure 2.
Listing 1 [found at LJ's web site] shows the configuration file responsible for this demonstration menu. As you can see, it is a simple text file typical of many UNIX configuration files, where lines starting with hashes (#) and blank lines are ignored.
The first set of commands sets general configuration variables. The timeout command sets the time in seconds to wait for the user to make a selection before proceeding automatically to the default boot. The default command sets which of the following boot stanzas GRUB should attempt to boot automatically. Boot stanzas are numbered implicitly, starting from zero, according to their order of appearance in the configuration file. This order is also how they will be listed in the menu.
The fallback command specifies which of the boot stanzas to load if the default should fail. It is possible to set more than one fallback, as is shown in the example.
The color command lets you breathe a bit of life into the text-mode menu screen. The syntax for the color command is
color foreground/background [ hilite-fg/hilite-bg ]
where each of the foreground/background colors is specified with a name from the set of black, blue, green, cyan, red, magenta, brown and light-gray; dark-gray, light-blue, light-green, light-cyan, light-cyan, light-red, light-magenta, yellow and white. Among these colors, only the first eight are used for the background. The optional highlight color pair, if specified, will be used to show the current menu selection. When not specified, GRUB will use the inverse of the normal colors.
The rest of the configuration file consists of the boot stanzas for our demonstration system. The title command marks the beginning of a new boot stanza, and its argument is the label that will be displayed for its entry in the menu, from the first non-white-space character to the end of the line. The remaining commands in each stanza are identical to those used when working from the GRUB command line. The exception here is that we no longer need to give a boot command; GRUB does this job without asking.
This example configuration gives only a sample of the many flexible uses of the GRUB boot loader. Besides multiple OSes, you can use GRUB to set up menu selections for test kernels, rescue kernels, different kernel options and so on.
All in all, the GRUB configuration file will be very similar to your /etc/lilo.conf. And after working with the GRUB command line and these examples, it should be a simple matter of firing up your favorite text editor and creating a menu configuration file suitable for your own system and preferences. Don't worry if it's not perfect the first time; you will see that you can make changes interactively, and the GRUB command line is always available as a fallback.
Once you've got your configuration file, mount your GRUB floppy again, and copy the file (say it has been saved as mygrub.conf) into the magic location:
cp mygrub.conf /floppy/boot/grub/menu.lst
Now when you boot with your GRUB floppy—presto!—you will be greeted with a lovely boot menu like the one in Figure 2. If you like, just stare at it for the few seconds it needs to count down from the timeout setting, and then it will automatically boot into your default OS. Or, use the arrow keys to highlight the OS you want to load and press return. Or, type c to go to the now-familiar GRUB command prompt. From the command prompt, press ESC to go back to the boot menu again.
It is also possible to edit the entries displayed in the menu. Typing e will open a simple vi-like editor interface for the highlighted entry. This allows you to adjust or add any settings to the configuration before booting. Any changes made here will then remain in effect for the duration of the GRUB session. To make permanent changes, you will later need to edit the configuration file on the boot disk, saving the changes with your text editor.
Play with your GRUB floppy configuration until you have it set up the way you like. After just a few system boots, you'll be slinging through GRUB like hashbrowns in a diner.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Reply to comment | Linux Journal
7 hours 38 min ago - Nice article, thanks for the
18 hours 18 min ago - I once had a better way I
1 day 4 min ago - Not only you I too assumed
1 day 22 min ago - another very interesting
1 day 2 hours ago - Reply to comment | Linux Journal
1 day 4 hours ago - Reply to comment | Linux Journal
1 day 11 hours ago - Reply to comment | Linux Journal
1 day 11 hours ago - Favorite (and easily brute-forced) pw's
1 day 13 hours ago - Have you tried Boxen? It's a
1 day 19 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?





Comments
Booting from CD in GRUB
Hello!
I'm a Linux newbee and installed Suse 9.1 on my machine together with Win2000 and XP. Grub is installed on the harddisc. So far no problem, everything is working fine. But I wanted to update Suse to version 9.3 from CD's. Even I changed the Bios-settings to boot from CD Grub doesn't boot from the CD. I would be really thankfull for a hint.
Greetings
Josef
how to boot to CD with GRUB installed
Problem:
my Windows was in a corruptted state and i have grub installed as the load mgr. it is frustrating as hell that i can't boot my box with a XP install CD because GRUB is always loaded and there is no way that i know to set the root to the CD-ROM. i was looking all over the net for solution on how to boot from XP install CD within GRUB, couldn't find anything.
Here's my solution:
0. put your XP install CD in to your CD-ROM and start your machine
1. go to your BIOS setup. F12 on a Dell box upon system start
2. navigate to boot sequence and press enter
3. disable your hard drive by moving the cursor to hard drive and hitting the space bar.
4. save your changes and exit BIOS setup
5. upon restart, you will see the option to "press any key to boot from CD" flashing by. make sure you press a key before the option goes away and before GRUB is loaded.
6. life is good again.
7. make sure you enable your hard drive in the boot sequence after you fixed whatever problem you are having.
it's a hack but it works. hope this helps.
hey, BTW, working on a Saturday sucks;)
Fargo
Same problem
I also am not able to boot to cd with my xp cd to try to reinstall windows. I have tried that very thing to by disabling the HD and trying to boot to cd. Even with the HD disabled, it still skips the boot to cd even if I push any button and goes to the Grub screen, then it will also load both linux and windows depending on which I select. Is there another solution?
Thanks
same
I have the same problem how did you fix it.
I have same problem. Could y
I have same problem.
Could you please explain how you solved the problem.
Thankyou
Problem solved.
Problem solved.
Wont boot windows cd Grub
How did you solve this problem??
Mark.
Booting with linux
I hav a prblm in booting with linux
first i installed a linux
after i installed windows
after then i lost my linux what should i do.
reply me asap.
Thankyou,
GRUB Query!
Since you have installed Windows after Linux it has owerwritten
your MBR where the 1st stage of GRUB is installed. This is the
reason you are not able to get GRUB menu. Windows is not Multi-boot
compliant.
Solution:
Boot with Linux CD in the Rescue mode(linux rescue).
Change root to /mnt/sysimage (chroot /mnt/sysimage).
Install new GRUB(grub-install /dev/hda).
exit
exit
Bingo! You are done.
If you installed Windows afte
If you installed Windows after _any_ non-Windows installation, then it overwrote that hard drive's MBR for its own purposes. If you have a Grub floppy (as outlined above) or a boot disk for your distribution's kernel (typically made during install or afterwards with the mkbootdisk command) then you should be able to boot to a command line and reinstall grub in the MBR.
If you are unable to get your hands on either of those, try popping in your linux installation's cds; often recent releases will contain recovery methods including ways to reinstall boot loaders (just be sure you don't format the hard disk, as this will lose your saved data).
If even that doesn't work you can always turn to something like the wonder that is the single-CD OS, Knoppix; it just may have a boot loader tucked away in there somewhere .
Re: Boot with GRUB
Hi! Is there a way to install GRUB and create GRUB boot floppy under Windows environment? I had GRUB installed on my
laptop but when I reinstalled Windows XP I lost GRUB and found Win boot loader instead which offers me to boot two Win installations (one corrupted and one fresh). It seems that GRUB was overwritten by a standard Win MBR.
So, I can't boot Linux cause I didn't care to create Linux boot floppy.
Thanks/AlBa
If you can boot from a CD, (w
If you can boot from a CD, (which you probably can), download a rescue iso image from the net of your linux distribution. (I know fedora core has one). Burn the CD image with your winxp. Restart and boot off the cd. The rescue disk should boot a lite linux with your linux partition mounted in /mnt/sysimage. you can
chroot /mnt/sysimageto make it your root. you can then rungrub-install /dev/hda2(your linux partition). you can check what partitions is what withdf. grub-install will tell you if it was a success. you may need to edit your grub.conf to make sure you have all the entries you need to boot all your operating systems. I suppose if you wanted to make a boot floppy you could:grub-install /dev/fd0.Chris
Re: Boot with GRUB
An excellent article. I found the commentary on the operation of the lines of code very helpful and the explicit steps on how to create the floppy so that it will boot were very clear. I wanted to run a linux system from a second hd, keeping it entirely separate from the first (which contains W98). I am quite satisfied to leave the floppy in A:. I haven't done it yet but have high hopes. The only difficulty that I forsee is dealing with the various distributions on cd which all want to write to MBR.
Re: Boot with GRUB
IN ORDER TO REMOVE LINUX FROM MY COMPUTER I DELETE IT DIRECTLY FROM WINDOWS USING >COMPUTER MANAGEMENT> DISK MANAGEMENT> DELETE LOGICAL DRIVES.
AFTER THAT I FACE NO PROBLEM BUT AFTER SOMETINE WHEN I REBOOT MY COMP DUE TO POWER FAILURE , I FACE A PROBLEM ,IT IS NOT BOOTING AND GRUB PROMPT IS COMPING EACH TIME . NOW I WANT TO GO BACK TO MY WINDOWS BOOT. ANYBODY HAVING ANY SOLUTION PLZ MAIL ME AT
Need help
Hi,
I am also having the same problem as you faced whic is described below. Were you able to find the solution? If so, would you please share it with me?
Thanks in advance,
RK
Re: Boot with GRUB
Submitted by Anonymous on Tue, 2004-09-07 23:00.
IN ORDER TO REMOVE LINUX FROM MY COMPUTER I DELETE IT DIRECTLY FROM WINDOWS USING >COMPUTER MANAGEMENT> DISK MANAGEMENT> DELETE LOGICAL DRIVES.
AFTER THAT I FACE NO PROBLEM BUT AFTER SOMETINE WHEN I REBOOT MY COMP DUE TO POWER FAILURE , I FACE A PROBLEM ,IT IS NOT BOOTING AND GRUB PROMPT IS COMPING EACH TIME . NOW I WANT TO GO BACK TO MY WINDOWS BOOT. ANYBODY HAVING ANY SOLUTION PLZ MAIL ME AT
hey guy, try with these.if i
hey guy,
try with these.if it's ok informe me.
try with these commands
grub>rootnoverify
grub>chainloader+1
grub>boot
Same probl.
Hi, I'm having the same problem, I just can't go pass the promp GRUB, I would like to know if u fixed it and how?.
Thanks you for your time,
Cristian
Re: Boot with GRUB
Hi. Try fdisk /mbr from windows. It should rewrite MBR on you /dev/hda and erase grub
Good luck
Re: Boot with GRUB
He's right, you know?!
lol :p
Re: Boot with GRUB
in a command window, just type "fdisk /mbr" to wipe your master boot record and replace the traditional windoze boot loader.
cant boot stuck at grub prompt
Hi,
How do i get to command window. when I start my computer i am prompted grub> and can't get pass to it. if you can help, i appreciate it. thanks
ronak
Re : Stuck at Grub Prompt ???
Just run these set of commands at the grub prompt to load the windows OS.
grub>rootnoverify(hd0,0)
grub>makeactive
grub>chainloader +1
grub>boot
Linux New User
Hello,
I am a new linux user and I was working with my laptop and something happened and now when I reboot the computer I just can get into the GNU GRUB version 0.95.
I dont have any idea how I can reboot my laptop and go into the linux again.
Please I need help.
Thank you
Noxmar
Want to boot virtual drives
I want to put my entire windows partition into a image file, like a virtual drive, and have GRUB boot it, so that I can store it like this
|-------drive layer----------------------------------|
|grub|-----linux stuff-------------------------------|
| |boot|root|etc|usr-------|var----------|opt,etc-|
| | |--windows img| |
well, what dya think?
cant boot stuck at grub prompt
If you have your windows XP setup CD, then boot using the CD, disable the hard drive if you have to (not really necessary). after a lot of hoo ha the windows setup will give u three options and ask you what you want to do.
select "R", for recovery and wait for the Recovery console.
The Recovery Console provides system repair and recovery functionality.
Type EXIT to quit the Recovery Console and restart the computer.
1: C:\WINDOWS
Which Windows Installation would you like to log onto
(To cancel, press ENTER)?
---------------------------------------------------------------------
Go ahead and hit the number 1 on your keyboard
In the command prompt that you get:
Type in: FIXMBR
It may try to scare you with some warnings. but if it says that the mbr is non standard etc etc, then go ahead and reply yes. this shud solve the problem...
problem
hi when i press 1 a blue screen appears telling me registry_error problem
tried reinstalling xp doesnt let me as it rebrings me te error again what may i do
cant boot stuck at grub prompt
FIXMBR solve the problem, THANKS......
i cannot write more than 1 le
i cannot write more than 1 letter/number
i cannot write more than 1 le
Then I would choose the letter c which will give you the grub
command prompt. Then type:
rootnoverify (hd0,0)
makeactive
chainloader +1
boot
should boot your windows
then at the msdos prompt type:
fdisk /MBR
(I don't remember whether it's a forward
or backslash. I haven't used windows in
a few years.)
stuck at GRUB
Hi,
I have a problem. I was trying to install windows NT on my laptop replacing linux which it had before. A part of instalation was done and Installation process asked me to restart the computer but now i am seeing a word GRUB with a blinking cursor and can't boot and can't even type a single charater here. Can Anyone help me? What should i do?
Regards
-S
GRUB - blinking cursor and nothing to type
Did you fix this problem? Because I got it right now and its really frustrating. Any help is appreciated.
When i restart computer, grub
When i restart computer, grub> display,
how can i enter the linux
need to type configmenu cmd each time
hi,
I let windows control the MBR and edit the boot.ini to show a menu to choose WinXP or FedoraCore2 at boot.
When I choose FedoraCore2 it gives me a grub> prompt always. I can correctly boot from there using the root(hd0,4), kernel, initrd commands.
Also instead of typing these commands I can also boot into FC2 by typing :
grub > configfile (hd0,4)/grub/menu.lst
and then choosing the 1st option. But I have to type this each time.
How can I automate so that it boots automatically without having to type the 'configfile' command.
I think that could be the
I think that could be the problem with the MBR. What you could do is reinstall grub within FC2 (grub-install /dev/sda) to the MBR then it should fix the problem.
I think that could be the
I think that could be the problem with the MBR. What you could do is reinstall grub to the MBR then it should fix the problem.
would be intrested in
would be intrested in exactly how you do this, but i have another question..
is it possible to install GRUB first in its own partition before installing anything else? ( eg windows or linux)
and then installing what ever os's you want..
so you have ..... GRUB
windows linux dos bsd
instead of... grub with windows
linux bsd dos
any ideas would be appreciated.
install dual boot linux and windows xp
i would like to know the steps to dual boot linux and windows xp..
i have a win xp in drive d: and would like to insatll linux in drive c: which i will be formatting now
please provide the steps to do insatl linux.. i have redhat linux 7.1 CD wiht me.... kindly send the steps to my email
how to change boot sequence in grub.conf in MS DOS mode
DEAR ALL,
PLS GIVE ME SOME CLARIFICATION ON CHANGING BOOT SEQUNCE OF GRUB LOADER. I.E I LOADED 2 OPERATING SYSTEM. LINUX + XP EVERY TIME BOOTING THROUGH GRUB.
I WANT TO CHANGE THIS BOOT SEQUENCE FROM DOS MODE ITSELF.
WANT TO CHANGE WITHOUT BOOTING IN TO LINUX. WANT TO EDIT GRUB.CONF
IF U ARE HAVING ANY IDEA RELATED TO IT PLS POST IT.
I REALLY THANKS TO ALL.
WITH REGARDS,
RAMACHANDRAN.N