Topic: Grug.cfg gives me only one choice when booting.

And it isn't Crunchbang.
I'm running a multiboot system.  been doing it for years. I don't doubt (much) that UUID is a better plan than just identifying the partitions in ordinary "human readable terms" like /dev/sda#.  Or that Grub2 is better than legacy grub. But I was getting pretty good with the old systems, and now I'm thouroughly confused.

I am given only the choice to boot into Mint9 (on /dev/sda3). Nothing else appears in the menu.  But the menu that I see is the menu that is put out by the grub.cfg on the Crunchbang partition (/dev/sda2). Obviously running "update grub from Mint9 on /dev/sda3 has no effect on grub.cfg on /dev/sda2.  I can go in as root, and look at or edit grub.cfg on /dev/sda2, but I have no idea what is wrong with it. When I look at grub.cfg (the one for Crunchbang on /dev/sda2) I can see that it has more than just Mint9.  It has a couple of "stansas" for Crunchbang (Statler), and a couple of Stanzas for Fedora.  But they don't show when I am booting, so I can't boot into either one of those.

The problem might have arisen because I used Gparted to reformat several partitons, thus eliminating several operating systems that I decided I'm not going to use..  A couple of these were at the tail end of the drive, and I deleted the empty contiguous  partitions and then formed of the resulting space one larger partition.  That seems to have confused the "UUID" system, even though I made no changes to the partitions now are seemingly being miss identified, or left out of the loop.

At this point mint9 is the distro that I would use the most anyway, but I would like to be able to at least get into Crunchbang10 xfce to try it out.

Re: Grug.cfg gives me only one choice when booting.

If mint uses grub2 then I suppose you could try reinstalling grub2 while running Mint

/usr/sbin/grub-install --recheck --no-floppy /dev/sda

then 

update-grub

  The new grub will look for any bootable kernel and add it to the  boot menu but this may leave you with an unbootable system, I have successfully done this a few times but you may have introduced a few extra problems into your setup with the partition shuffling you have been doing. If you did end up with an unbootable system you would then need a live distro and chroot to reinstall grub2.

Re: Grug.cfg gives me only one choice when booting.

Often, when grub.cfg has some menu entries whihc are not actually displayed, it is cause those menu entries are wrong!
First of all: can you post your grub.cfg please, otherwise we don't know what we're working on!
Also, please tell us which partitions #! uses (and with which mountpoints).

After you've done so, we can start thinking up something, otherwise it's impossible.

Also, it's not necessary to reinstall grub from mint: you can always use chroot to work like into your #! from mint!

Re: Grug.cfg gives me only one choice when booting.

I have just posted my grub.cfg file in Pastebin.  Line 66 is the only line that shows in the menu. #! is installed on partiton  /dev/sda2 and mounted as /      Home is on /dev/sda7  under usename cb.  sda7 is mounted as /home   
Mint9 does use grub2, and I have no problem with the idea of booting from there, but I probably wold have a battle with the chroot procedure, so for now I have left it like it is. Mint9 is (has been for awhile) my 'default' distro.


xaber wrote:

Often, when grub.cfg has some menu entries whihc are not actually displayed, it is cause those menu entries are wrong!
First of all: can you post your grub.cfg please, otherwise we don't know what we're working on!
Also, please tell us which partitions #! uses (and with which mountpoints).

After you've done so, we can start thinking up something, otherwise it's impossible.

Also, it's not necessary to reinstall grub from mint: you can always use chroot to work like into your #! from mint!

Re: Grug.cfg gives me only one choice when booting.

5littlejoe5 wrote:

the menu that I see is the menu that is put out by the grub.cfg on the Crunchbang partition (/dev/sda2). Obviously running "update grub from Mint9 on /dev/sda3 has no effect on grub.cfg on /dev/sda2.

Are you sure the menu you're getting is coming from sda2? Have you tried 'update-grub' on mint on sda3? Just a thought...

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Grug.cfg gives me only one choice when booting.

Yes the menu from sda2 is #! and it is the menu that appears. I realise that running update-grub from mint9 won't upgrade that menu. I had modified the menu that #! gave me at install, so as to put mint9 in the first position. But in doing so lost the rest of the menu. At boot up, nothing but one line (that for booting to mint9) shows.  I'm sure there is a way to make the switch so that grub will use the mint9 grub.cfg, but haven;t tried that and would rather fix the grub.cfg on sda2.

johnraff wrote:
5littlejoe5 wrote:

the menu that I see is the menu that is put out by the grub.cfg on the Crunchbang partition (/dev/sda2). Obviously running "update grub from Mint9 on /dev/sda3 has no effect on grub.cfg on /dev/sda2.

Are you sure the menu you're getting is coming from sda2? Have you tried 'update-grub' on mint on sda3? Just a thought...

Re: Grug.cfg gives me only one choice when booting.

5littlejoe5 wrote:

Yes the menu from sda2 is #! and it is the menu that appears.

Ah, sorry i forgot the #! menu has a splash screen so you can tell it right away.

I ...would rather fix the grub.cfg on sda2.

As you've suggested, maybe the uuids have changed. Try running gparted - you can get the uuids for all your partitions and compare with the working mint grub.cfg and the broken one on sda2.

btw It's not recommended to edit /boot/grub/grub.cfg by hand in Grub 2. The first file to look at is /etc/default/grub, but there's other stuff...
https://help.ubuntu.com/community/Grub2

Last edited by johnraff (2010-10-14 16:18:56)

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Grug.cfg gives me only one choice when booting.

5littlejoe5 wrote:

I had modified the menu that #! gave me at install, so as to put mint9 in the first position. But in doing so lost the rest of the menu. At boot up, nothing but one line (that for booting to mint9) shows.

You never mentioned this before, how did you edit the menu, normally after an edit you need to run update-grub which would mean the grub that CB has but from what you have said you have never run CB. My original suggestion to reinstall grub from Mint then update should sort your problem out and you will end up with the option to boot CB, once running CB you could then reinstall grub there if you want the CB boot splash although Mint would be at the bottom of the list, you could edit /etc/default/grub to change this and run update-grub and you should then have the CB boot menu but with Mint first.

Re: Grug.cfg gives me only one choice when booting.

(titan's advice sounds sensible.)

...just thought - is your #! /etc/fstab OK?
If the UUIDs of some partitions have changed and the entries in fstab are wrong #! won't be able to boot. Might be worth checking.

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Grug.cfg gives me only one choice when booting.

I know that they don't recommend that you edit grub directly, but it is possible, And since I have found no understandable and thourough documentation on Grub 2 ( #! Die-hard:  I'll have a good look at the one you have recommended). I have opted to ignore that advice - several times now.  This is the first time I've really had any considerable trouble with editing it. Of course after such an edit one must take precautions not to run update-grub unless you have fouled it up and want to start over.  On previous occasions, also, when I took the liberty of editing grub.cfg,, I also made a backup copy of it first just in case.  This time, I forgot and skipped that step. (bad mistake).

Grub 2 may be "Better" than the old grub, and UUIDs may be better than the older descriptions (/dev/sda#), but I haven't seen any evidence of it.  I wish therer were a convenient way to get rid of both.

Don't know if it matters or not, but I erred in a previous communication about /home.  It is not on /dev/sda7, but on /dev/sdb2.

I did go to fstab on /dev/sda2   (from mint9: /mnt/sda2/etc/fstab) and edit it, but I don't know how to figure out what the UUID is supposed to be. I replaced the UUID there with the old style description /dev/sda2.  Didn't work.  I find this command suggested  at the beginning of  grub.cfg as a way to get the proper UUID: "vol_id   --uuid" . I assume that "vol-id" means in this case: /dev/sda2, But running the command as root from mint9 returns "permission denied" .

Thanks guys.  I'll spend some time with https://help.ubuntu.com/community/Grub2 as soon as I get a chance, and see if I can figure it out.

Re: Grug.cfg gives me only one choice when booting.

5littlejoe5 wrote:

I did go to fstab on /dev/sda2   (from mint9: /mnt/sda2/etc/fstab) and edit it, but I don't know how to figure out what the UUID is supposed to be.

johnraff wrote:

Try running gparted - you can get the uuids for all your partitions...

smile Of course there are other ways of getting the UUIDs but this might be the easiest. gparted's quite a handy tool anyway. 'blkid' is another one to try.

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Grug.cfg gives me only one choice when booting.

@5littlejoe5

Update:  I should have read and went to JohnRaf's link above before I posted.  https://help.ubuntu.com/community/Grub2   It's 100 times better than the grub2 manual or what I wrote below. I'll still leave my post mostly intact. 

To find where grub2 is installed (should be Crunchbang) type in exactly don't substitute the device "sudo grub-probe -t device /boot/grub"   To find the UUID number type in "sudo grub-probe -t fs_uuid /boot/grub".

Here is the part of grub.cfg that starts your computer.  Replace the UUID and block numbers and put back into grub.cfg to see if it works.  There should be no other entries in this block.  As soon as you get Crunchbang booted up, run sudo update-grub.

### BEGIN /etc/grub.d/10_linux ###
menuentry "CrunchBang Linux, with Linux 2.6.32-5-686" --class crunchbang --class gnu-linux --class gnu --class os {
    insmod ext2
    set root='(hd0,2)'
    search --no-floppy --fs-uuid --set afbf0da6-1f35-4389-827e-2bff41f58d16
    echo    Loading Linux 2.6.32-5-686 ...
    linux    /boot/vmlinuz-2.6.32-5-686 root=UUID=afbf0da6-1f35-4389-827e-2bff41f58d16 ro  quiet
    echo    Loading initial ramdisk ...
    initrd    /boot/initrd.img-2.6.32-5-686
}
menuentry "CrunchBang Linux, with Linux 2.6.32-5-686 (recovery mode)" --class crunchbang --class gnu-linux --class gnu --class os {
    insmod ext2
    set root='(hd0,2)'
    search --no-floppy --fs-uuid --set afbf0da6-1f35-4389-827e-2bff41f58d16
    echo    Loading Linux 2.6.32-5-686 ...
    linux    /boot/vmlinuz-2.6.32-5-686 root=UUID=afbf0da6-1f35-4389-827e-2bff41f58d16 ro single
    echo    Loading initial ramdisk ...
    initrd    /boot/initrd.img-2.6.32-5-686
}
### END /etc/grub.d/10_linux ###

Grub’s  menu  for grub 1.98
( http://www.gnu.org/software/grub/manual/grub.html )

To change the menu so that Mint loads first, you "sudo gedit /etc/default/grub" and change the GRUB_DEFAULT=0  line  to  GRUB_DEFAULT=2  or whatever menu line Mint is on (see below).  Then, you type "sudo update-grub" to make the changes. When menu comes up, the default you have chosen will be selected and loaded automatically but will not be at the top.

The UUID's of a partition don't change unless you have somehow changed the size of them with some utility - that's why linux is going to UUID's. Grub2 is pretty smart. I believe the only problems that grub2 now has is if you have 1 Ide and 1 eSata drive and you have the eSata drive as primary. This can be fixed by editing the map files. The more you use the UUID's, the more accurate grub will be because it won't have to guess.  In my case I had a primary hard drive failure.  I plugged up my secondary drive to the primary connections and did not have any problems with any of the distros. The UUID's have been in play now every since the Hardy distro so you shouldn't have many UUID's to change.  You shouldn't be doubting a UUID and changing it to block device numbers unless you used some kind of utility to change the size of that partition. 

================= MAIN PART - READ THIS FIRST IF SHORT ON TIME
Do you still have grub-legacy on your mint installation?  You can go into Synaptic and lookup grub to make sure you installed grub-pc and grub-common and not grub-legacy. I noticed that you have mint on /dev/sda3 and crunchbang on /dev/sda2.  Did you install mint after you installed crunchbang? What type of grub update did you do on mint?  Personally, I would just re-install Crunchbang on the same installation and then install grub2 on the root drive or use your livecd to reinstall grub2 to Crunchbang. It's best to use a livecd because changes to the MBR of a root drive is not good while using that hard disk. 

What you could try is to get the UUID of the Crunchbang partition by using "blkid", get the kernel number by connecting to the Crunchbang partition and through /media or /mnt, etc go to Crunchbang's /boot directory and write down the kernel number. I believe it is 2.6.32-5-686. Next, reboot and when the menu comes up, press "e" to edit.  Substitute the UUID numbers and the kernel numbers and the '(hd0,2)' block device, and then type in "Control-X" to boot.  If the system boots up, bring up a terminal and type "sudo update-grub". In the example below on adding manual setups, I entered what I think the kernel will be and the block numbers if crunchbang is on /dev/sda2.

Good Luck
====================

TO ADD MANUAL SETUPS TO GRUB:
Even if your system is working just fine, you still can add extra setups just for practice and to learn how to do it.  Copy your 40_custom to a new 07_custom directory with the p option to preserve all the attributes so it will work.  Now anything you put in 07_custom will come up first on your menu.
If you leave it empty it's fine too.  You can still put menu items in 40_custom but they will come up last.  You can sudo gedit /etc/default/grub and Uncomment #GRUB_DISABLE_OS_PROBER="true" and then there would only be your custom menu and then the menu item for that machine.  The trouble with this is that you would have to change that back anytime you add a distro or make changes so grub would pick up the new information.

sudo cp -p /etc/grub.d/40_custom /etc/grub.d/07_custom

Open up grub.cfg in read-only mode just to copy your menu items exactly as they should be.
gedit /etc/default/grub/grub.cfg 

Open up your 07_custom file to put your customized menu in.  After opening file, you can right click on the gedit tab and put in a new window so you easily transfer the items.  I just copy all of the menu items and then move them around, put comments in front of the ones I don't want to show up, etc.  Don’t mess with top 5 lines, just add your menu entries below them.
sudo gedit  /etc/grub.d/07_custom   

Example of what it may look like:
menuentry "Crunchbang" {
    insmod ext2
    set root='(hd0,2)'
    search --no-floppy --fs-uuid --set 1f8d9520-61de-4a79-96d7-415643248c73
    linux /boot/vmlinuz-2.6.32-5-686 root=UUID=1f8d9520-61de-4a79-96d7-415643248c73 ro
    initrd /boot/initrd.img-2.6.32-5-686
}
menuentry "Mint 9, kernel 2.6.26-2-686 (on /dev/sda3)" {
    insmod ext2
    set root='(hd0,3)'
    search --no-floppy --fs-uuid --set 1f8d9520-61de-4a79-96d7-415643248c73
    linux /boot/vmlinuz-2.6.26-2-686 root=UUID=1f8d9520-61de-4a79-96d7-415643248c73 ro
    initrd /boot/initrd.img-2.6.26-2-686
}

Save file and then run “ sudo update-grub” and then reboot.
Note:  The first two menu items in grub.cfg (for that machine) have extra settings on them that the others do not, I copy exactly and they work fine in your custom menu also.

You said you were used to the old grub methods, here's something that has changed.  You don't have to worry about this if you copy the setups from grub.cfg.
Grub2 numbers partitions starting with 1 whereas the old grub-legacy numbered them starting with 0. Example:  (hd0,0)  will now be a (hd0,1).
sda1  (hd0,1)  used to be (hd0,0) to put on partition,  on root it is  (hd0) NOT CHANGED
sda2  (hd0,2)  used to be (hd0,1)
sda3  (hd0,3)  used to be (hd0,2)
The hdo partition number is now the same as the linux sdx numbers.

HOW TO EDIT THE GRUB CONFIG FILE
sudo gedit /etc/default/grub  to make changes and then run ‘sudo update-grub’.

#Set for which menu choice you want to boot starting with 0,1,2,3,........
GRUB_DEFAULT=0    (0 for 1st menu choice, 1 for second menu choice, ........)

# Set for seconds for boot or set to negative number to disable boot
GRUB_TIMEOUT=-5   

# Add any kernel additions you want to add here
GRUB_CMDLINE_LINUX_DEFAULT="quiet"

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

# Uncomment to disable generation of recovery mode menu entries (second entry)
#GRUB_DISABLE_LINUX_RECOVERY="true"
I tested this one, it only left out the recovery on the first menu item not on all the other partitions.

# Uncomment to disable grub from picking up setups from the other partitions.
#GRUB_DISABLE_OS_PROBER="true"
There are many more settings, check the manual.

Note: Command vol_id no longer exists, it was removed 2009-05-11  https://launchpad.net/ubuntu/+source/ud … gitf079968 . You can type  "sudo blkid" or "ls -l /dev/disk/by-uuid" to see the device name and UUID.

Hope this helps your transition.  Good Luck

Last edited by duck (2010-10-19 09:13:47)

Re: Grug.cfg gives me only one choice when booting.

Thanks Duck (and all of you).  I'm in the midst of preparing to go to Mexico on a missionary project. Which means I'm going to have to live with this for the moment until I can find time to deal with it.  Probably a month or so.  I'll keep all of this info handy, and see what I can do, and then get back to you.   Thanks again.

Re: Grug.cfg gives me only one choice when booting.

Since I'm new on forum, the other day I went to pastebin.com and did a search on your name with no luck.  Just today I noticed the link at the top of the page.  I looked over your post and posted a reply at pastebin. 

This is where your startup for Crunchbang is suppose to be.  Everything else is in grub.d/30_os-prober.
### BEGIN /etc/grub.d/10_linux ###
### END /etc/grub.d/10_linux ###

I took out your Mint setup that was in there and put Crunchbang back in place.  There was a duplicate 10_linux block next that was mispelled.  This is most likely where the script or code that runs the grub menu stop working.
You need to delete those lines.  There also was a recordfail line in front of one of the Mint lines.  I believe this should be removed.   Remember after it boots up to run   sudo update-grub  to fix everything.

Re: Grug.cfg gives me only one choice when booting.

Thanks, Duck.  That is a good start toward getting it in order. I've been too busy to follow all the way through, but I did copy your corrections into place, and it booted giving me multiple choices.