Grub2 and multiple boot different ubuntu versions

Karl Larsen klarsen1 at gmail.com
Thu Mar 25 13:10:15 UTC 2010


On 03/24/2010 09:28 PM, NoOp wrote:
> On 03/24/2010 07:09 PM, Goh Lip wrote:
>    
>> NoOp wrote:
>>
>>
>>
>>      
>>> So how would you advise a standard multiboot user to edit this:
>>>
>>>        
>> In Collin's case, where he wants Karmic to be the default chosen, cut the
>> whole bunch of karmic's entries and paste it *above* the lucid's entries.
>> First entry below the .d10
>>
>>
>>      
>>> You see, it will take quite a bit of work to do that, and a single
>>> mistake could bork grub2 in the process. Plus, how do you keep it updated?
>>>        
>> True, but always good to copy the original of anything before modifying.
>> Grub.cfg also keeps a back-up file.
>>      
>>> While I very much respect your advise&  opinions, I seriously doubt that
>>> modifying grub2 is easier than the former menu.lst and/or 'not much of a
>>> hassle'.
>>>        
>> Somehow, it seems that way to me.
>>      
> I'll try on a test system tomorrow. However, I think that your advise to
> edit the grub.cfg file is mistaken and is dangerous to those without
> 'test' systems. For instance:
>
>    
>>> ### BEGIN /etc/grub.d/20_memtest86+ ###
>>> menuentry "Memory test (memtest86+)" {
>>> 	insmod ext2
>>> 	set root='(hd0,8)'
>>> 	search --no-floppy --fs-uuid --set<snipped>
>>> 	linux16	/boot/memtest86+.bin
>>> }
>>> menuentry "Memory test (memtest86+, serial console 115200)" {
>>> 	insmod ext2
>>> 	set root='(hd0,8)'
>>> 	search --no-floppy --fs-uuid --set<snipped>
>>> 	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
>>> }
>>> ### END /etc/grub.d/20_memtest86+ ###
>>>        
> So would I need to delete all of the above or just the
>    
>>> }
>>> menuentry "Memory test (memtest86+, serial console 115200)" {
>>> 	insmod ext2
>>> 	set root='(hd0,8)'
>>> 	search --no-floppy --fs-uuid --set<snipped>
>>> 	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
>>> }
>>>        
> part? Would a standard user have an inkling of how to do the above even
> if given clear instructions? Is this even the right place to
> edit/modify? Afterall the begining of the file states:
>
> <quote>
> # DO NOT EDIT THIS FILE
> #
> # It is automatically generated by /usr/sbin/grub-mkconfig using templates
> # from /etc/grub.d and settings from /etc/default/grub
> </quote>
>
> So I think that you are advising users to venture into files that
> perhaps the standard user should not. There must be a better/safer way
> to do all of this.
>
>
>
>
>
>
>
>    
             I think the whole idea of Grub2 is bad. That said we must 
at least try to use the method provided by the Grub2 staff that is given 
in the file /boot/grub/grub.cfg.

# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub

     I just opened a Terminal and typed grub-mkconfig and it said:

karl at Lucid:~$ grub-mkconfig
/usr/sbin/grub-mkconfig: You must run this as root

     Fine no problem and I did this and got this:


karl at Lucid:~$ sudo grug-mkconfig
[sudo] password for karl:
sudo: grug-mkconfig: command not found
karl at Lucid:~$

     Why did this happen? Is this an error? Should it be reported as a 
bug? Without the sudo it finds the file and reports you must be a root 
login.

     Continuing you cd to /usr/sbin and try again. I get a long list of 
my system. Too long for this message. The end has this cryptic things:

}
menuentry "Ubuntu 9.04, memtest86+ (on /dev/sda9)" {
     insmod ext2
     set root='(hd0,9)'
     search --no-floppy --fs-uuid --set 6bae2f33-aff5-42ca-b2cc-65cea5be3cc8
     linux /boot/memtest86+.bin
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply 
type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
done
karl at Lucid:/usr/sbin$

     So I go looking for /etc/grub.d/40_custom. It gets weird in the 
extreme:

karl at Lucid:/usr/sbin$ cd
karl at Lucid:~$ cd /etc/grub.d/
karl at Lucid:/etc/grub.d$ ls
00_header        10_linux       30_os-prober  README
05_debian_theme  20_memtest86+  40_custom
karl at Lucid:/etc/grub.d$ ls -al
total 56
drwxr-xr-x   2 root root  4096 2010-03-23 06:21 .
drwxr-xr-x 136 root root 12288 2010-03-25 06:44 ..
-rwxr-xr-x   1 root root  4444 2010-03-09 17:16 00_header
-rwxr-xr-x   1 root root  1416 2010-03-03 14:59 05_debian_theme
-rwxr-xr-x   1 root root  4548 2010-03-09 17:16 10_linux
-rwxr-xr-x   1 root root   918 2010-02-22 09:25 20_memtest86+
-rwxr-xr-x   1 root root  6605 2010-02-01 08:55 30_os-prober
-rwxr-xr-x   1 root root   214 2010-02-01 08:55 40_custom
-rw-r--r--   1 root root   483 2010-02-01 08:55 README
karl at Lucid:/etc/grub.d$ more 40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply 
type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
karl at Lucid:/etc/grub.d$

     It tells you nothing about how to enter a new entry! It tells you 
nothing about how to just move one entry in front of another.  It is the 
very worst way to do things!!!

     I decided to look at README which is a big help to a beginner!

arl at Lucid:/etc/grub.d$ more README

All executable files in this directory are processed in shell expansion 
order.

   00_*: Reserved for 00_header.
   10_*: Native boot entries.
   20_*: Third party apps (e.g. memtest86+).

The number namespace in-between is configurable by system installer and/or
administrator.  For example, you can add an entry to boot another OS as
01_otheros, 11_otheros, etc, depending on the position you want it to 
occupy in
the menu; and then adjust the default setting via /etc/default/grub.
karl at Lucid:/etc/grub.d$

     Well, I wonder what /etc/default/grub looks like?

karl at Lucid:/etc/default$ more grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to 
Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
--More--(87%)


     OK, this appears to be where to start, not to end.


     I will continue to try and change something using the lousy 
instructions given in /boot/grub/grub.cfg. But no one can say this is 
something a new linux user is going to do right the first time!!


73 Karl














More information about the ubuntu-users mailing list