PDA

View Full Version : [SOLVED] Can't avoid boot time offers of broken systems. Help?



desconocido
June 9th, 2010, 12:36 PM
After a disastrous attempt to upgrade Ubuntu 8.04 to 8.10 (system would not boot), I partitioned the disk in two and installed 9.10 on the new partition.
The old data was still available so I copied my old home directory on top of my new one thus:
cd /media/bd.....d0/home
sudo cp -r --preserve=all -t /home ./bob

I have managed to re-install all my software, but a few problems remain.
Here is one of them:

In spite on marking (with Palimpsest Disk Utility) the old partition (with 8.04/8.10 on it) as not bootable, at boot time I get offered three versions of Ubuntu 8.10 as well as 9.10 and the corresponding recovery mode boots etc. Any idea how to get rid of these options without formatting the partition?

Thanks.

darkod
June 9th, 2010, 01:20 PM
Grub doesn't care whether a partition has the boot flag or not. Until you have the kernel files existing on the 8.10 partition (because you didn't format it), it will get detected as another OS.

What you might do is disable 30_os-prober temporarily, not to look for other OSs. But if you actually want to find another OS, you either have to enable it again or make manual entry in 40_custom.

To disable the executive bit:

sudo chmod -x /etc/grub.d/30_os-prober

If you want to enable it later just use the same command with +x.

To update the grub.cfg file after that:

sudo update-grub

desconocido
June 10th, 2010, 08:00 PM
I think I may have misunderstood you.

I deleted all the kernel files on the 8.10 partition (In fact I deleted the /boot folder and the link files to kernels in / ).

But it had no effect. Is there some other kernel file I could delete? I don't need the linux on this partition, just maybe a few of the application files.

darkod
June 10th, 2010, 08:33 PM
If you deleted the kernels, you can just boot 9.10 and in terminal rub:

sudo update-grub

That should remove 8.10 from the grub menu because there will be no kernels to detect.

desconocido
June 11th, 2010, 07:24 PM
Thanks, that got rid of three x two of the 8.10 boot offers.

I still have two unwanted boot offers:

Memory Test (memtest86+)
Memory Test (memtest86+, serialconsole 115200)

amd of course 9.10 and its recovery mode. I just want it to stop asking me which boot I want.

(By the way, once I get down to just these last two options, will it stop asking me which I want?)

This is what my /boot/grub/grub.cfg file looks like after running sudo update-grub


#
# 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
#

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set 1a2dbb4a-862c-4083-a7df-d01eb8034711
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set 1a2dbb4a-862c-4083-a7df-d01eb8034711
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=1a2dbb4a-862c-4083-a7df-d01eb8034711 ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set 1a2dbb4a-862c-4083-a7df-d01eb8034711
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=1a2dbb4a-862c-4083-a7df-d01eb8034711 ro single
initrd /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### 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 ###


and the contents of directory /etc/grub.d

$ ls -al
total 48
drwxr-xr-x 2 root root 4096 2009-10-28 22:03 .
drwxr-xr-x 144 root root 12288 2010-06-11 20:02 ..
-rwxr-xr-x 1 root root 3296 2009-10-24 02:44 00_header
-rwxr-xr-x 1 root root 1154 2009-10-24 02:31 05_debian_theme
-rwxr-xr-x 1 root root 3778 2009-10-24 02:44 10_linux
-rwxr-xr-x 1 root root 772 2009-10-23 18:11 20_memtest86+
-rwxr-xr-x 1 root root 5332 2009-10-24 02:44 30_os-prober
-rwxr-xr-x 1 root root 214 2009-10-24 02:44 40_custom
-rw-r--r-- 1 root root 483 2009-10-24 02:44 README

darkod
June 11th, 2010, 08:59 PM
Now that 8.10 is gone from the list, it shouldn't show a boot menu asking what OS you want, because there is only one, 9.10.

You can make the memtest disabled by:

sudo chmod -x /etc/grub.d/20_memtest86+

You need to run:

sudo update-grub

after that.

But memtest is not an OS and it doesn't have influence whether the boot menu is shown or not.

desconocido
June 14th, 2010, 05:12 PM
Yes, thanks, so I did that and the "### BEGIN /etc/grub.d/20_memtest86+ ###" section vanished from my /boot/grub/grub.cfg file.

Now when I boot, I only get two options, which relate to Ubuntu 9.10:
Ubuntu, Linux 2.6.31-14-generic
Ubuntu, Linux 2.6.31-14-generic (recovery mode)

Still trying to get rid of being offered options!

I notice you say "...and it doesn't have influence whether the boot menu is shown or not." So I wonder what does.

A couple of things I noticed. I installed grub and ran it and get this output:

grub> find /boot/grub/stage1

Error 15: File not found

(this is supposed to be a clean install of Ubuntu 9.10)

And the partition structure according to Palimpsest is

Partition 1 /dev/sda1 ext3 (this contains the wreck of the 8.10 Ubuntu)
Partition 2 /dev/sda2 unrecognised, contains logical partitions:
Partition 5 /dev/sda5 ext4 (mounted at / and is the 9.10 Ubuntu)
Partition 6 /dev/sda6 swap

Palimpsest does not mark partition 5 as bootable.

darkod
June 14th, 2010, 06:12 PM
I don't know. When you have a single OS there should not be a boot menu, instead it should boot ubuntu directly.
There are settings in the grub2 config file /etc/default/grub but if you haven't touched them, by default they should not show a menu when ubuntu is the only OS.

desconocido
June 15th, 2010, 07:06 PM
I tried the experiment of editing /boot/grub/grub.cfg to remove the menu item for the second (recovery mode) boot.

Now when I boot I get a menu with one item in it!

I think there is a problem with grub versions because

$ grub-install -v
grub-install (GNU GRUB 0.97)
says I have the legacy grub whereas this document https://help.ubuntu.com/community/Grub2 suggests that my boot folder has been set up for Grub2 because of the missing files such as stage1.

I am going to have a good read of that document.

Thanks.

darkod
June 15th, 2010, 07:55 PM
In your first post you said you made a clean install of 9.10. A clean install of 9.10 would always have grub2.

Unless there was some confusion with the unsuccessful upgrade, copying files back from the old installation, etc.

That's why I didn't even think of asking about the version of grub. Karmic comes with grub2.

desconocido
June 16th, 2010, 07:29 PM
Yes, I have now looked at the heading of the boot screen. It says something like Grub 1.97~Beta4.

However the command grub-install -v
gives

grub-install (GNU GRUB 0.97)


sudo grub-probe -t device /boot/grub
says
/dev/sda5which is where I would expect it be.

I only copied files from /home from the failed 8.10 partition to the 9.10 partition.

So, I have done the following:
a) Installed all the Ubuntu security updates.
b) followed the advice in https://help.ubuntu.com/community/Grub2

GRUB_HIDDEN_TIMEOUT=0 on single operating system computers.

* No menu is displayed. The system is immediately booted to the default OS.
* This is the default setting with only one identified operating system.
and edited the file /etc/default/grub, uncommented the line GRUB_HIDDEN_TIMEOUT=0, making the active lines now

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=""

saved the file and ran sudo update-grub thus:

Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.31-22-generic
Found kernel: /boot/vmlinuz-2.6.31-14-generic
Found GRUB 2: /boot/grub/core.img
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done

I rebooted and I still get the boot menu! Aaargh.

darkod
June 16th, 2010, 07:47 PM
Does the menu you get say something like:

ubuntu 2.6.31-22
ubuntu 2.6.31-14
chainload to grub2



Found GRUB 2: /boot/grub/core.img

desconocido
June 18th, 2010, 12:52 PM
Does the menu you get say something like:

ubuntu 2.6.31-22
ubuntu 2.6.31-14
chainload to grub2

No, it's more like

ubuntu 2.6.31-14
ubuntu 2.6.31-14 (recovery mode)

Updating the kernel on sda5 did not seem to inform Grub/Grub2 that there was a new kernel. I wonder if it is confused between stuff on the disk's boot sector and stuff in the partition's booot sector, if that's the right terminology? More later.

darkod
June 18th, 2010, 01:35 PM
The grub-install -v reporting grub 0.97 shows there is a grub1 installation. Also the update-grub reports grub2 found, which it shouldn't.

The situation is similar to when you start an upgrade process from grub1 to grub2, because it has two stages. First it only creates chainload to grub2 so you can check if it's working fine, and then you finish the upgrade with a command.

Maybe that would explain grub menu showing with only ubuntu installed. But you never did start a grub1 upgrade process, with the 9.10 clean install you shouldn't have grub1 at all.

Otherwise, if you want to try and see what happens, the command to finish off the upgrade grub1 process is:

sudo upgrade-from-grub-legacy

desconocido
June 18th, 2010, 04:23 PM
Otherwise, if you want to try and see what happens, the command to finish off the upgrade grub1 process is:

sudo upgrade-from-grub-legacy

That makes me a bit nervous! I have just spent what feels like three weeks re-installing all my software onto 9.10. Would the following be safer and would it work? :-

a) copy remaining /home data from old /dev/sda1 (8.04/8.10) partition to new /dev/sda5 (9.10);
b) clean install 9.10 on old partition /dev/sda1;
c) security update /dev/sda1 and get the latest kernel;
d) copy the whole of / (including /home) from /dev/sda5 to /dev/sda1 except for /boot

Is there anything else I should not copy back to /dev/sda1?

By the way, I am in Cordoba province right now.

darkod
June 18th, 2010, 04:45 PM
That makes me a bit nervous! I have just spent what feels like three weeks re-installing all my software onto 9.10. Would the following be safer and would it work? :-

a) copy remaining /home data from old /dev/sda1 (8.04/8.10) partition to new /dev/sda5 (9.10);
b) clean install 9.10 on old partition /dev/sda1;
c) security update /dev/sda1 and get the latest kernel;
d) copy the whole of / (including /home) from /dev/sda5 to /dev/sda1 except for /boot

Is there anything else I should not copy back to /dev/sda1?

By the way, I am in Cordoba province right now.

Unfortunately I'm not that experienced in ubuntu to know if that would work. In general, copying data from /home is fine, especially personal data.
But copying from / I don't know what it can copy over.

You could also try removing the grub1 package, it's called just grub. You also have grub2 so it should keep booting, however I haven't tried that. On the other hand I have never had a mix of grub1 and grub2 like you have.

desconocido
June 23rd, 2010, 07:25 PM
I've done (a)-(c) of my list. I'm going away from my computer for a few days and then I will try (d).

desconocido
July 7th, 2010, 06:33 PM
Hi,

I completed copying everything (more or less) from /dev/sda5 to /dev/sda1.

I rebooted.

This time I got an even bigger menu of boot options, and chose the latest kernel on /dev/sda1.

I then started reducing the options by:
(a) Synaptic: install grub2, remove grub
(b) remove execute flag from /etc/grub.d/30_os-prober
(c) edit /etc/default/grub and uncomment GRUB_DISABLE_LINUX_RECOVERY="true"
(d) removing the out of date kernel from /dev/sda1

and of course running sudo update-grub.

grub-install -v

grub-install (GNU GRUB 1.97~beta4)

After all this I get a boot menu of only one option which is a bit odd as the documentation says the default is to not offer a menu when there is only one one choice.

My /etc/default/grub contains

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=3
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=30
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 entrys
GRUB_DISABLE_LINUX_RECOVERY="true"
and the resulting /boot/grub/grub.cfg contains

#
# 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
#

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 314dbdae-737c-49c2-b634-fc39d4564125
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=30
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-22-generic" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 314dbdae-737c-49c2-b634-fc39d4564125
linux /boot/vmlinuz-2.6.31-22-generic root=UUID=314dbdae-737c-49c2-b634-fc39d4564125 ro quiet splash
initrd /boot/initrd.img-2.6.31-22-generic
}
### END /etc/grub.d/10_linux ###

### 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 ###

Can't think what else to try.

desconocido
July 7th, 2010, 06:41 PM
Juist found this:


# Initial Default

* Grub 2 will boot straight into the default operating system if no other operating system is detected. No menu will be displayed. If another operating system is detected, the Grub 2 menu will display.

# Hidden

* The user can interrupt the boot process and display the menu by holding down the SHIFT key until the menu displays. Grub 2 searches for a depressed SHIFT key signal during boot. If the key is pressed or Grub 2 cannot determine the status of the key, the menu is displayed. Note: The "SHIFT" keystatus check is currently nested within in a conditional statement within /etc/grub.d/30_os-prober and may not work under certain circumstances.

desconocido
July 9th, 2010, 07:39 PM
edit /etc/default/grub
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0

sudo update-grub

This does it!!!!

Many, many thanks for your help.