LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 11-08-2009, 03:21 PM   #1
dreamweaver547
LQ Newbie
 
Registered: Nov 2009
Location: England
Distribution: Ubuntu 9.10, OpenSUSE 11.2
Posts: 28

Rep: Reputation: 15
Ubuntu 9.10 - Grub 2 editing


I was wondering if anyone's had any experience of editing GRUB 2 (version 1.97-beta4)?

Have managed to change
Code:
GRUB_TIME_OUT=-1
to give myself a chance to select an operating system, but am looking to edit the boot order and later on (maybe) install a new o/s. In the earlier version of grub the order was changed from
Code:
/boot/grub/menu.lst
But now it's not recommended to change anything in
Code:
boot/grub/grub.cfg
, so am I stuck with this boot order?

If I installed another linux operating system what is the procedure for updating in this version of GRUB?

Thanks
 
Old 11-08-2009, 04:10 PM   #2
tom4everitt
Member
 
Registered: Jan 2009
Location: Stockholm
Distribution: Fedora, Ubuntu, Mac OS X
Posts: 78

Rep: Reputation: 23
This guide is probably what you're looking for, it explains most of the basic differences between grub 1 and 2:

https://wiki.ubuntu.com/Grub2


I believe you can change the os order (I think its explained how to in the guide).

In short grub.cfg is auto generated from some other configuration files, which you can edit. Exactly what and where you can change stuff is in the guide.

Last edited by tom4everitt; 11-08-2009 at 04:13 PM.
 
Old 11-09-2009, 01:18 PM   #3
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
There is a lot of good info in this link;

http://ubuntuforums.org/showthread.php?t=1305113

It is a brief intro but the links are great. The first 3 are particularly useful.
 
Old 11-09-2009, 01:37 PM   #4
dreamweaver547
LQ Newbie
 
Registered: Nov 2009
Location: England
Distribution: Ubuntu 9.10, OpenSUSE 11.2
Posts: 28

Original Poster
Rep: Reputation: 15
This is nowhere near as simple as the previous GRUB version where I just cut and paste the order from /boot/grub/menu.lst

All I'm looking to do is to change the display order to make Ubuntu first and XP second followed by memtest and everything else, and I'm dubious about cutting and pasting anything.

Can't seem to get clarity from this documentation unless I'm missing something somewhere...
 
Old 11-09-2009, 02:02 PM   #5
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
The right way to do this would be to cut and paste your entries from /boot/grub/grub.cfg to /etc/grub.d/40_custom in this form;
Code:
echo "Adding Main on sda6 (2.6.24-24-generic)" >&2 
cat << EOF
menuentry "Main, kernel 2.6.24-24-generic (sda6)" {
	set root=(hd0,6)
	search --no-floppy --fs-uuid --set e2e3cd65-bc09-487f-be96-a83fcc282e38
	linux /boot/vmlinuz-2.6.24-24-generic root=UUID=e2e3cd65-bc09-487f-be96-a83fcc282e38 ro quiet vga=773
	initrd /boot/initrd.img-2.6.24-24-generic
}
EOF
that is an entry for hardy.

For my grub2 using OS' I use;
Code:
echo "Adding Lounge on sda7" >&2 
cat << EOF
menuentry "Lounge on sda7" {
    set root=(hd0,7)
        linux /vmlinuz root=/dev/sda7 so quiet splash
        initrd /initrd.img
}
EOF
that is a great entry. It never needs updated. It works if you change the OS from 9.04 to 9.10 (or in this case 10.04testing).

If you cut paste the info from your /boot/grub/grub.cfg it needs the;
Code:
echo "Adding Lounge on sda7" >&2 
cat << EOF
before the entry and;
Code:
EOF
after it. Make sure you get the last } in the right place.

Should look something like this;
Code:
echo "Adding Stoned-Lizard1.0 on sda8" >&2 
cat << EOF
menuentry "Ubuntu, Linux 2.6.32-2-generic" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
	set quiet=1
	insmod ext2
	set root=(hd0,8)
	search --no-floppy --fs-uuid --set 97dd103f-06ce-4aa8-a3aa-307ad432c355
	linux	/boot/vmlinuz-2.6.32-2-generic root=UUID=97dd103f-06ce-4aa8-a3aa-307ad432c355 ro   quiet splash
	initrd	/boot/initrd.img-2.6.32-2-generic
}
EOF
When you get your file built, save it as 06_custom and then it will be at the top of your menu on the screen.

You will need to run;
Code:
sudo update-grub
This will over write your /boot/grub/grub.cfg file and impliment the changes. That is how it is done.

If this is to much. Check the link to the intro I gave you before. Somewhere toward the bottom of the link listed there in, is one about something like "if grub2 is too much". It will guide you to have grub-legacy. Follow the directions, there are pitfalls you do NOT want to deal with.

Remember that grub-legacy (0.97) is no longer supported.
 
Old 11-10-2009, 01:24 PM   #6
dreamweaver547
LQ Newbie
 
Registered: Nov 2009
Location: England
Distribution: Ubuntu 9.10, OpenSUSE 11.2
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks - I will run a test on this at some point on another pc and if it works, will do this on my main pc.
 
Old 11-10-2009, 02:54 PM   #7
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 497Reputation: 497Reputation: 497Reputation: 497Reputation: 497
Well, I can't fault you for caution at all.

That said, the worst that will happen is that the custom entries will not work. The rest of the menu will still be there in the same way it is now.

When I first installed Ubuntu, I broke it 5 times in 7 days by too much playing with it. That is when I started down the path to multi boot. I dual booted Hardy/Hardy and did nothing on the "main" install with out trying it in my "play" install. So I really do understand where you are coming from.
 
  


Reply



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
Editing Grub. borntorunes Linux - Newbie 10 10-05-2009 06:16 AM
Editing GRUB colinstu Linux - General 3 01-26-2008 05:04 AM
DualBooting with GRUB ; Need Help Editing GRUB blooperspree Linux - Software 2 11-04-2006 11:23 AM
Editing Grub Permaximus Linux - Newbie 9 09-22-2004 09:14 AM
editing grub pcmatt Linux - General 7 11-21-2002 10:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 06:05 PM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration