Configuring Grub 2

FAIL (the browser should render some flash content, not this).

Download in .ogv format

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

How to change runlevels in Ubuntu 10.04

Shivakumar Awanti's picture

Hello every one...

I tried lot to change my runlevels in Ubuntu but i never found such files in my filesystem.
In my home i am using RedHat 5 and Ubuntu 10.04. I Can change runlevels easily in Red Hat by editing this file #vim /etc/inittab

So Please tell me how can i change the runlevels in Ubuntu.

expert help GRUB

abdul's picture

HI,

I MESSED WITH MY LAPTOP TODAY. I was having 320(300 and 20) gb hd, win vista. the 20 gb was for recovery, I deleted it first and then I forgot to make a new partition and I tried to install LiNux centOS and was sucessful. then i realized that I did not make any partition and then I made a new partiotion and again tried to install linux. and now when I restart my laptop it is asking me password and which is not working and after that it is showing GRUB with black screen and no commands and I am not able to do anything. I have important data on pc what do i do. please help me what should i do now ?

Please let me start by

p2bc's picture

Please let me start by saying, I don't think anyone here is against helping you solve your problem, myself included. With that said you might be better to address you question to a support system that would be better equipped to help you. A support system like a forum, CentOS has one:
href="http://centos.org/modules/newbb/
Depending on which version you have installed.

This way you can ask your question and people can ask question to clarify or give additional help if need be.

Now with that said, based on what you initially said, I googled "recover grub with a livecd" and got this. I will admit it is for Ubuntu, since Ubuntu is one of the lead distros at the moment, but it should be the same for any distro. The CentOS Forums would know for sure. The link I found is this:
http://maketecheasier.com/how-to-restore-grub-in-ubuntu/2008/04/11
It is a bit dated, but still holds true.

Hope that helps. Again, it not that I or anyone in this community don't want to help, but this system here is better for comments rather that diagnosing problems. you would get a lot more out of visiting a community forum. That is just my two cents.

reverting to grub legacy

dwhite's picture

At the risk of sounding blasphemous, here is a quick way to revert to grub legacy for ubuntu (and perhaps debian) users

sudo cp /etc/default/grub /etc/default/grub.old
sudo cp -R /etc/grub.d /etc/grub.d.old
sudo cp -R /boot/grub /boot/grub.old

sudo apt-get purge grub2 grub-pc
sudo apt-get install grub
sudo update-grub
sudo grub-install /dev/sda ## careful!!! be sure to choose the right device here...

Could not find grub.cfg

ravibn's picture

Hi,

I have dual boot machine with win XP. I could not find grub.cfg under /etc/grub directory, however I found /etc/grub.d and there are a bunch of shell scripts. Please clarify me on this.

Because of this grub I had to install ubuntu thrice bcos I could not recover my earlier installation. Now that my ubuntu is working I would appreciate if someone could help me identify all the tricks to recover in case the grub crashes.

Thnks
Ravi

grub.cfg

wally's picture

The grub.cfg file is in /boot/grub/ where the menu.1st file used to be. The scripts you see in /etc/... are the menu updating scripts which as I stated before I find more trouble than they are worth.
If you are only booting Ubuntu and XP, you should have no problem, There will be no changes to the XP stanza and the Ubuntu stanzas will take care of themselves.
I would suggest you browse the config file just to see how it is set up, 'less /boot/grub/grub.cfg'. You will also see some variables you may change such as the default boot delay.
Regarding grub crashes, I would download and burn a live disk such as Knoppix or Super Grub Disk which would enable you to reload Grub if corruption somehow occured, unlikely, but no harm in being prepared especially if you don't have alternate internet access in an emergency.

Grub 2

lionroar's picture

Does anyone know which setting I need to change in order to get just one kernel to display in grub2. Seems that every time I update the kernel I end up with a long list in the grub menu and my windows xp ends up being buried as I scroll my choices.

menu.lst

Mitch Frazier's picture

Edit /boot/grub/menu.lst and remove the unwanted entries. Entries will consist of multiple lines, they should start with a "title" line and then have some indented lines underneath, eg:

title Desktop -- openSUSE 11.2 - 2.6.31.12-0.1
    root (hd0,0)
    kernel /vmlinuz-2.6.31.12-0.1-desktop ...
    initrd /initrd-2.6.31.12-0.1-desktop

Mitch Frazier is an Associate Editor for Linux Journal.

Mitch thanks for your swift

lionroar's picture

Mitch thanks for your swift reply, I will take your advice, but I could have sworn that there is another file out with a line that indicates the number of kernels one can display at boot load.

Perhaps I did not explain myself very well or possible not talking about the same thing. In any event, I will take your advice to heart even though I will have to go into the grub2 file every time I new kernel gets updated.

Thank you.

Grub Graphical

Mitch Frazier's picture

If your system uses the GRUB 2 graphical menu then there is such a setting in it.

Mitch Frazier is an Associate Editor for Linux Journal.

Maybe In Something Other Than Grub

Mitch Frazier's picture

There's not such a setting that I'm aware of in grub proper but perhaps there is a setting somewhere else (depending on what distro you are using).

Mitch Frazier is an Associate Editor for Linux Journal.

Guess you are right, by the

lionroar's picture

Guess you are right, by the way I tried your command "/boot/grub/menu.lst" as far as editing it and as it turns out there is no such file in Ubuntu 9.10. All I got was and empty text page.

As Root

Mitch Frazier's picture

Although I don't use ubuntu, as far as I can tell it should be at that location. Are you editing it as root?

Mitch Frazier is an Associate Editor for Linux Journal.

Yes, I did the "sudo gedit

lionroar's picture

Yes, I did the "sudo gedit /boot/grub/menu.lst" thing but that is what I got, an empty file. Tell you one thing though Ubuntu is becoming too user friendly for my own taste. I used to venture deep into some of those files, but that was a while back when I got started with Ubuntu about two years back. Things have definitely change, almost as if Ubuntu has become more adoptable to simple users. Kind of starting to feel like windows. I can't quite point where though. Anyways no worries I will just go to synaptic and remove those old kernels so they won't appear in the boot menu. Thanks for your help though.

grub2

wally's picture

Frankly, I find it easier to just edit the grub.cfg file directly, regartless of what it says. I quad boot Mint8, Debian, XP, and Kubuntu on my older laptop and manually update the Mint8 grub.cfg after any os updates (Mint was last install, final grub setup).

AArrrgh!

Sassinak's picture

GRUB2 just booted out any other OSs I had on my system. In fact, I had a nice install of Karmic, (after wrestling GRUB2 to keep Jaunty for a while, and losing Puppy along the way) then installed MINT8 (so I practiced what I preach) and it totally scrapped it no matter how much tweaking I did, it just could not resolve wich kernel belonged to whom. Now I just have M8. I wanted to install PCLOS, but how?
Now I just virtualize any new OS, but that sure slooows things down. I really, really should have had the CHOICE of bootloader at the install. If Ubuntu is for windows refugees, Grub2 is for experts. It does not even work with that GUI (startup or something).

Grub 2

João's picture

I installed Ubuntu Karmic in triple boot with Windows and Fedora. When I rebooted only Karmic and Windows was in the boot menu. Than I tried the command "sudo update-grub" and when I rebooted my Fedora was there in the menu entry. So, I think that this Grub 2 is more easy to manage. We only need some time to habituate with this innovation.

New Features of Grub2

Jonas's picture

For the moment, I'm back to one OS on my PC, and found Grub2 loaded directly into that OS. What I'd like to see are advantages of Grub2 over Grub legacy. -- w/ Grub legacy I have md5 encrypted passwords, and a background screen if I like. I have found Grub Legacy an improvement over Lilo.

What's new in Grub2? & how easy is it to set up. -- Full color background image? , load rescue CD Images?

Hope these links

p2bc's picture

Hope these links help.

http://www.gnu.org/software/grub/grub-2.en.html
http://ubuntuforums.org/showthread.php?t=1195275

In short GRUB2 is far superior to GRUB with its power and potential, stress on potential. Of course with any new technology there are a few kinks.

Cheers

----------------------------------------------------------------------------------------------------------
"Sticky's Goooood"

Editing the list

Anonymous's picture

Thanks for the video, but the contest was not really substantial. The time_out and default are pretty intuitive for anyone who was used to menu.lst format. The question that burns my brain is how to add/remove items from the OS list.

Ditto on the RAID

IITQ's picture

Hi

I upgraded my Debian testing installation on an old box with a Megaraid controller.

Nightmare. Cannot boot or even get in to the second partition using rescue disks. Still trying to sort it out and will have to go back to the installation disks to rewrite the partitions and reinsttall the old grub.

Not a happy camper...

RAID configuration...

p2bc's picture

How do we get GRUB2 to work with a RAID configuration. I have a entertainment server (PVR) that I have in multi disk situation. I have Ubuntu installed on a 16gig USB thumb drive, and the "/home" pointing to my RAID1 (2x 500gig). Had everything working on release Ubuntu 8.04. Decided to update to Ubuntu 9.10 for the file system EXT4 and a few other features. After a long hair pulling session to get it installed and configure properly, and was sure it was all done right, I started getting errors on the boot up. I went looking for answers, and that is when I found that GRUB2 has problems with RAID configurations. To confirm if that was my problem I simply unplugged the 2x 500gig drives and tried to boot, and now I was greeted with a message "can't locate '/home' directory" verses the error messages which meant it was a RAID conflict with GRUB2. So my question is this, how can I get GRUB2 to work with a RAID setup? I have found some so called "solutions" or explanations but they do not seem definitive enough or correct the actual problem.

Thanks for the help, or any guidance in advance.

- - == Update == - -

p2bc's picture

Well I got it to work. I wish I had some gallant story of how I fix the problem but the truth is I don't. It was so simple it is frustrating. In short the latest version of Grub2 works with Raid configurations, not Raid0 as it is not bootable. But how to fix Grub2 on a system that already have it installed, without re-installing it is almost as easy.

Load a LiveCD, and the terminal do the following:

  1. sudo fdisk -l /dev/hda (To find the partition structure if you don't already know it)
  2. sudo mount /dev/hda1 /mnt
  3. sudo chroot /mnt
  4. apt-get update (No need for Sudo since you are logged in as root)
  5. apt-get upgrade (No need for Sudo since you are logged in as root)

... voie la, re-boot and it work!!!

You can find this helpful hint and a few other at https://help.ubuntu.com/community/LiveCdRecovery

raid0

Anonymous's picture

I HAVE XP ON RAID 0 AND GRUB 2 made 2 entries for it. one for the raid in its entirety (3 250 gb drives) and one for the drive the mbr is on. If I click on either one individually I get errors,,,but If I click for the entire raid first and then follow it up with clicking on the entry where the mbr is located, Windows loads perfectly. Grub legacy had no idea what do do with the raid and saw it as corrupted. So for me thats an improvement.

I also had a pclinux install on usb thumb drive with grub legacy, which it sees and I can access, but will not boot from the grub2 menu....still trying to figure out why.

The issue RAID 0 is not

p2bc's picture

The issue RAID 0 is not bootable under Unix. What you need to do is create 4 partitions, 2 on each drive. First partition on each drive need not be any bigger than 2 megs, and then the remainder. On the first partition you set it as RAID 1 and set to the boot partition (/boot), the other partitions, the remainder, can be set to RAID 0 and span both drives and set to root partition (/).

Another solution, one that I and several other people recommend, it is actually the setup I made in my original post mention earlier.

Keep you current RAID 0 setup, but configure it as your home partition (/home). Go and buy a 8 gig thumb drive, partition into 2 partitions. The first at 6 gig and set it as your root directory (/), and the remainder set as a swap drive (/swap), the ratio being 3:1 which is more than the recommended between root and swap. Then install your operation system as you normally would on the root drive, and your RAID 0 will be use entirely for you Home folder. Which will be ideal if you plan to encrypt your home directory. All that to say, a solid state drive like a thumb drive will be 1: bootable 2: reliable ( RAID 1 although bootable unlike RAID 0, can be a bit unreliable)

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix