LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-12-2011, 10:53 PM   #1
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Rep: Reputation: 0
GRUB 2 Menu Editing, something is not right here


Hi,

I have three OS's on one of my computers (Windows 7 64 bit, Ubuntu 10.04 LTS amd64, and Debian 6 amd64). The utilized Grub2 boot is on the Debian partition.

Now, I have read all sorts of things about configuring the grub menu, and all of it has been a bunch of hogwash, so far. Here's my problem;

I have too many Ubuntu entries on the initial boot menu. I uninstalled the linux images and headers on the ubuntu partition that I was not using, and then ran update-grub2 from Debian. However, the entries for the non existent Ubuntu kernels are still listed in the grub start up menu.

So, I had an understanding that there was a way to edit the grub menu by;

1. "copying" the menuentries list from /boot/grub/grub.cfg

2. appending ("pasting") it to the end of the file /etc/default/grub

3. deleting the corresponding menuentries (in the resultant default/grub file) of the nonexistent Ubuntu images that I did not want to appear in the menu, and finally,

4. running update-grub2.

This method is NOT suppressing the menu entries in the grub boot menu at start up, however.

Nor does reinstalling the grub2 from the Debian CD (in text rescue mode) fix the problem.

I am assuming there is probably something left in the Ubuntu boot or grub menu configuration that may need editing before this will work? It is probably important to mention, also, that the Ubuntu Grub was the original grub boot partition, before Debian was installed on this particular computer and thus became the boot partition for the currently utilized grub.cfg.

What do I do?

My thanks in advance.

EDIT:

Thinking of it, the question boils down to;

What do I do to manually configure what appears on my grub2 menu boot screen?



.

Last edited by feeblebrain; 08-12-2011 at 11:00 PM.
 
Old 08-13-2011, 01:09 AM   #2
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: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
The best documentation on grub-pc (grub2) is;
http://ubuntuforums.org/showthread.php?t=1195275

I have no idea where you got your information but it is not correct but it is entertaining.

The best thing you could do to help us with your problem is to get this script ad run it. You will get a "results" text on your desktop. Post that entire text.
http://ubuntuforums.org/showthread.php?t=1195275

Did you when you deleted the old kernels from your Ubuntu install run "update-grub" on the Ubuntu install? Your Debian grub may be getting that info from your Ubuntu Debian.

Myself, I would use a custom menu. You have a number of scripts in grub-pc that run every time update-grub is run. This happens every time you get a new kernel or update to grub-pc or you run update-grub manually. This generates your grub.cfg file which is what you see on your menu screen.

This is a large file that needs read every time you boot. You need that on your first boot of a new install to pick up all your installs. You do not need it ever again.

You only need 3 scripts for that grub.cfg file to work. 00_header, 05_debian-theme and 06_custom.

To set up the 06_custom file you need to use this example for your debian and ubuntu installs, edited to fit your box. The stuff between the "" marks can be anything you want. The first is what you see when you run Update-Grub. The second what you see on your menu screen.
Code:
echo "Adding Sid-G on sda6" >&2 
cat << EOF
menuentry "Sid-G on sda6" {
        set root=(hd0,6)
        linux /vmlinuz root=/dev/sda6 ro quiet splash
        initrd /initrd.img
}
EOF
copy that to your /etc/grub.d/40_custom file twice and edit one for your Ubuntu and once for your Debian install.

Go to your /boot/grub/grub.cfg file and copy your Win JerryLewis Pro entry from there to your /etc/grub.d/40custom file an add the;
Quote:
echo "Adding Sid-G on sda6" >&2
cat << EOF
to the top of it and the "EOF" to the end.
Save the file as /etc/grub.d/06_custom, this will put it at the top of your current menu.

Go to /etc/default/grub and set your default OS to boot, remembering that the counting starts with 0 (if you want the first menu item it would be 0).

Run, as root;
Code:
update-grub
Reboot and see if it works. If so change the permissions of all but those 3 scripts to no be executable. Run update grub again.

The entry I gave you will boot to the newest Debian based kernel on the partition defined in the entry. You could install LinuxMint on the partition that has your Ubuntu on it and the same entry, unedited, will boot it.

Send the results of the boot info script and we can figure out what the problem is.
 
Old 08-13-2011, 06:49 PM   #3
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Original Poster
Rep: Reputation: 0
Ummmm......

Sorry.

Let me take that from the top.....

First; Which script from that link do I run?


EDIT:

Dang! I like Russian Roulette!

Okay, I promise I will read that link in-toto, when I get some time to do so, as it really does interest me. For the moment I backed up the grub.cfg file in /boot/grub on the Debian installation, then did the unthinkable and lopped out the offending Ubuntu kernel menu entries from the original grub.cfg. Then I rebooted (heart in mouth), and it and all is okay. Now, bawl me out, PLEASE! I like it!

Last edited by feeblebrain; 08-13-2011 at 07:15 PM.
 
Old 08-13-2011, 07:11 PM   #4
azc
LQ Newbie
 
Registered: Dec 2005
Posts: 11

Rep: Reputation: 3
Quote:
Originally Posted by feeblebrain View Post
Hi,
...
I have too many Ubuntu entries on the initial boot menu. I uninstalled the linux images and headers on the ubuntu partition that I was not using, and then ran update-grub2 from Debian. However, the entries for the non existent Ubuntu kernels are still listed in the grub start up menu.
...
Did you run update-grub from Ubuntu after removing the Ubuntu kernels?

Might want to try that, and then run update-grub from Debian again.
 
Old 08-13-2011, 07:16 PM   #5
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by azc View Post
Did you run update-grub from Ubuntu after removing the Ubuntu kernels?

Might want to try that, and then run update-grub from Debian again.
Yes, I did try that. Update-grub form Ubuntu and then from Debian. It did not remove the entries.
 
Old 08-13-2011, 07:27 PM   #6
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, KDE Neon, Arch, Void
Posts: 3,378

Rep: Reputation: 1094Reputation: 1094Reputation: 1094Reputation: 1094Reputation: 1094Reputation: 1094Reputation: 1094Reputation: 1094
I'd be willing to bet it's got to do with os-prober.
 
Old 08-13-2011, 10:49 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: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
Sorry, I am a grumpy geezer and sometimes I just screw up. Try this one;
http://bootinfoscript.sourceforge.net/

I would be surprised if 30_os-prober is not the problem too.

Too make you feel better, you really should not edit the grub.cfg file. It is, generally, a waste of time as it is redone with every instance of the update-grub command. Really your only real mistake was to back up the old one. Update grub will regenerate the file anyway, the stuff you removed will make no difference as those kernels do not exist (makes them really hard to boot.

Did you plug in the menu entries. the one I sent and the one from grub.cfg for MS? If so did they work?

If so you can "turn off" /etc/grub.d/30-os-prober, run update-grub and forget the problem.

This is my current /boot/grub/grub.cfg;
Code:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set=root db535c87-e88b-4391-ad2e-962468f0fb4e
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos7)'
  search --no-floppy --fs-uuid --set=root db535c87-e88b-4391-ad2e-962468f0fb4e
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
set timeout=100
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set=root db535c87-e88b-4391-ad2e-962468f0fb4e
insmod png
if background_image /boot/grub/desktop-grub.png; then
 set color_normal=yellow/black
 set color_highlight=white/black
  true
else
  set menu_color_normal=yellow/black
  set menu_color_highlight=white/black
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/07_custom ###
menuentry "Squeezy on sda7" {
    set root=(hd0,7)
        linux /vmlinuz root=/dev/sda7 ro quiet splash initcall_debug printk.time=y quiet init=/sbin/bootchartd ... rdinitrd=/sbin/bootchartd
        initrd /initrd.img
}
menuentry "Lounge on sda11" {
    set root=(hd0,11)
        linux /vmlinuz root=/dev/sda11 ro splash vga=791 quiet
        initrd /initrd.img
}
### END /etc/grub.d/07_custom ###

### BEGIN /etc/grub.d/09_custom ###
menuentry "Obese Octopus ISO on /dev/sda7" {
loopback loop (hd0,7)/etc/aa/oneiric-desktop-amd64.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/etc/aa/oneiric-desktop-amd64.iso noprompt 
initrd (loop)/casper/initrd.lz
}
menuentry "Lubuntu 11.04 ISO on /dev/sda7" {
loopback loop (hd0,7)/etc/aa/lubuntu-natty-alpha3.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/etc/aa/lubuntu-natty-alpha3.iso noprompt 
initrd (loop)/casper/initrd.lz
}
menuentry "Lubuntu 10.10 ISO on /dev/sda7" {
loopback loop (hd0,7)/etc/aa/lubuntu-10.10.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/etc/aa/lubuntu-10.10.iso noprompt 
initrd (loop)/casper/initrd.lz
}
### END /etc/grub.d/09_custom ###
Note that there is 07_custom and 09_custom. 07 is installs on this drive. 09 is Ubuntu Live CD ISOs that will boot from grub (Debians will not for what I can find). 08_custom is shut off as it is entries for my other internal drive and I do not want, right now, to be able to boot them from here.

If I need to boot to recovery that is easy enough by hitting e and editing the menuentry from the screen menu so the "linux" line reads;
Code:
linux /vmlinuz root=/dev/sda11 ro single
or you can have 2 entries for each install, one of which reads that way (check your recovery entries - that is the difference there too).
 
1 members found this post helpful.
Old 08-14-2011, 07:32 AM   #8
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Original Poster
Rep: Reputation: 0
Hi, and my thanks.

Quote:
Originally Posted by widget
Update grub will regenerate the file anyway, the stuff you removed will make no difference as those kernels do not exist (makes them really hard to boot.
I feared this would be the case even while I was doing removal of the lines in the grub.cfg file. Oh well, the excitement was worth the failure!

Here's the output of the boot_info_script.

Code:
                  Boot Info Script 0.60    from 17 May 2011


============================= Boot Info Summary: ===============================

 => Grub2 (v1.97-1.98) is installed in the MBR of /dev/sda and looks at sector 
    1 of the same hard drive for core.img. core.img is at this location and 
    looks in partition 7 for (,msdos7)/boot/grub.

sda1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:   No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /bootmgr /Boot/BCD

sda2: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:   No errors found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /Windows/System32/winload.exe

sda3: __________________________________________________________________________

    File system:       Extended Partition
    Boot sector type:  -
    Boot sector info:  

sda5: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info:  
    Operating System:  Ubuntu 10.04.3 LTS
    Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda6: __________________________________________________________________________

    File system:       swap
    Boot sector type:  -
    Boot sector info:  

sda7: __________________________________________________________________________

    File system:       ext3
    Boot sector type:  -
    Boot sector info:  
    Operating System:  Debian GNU/Linux 6.0
    Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda8: __________________________________________________________________________

    File system:       swap
    Boot sector type:  -
    Boot sector info:  

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1               2,048       206,847       204,800   7 NTFS / exFAT / HPFS
/dev/sda2             206,848   463,716,613   463,509,766   7 NTFS / exFAT / HPFS
/dev/sda3         463,718,398   976,773,119   513,054,722   5 Extended
/dev/sda5         927,227,904   974,628,863    47,400,960  83 Linux
/dev/sda6         974,630,912   976,773,119     2,142,208  82 Linux swap / Solaris
/dev/sda7    *    463,718,400   911,366,143   447,647,744  83 Linux
/dev/sda8         911,368,192   927,223,807    15,855,616  82 Linux swap / Solaris


"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/sda1        1EE8E162E8E13923                       ntfs       System Reserved
/dev/sda2        B0A8E2A3A8E26776                       ntfs       
/dev/sda5        513e0d38-d48b-49f0-8202-767459d6c1b7   ext4       
/dev/sda6        5186019a-daed-41bf-a674-9d61436a4aa4   swap       
/dev/sda7        a9e509fe-72e2-4976-8aa4-71de4ad10382   ext3       
/dev/sda8        95729baf-938b-46ec-b309-a537e8555f9d   swap       

================================ Mount points: =================================

Device           Mount_Point              Type       Options

/dev/sda7        /                        ext3       (rw,errors=remount-ro)


=========================== sda5/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
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  set saved_entry=${prev_saved_entry}
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z ${boot_once} ]; then
    saved_entry=${chosen}
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
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
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
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/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-33-generic' --class ubuntu --class gnu-linux --class gnu --class os {
	recordfail
	insmod ext2
	set root='(hd0,5)'
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux	/boot/vmlinuz-2.6.32-33-generic root=UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 ro   quiet splash
	initrd	/boot/initrd.img-2.6.32-33-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-33-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
	recordfail
	insmod ext2
	set root='(hd0,5)'
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	echo	'Loading Linux 2.6.32-33-generic ...'
	linux	/boot/vmlinuz-2.6.32-33-generic root=UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.32-33-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	insmod ext2
	set root='(hd0,5)'
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux16	/boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
	insmod ext2
	set root='(hd0,5)'
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" {
	insmod ntfs
	set root='(hd0,1)'
	search --no-floppy --fs-uuid --set 1EE8E162E8E13923
	chainloader +1
}
menuentry "Debian GNU/Linux, with Linux 2.6.32-5-amd64 (on /dev/sda7)" {
	insmod ext2
	set root='(hd0,7)'
	search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
	linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a9e509fe-72e2-4976-8aa4-71de4ad10382 ro quiet
	initrd /boot/initrd.img-2.6.32-5-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.32-5-amd64 (recovery mode) (on /dev/sda7)" {
	insmod ext2
	set root='(hd0,7)'
	search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
	linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a9e509fe-72e2-4976-8aa4-71de4ad10382 ro single
	initrd /boot/initrd.img-2.6.32-5-amd64
}
### 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 ###
--------------------------------------------------------------------------------

=============================== sda5/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda5 during installation
UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda6 during installation
UUID=a9a335ef-5bb8-448f-8a0e-502371092715 none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
--------------------------------------------------------------------------------

=================== sda5: Location of files loaded by Grub: ====================

           GiB - GB             File                                 Fragment(s)

            ?? = ??             boot/grub/core.img                             1
            ?? = ??             boot/grub/grub.cfg                             1
            ?? = ??             boot/initrd.img-2.6.32-33-generic              1
            ?? = ??             boot/vmlinuz-2.6.32-33-generic                 1
            ?? = ??             initrd.img                                     1
            ?? = ??             vmlinuz                                        1

=========================== sda7/boot/grub/grub.cfg: ===========================

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

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=800x600
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
set timeout=10
play 480 440 1
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
insmod png
if background_image /usr/share/images/desktop-base/spacefun-grub.png; then
  set color_normal=light-gray/black
  set color_highlight=white/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos7)'
	search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
	echo	'Loading Linux 2.6.32-5-amd64 ...'
	linux	/boot/vmlinuz-2.6.32-5-amd64 root=UUID=a9e509fe-72e2-4976-8aa4-71de4ad10382 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.32-5-amd64
}
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos7)'
	search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
	echo	'Loading Linux 2.6.32-5-amd64 ...'
	linux	/boot/vmlinuz-2.6.32-5-amd64 root=UUID=a9e509fe-72e2-4976-8aa4-71de4ad10382 ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.32-5-amd64
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_otheros ###

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
menuentry "Windows Vista (loader)" {
	set root=(hd0,msdos1)
	search --no-floppy --fs-uuid --set 1ee8e162e8e13923
	chainloader +1
}

# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda5.
menuentry "Ubuntu, with Linux 2.6.32-33-generic (on /dev/sda5)" {
	set root=(hd0,msdos5)
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux /boot/vmlinuz-2.6.32-33-generic root=UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 ro quiet splash 
	initrd /boot/initrd.img-2.6.32-33-generic
}


# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda5.
menuentry "Ubuntu, with Linux 2.6.32-33-generic (recovery mode) (on /dev/sda5)" {
	set root=(hd0,msdos5)
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux /boot/vmlinuz-2.6.32-33-generic root=UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 ro single 
	initrd /boot/initrd.img-2.6.32-33-generic
}


# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda5.
menuentry "Ubuntu, with Linux 2.6.32-24-generic (on /dev/sda5)" {
	set root=(hd0,msdos5)
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux /boot/vmlinuz-2.6.32-24-generic root=UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 ro quiet splash 
	initrd /boot/initrd.img-2.6.32-24-generic
}


# This entry automatically added by the Debian installer for an existing
# linux installation on /dev/sda5.
menuentry "Ubuntu, with Linux 2.6.32-24-generic (recovery mode) (on /dev/sda5)" {
	set root=(hd0,msdos5)
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux /boot/vmlinuz-2.6.32-24-generic root=UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 ro single 
	initrd /boot/initrd.img-2.6.32-24-generic
}

### END /etc/grub.d/30_otheros ###

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

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------

=============================== sda7/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sda7 during installation
UUID=a9e509fe-72e2-4976-8aa4-71de4ad10382 /               ext3    errors=remount-ro 0       1
# swap was on /dev/sda8 during installation
UUID=95729baf-938b-46ec-b309-a537e8555f9d none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
--------------------------------------------------------------------------------

=================== sda7: Location of files loaded by Grub: ====================

           GiB - GB             File                                 Fragment(s)

 328.532306671 = 352.758878208  boot/grub/core.img                             1
 328.602634430 = 352.834392064  boot/grub/grub.cfg                             1
 328.505680084 = 352.730288128  boot/initrd.img-2.6.32-5-amd64                 5
 328.573741913 = 352.803368960  boot/vmlinuz-2.6.32-5-amd64                    2
 328.505680084 = 352.730288128  initrd.img                                     5
 328.573741913 = 352.803368960  vmlinuz                                        2
I will be doing the other part of the procedure a bit later.

30_os-prober does exist on my system in the /etc/grub.d directory, BTW.

EDIT:

Okay, here's my 40_custom file for scrutiny:

Code:
#!/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.

echo "Adding Ubuntu 10.04 LTS on sda5" >&2 
cat << EOF
menuentry "Ubuntu 10.04 LTS" {
        set root=(hd0,5)
        linux /vmlinuz root=/dev/sda5 ro quiet splash
        initrd /initrd.img
}
EOF

echo "Adding Debian 6 on sda7" >&2 
cat << EOF
menuentry "Debian 6" {
        set root=(hd0,7)
        linux /vmlinuz root=/dev/sda7 ro quiet splash
        initrd /initrd.img
}
EOF

echo "Adding Windows 7 on sda1" >&2
# on /dev/sda1
menuentry "Windows 7 (loader)" {
	set root=(hd0,msdos1)
	search --no-floppy --fs-uuid --set 1ee8e162e8e13923
	chainloader +1
}
cat << EOF
...which added the three menu items to the list after grub-update. Then, I did as indicated and suppressed executable from the following files;

Code:
10_linux
20_linux_xen
30_os-prober
30_otheros
41_custom
...and allowed the following to maintain executable status.

Code:
00_header
05_debian_theme
40_custom
Please note, I do not have an 06_custom file, as in the post that contained these directions. Ran update-grub again and I now have only those three menu entries.

Very good! Now, that is what I was talking about. Thanks!

I was just wondering if this is a situation that would benefit from the implementation of a separate boot partition?


.

Last edited by feeblebrain; 08-14-2011 at 09:49 AM.
 
Old 08-14-2011, 10:44 AM   #9
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
If you plan on updating and changing distros often then I would make a separate boot partition and then chainload all the distros This way when you change distros or update you do not need to change grub partiti0n entry. I do mine with a 200 meg partition which is larger than it needs to be but I store my boot information and keep track of the distros I have used in the boot partition. Also you do not bother the booting process by changing any of the distros.
 
1 members found this post helpful.
Old 08-14-2011, 10:48 AM   #10
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: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
I had mentioned that when saving the edited 40_custom file you should rename it to 06_custom. This has the advantage of putting it on top of your menu with everything running and leaving you with a still intact, empty, 40_custom file.

Hopefully the custom file takes care of your menu and loads a little faster when you boot up.

A separate boot partition is not going to help with this.

I will post again after studying you boot info text. I have it on a gedit document so that I can put things that catch my eye in a more usable form.
 
Old 08-14-2011, 12:01 PM   #11
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: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
Well you certainly have an interesting situation.

These are the things I find interesting in the boot script, most that have nothing to do with the problem.

You have 2 swap partitions. You only need 1.

You installed Squeeze on ext3. Unless you are having problems with your Ubuntu (ext4) you will find some advantage (small) to Debian on ext4.

There is an * at sda7 under the heading "Drive: sda". They update that script all the time and it gets better all the time. That used to indicate that there was a boot flag on that partition. You may want to pull up gparted and check to see if that is the case. If so you can remove that flag (if sda7 was your MS install and you were booting from the MS boot loader a flag would be needed) as grub does not need one.

That * may just indicate which partition is supplying the grub files.

This one does have to do with your problem and really baffles me all together. Not just sure what would cause it. Your 10_linux and 30_os-prober output is just wrong.

They would be fine if generated by those files in your Ubuntu grub.

10_linux is where the menu entries for the OS where you are running grub from is generated. It should only include the entries for your Debian install and the recovery entry for same. It contains the entries for Ubuntu.

30_os-prober is where the menu entries are generated for the other OS' on your drive. It should contain the entry for MS and the entries for Ubuntu. It contains the entry for MS and the entries for Debian.

The install that I use the most is Debian testing on sda7. This is where I am right now. I enabled 10_linux and ran "update grub" and then "grub-mkconfig" (this command prints {outputs} your grub.cfg file in your terminal). This the result for 10_linux;
Quote:
### BEGIN /etc/grub.d/10_linux ###
Found linux image: /boot/vmlinuz-2.6.39-4.dmz.1-liquorix-amd64
Found initrd image: /boot/initrd.img-2.6.39-4.dmz.1-liquorix-amd64
menuentry 'Debian GNU/Linux, with Linux 2.6.39-4.dmz.1-liquorix-amd64' --class debian --class gnu-linux --class gnu --class os {
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set=root db535c87-e88b-4391-ad2e-962468f0fb4e
echo 'Loading Linux 2.6.39-4.dmz.1-liquorix-amd64 ...'
linux /boot/vmlinuz-2.6.39-4.dmz.1-liquorix-amd64 root=UUID=db535c87-e88b-4391-ad2e-962468f0fb4e ro initcall_debug printk.time=y quiet init=/sbin/bootchartd ... quiet
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.39-4.dmz.1-liquorix-amd64
}
menuentry 'Debian GNU/Linux, with Linux 2.6.39-4.dmz.1-liquorix-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set=root db535c87-e88b-4391-ad2e-962468f0fb4e
echo 'Loading Linux 2.6.39-4.dmz.1-liquorix-amd64 ...'
linux /boot/vmlinuz-2.6.39-4.dmz.1-liquorix-amd64 root=UUID=db535c87-e88b-4391-ad2e-962468f0fb4e ro single initcall_debug printk.time=y quiet init=/sbin/bootchartd ...
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.39-4.dmz.1-liquorix-amd64
}
### END /etc/grub.d/10_linux ###
Note that this is the correct output for 10_linux as that is the / partition for this install.

On my external enclosure I use an install of Squeeze for my grub. I do not have this problem of yours there but I do not use "Grub2 (v1.97-1.98)" on it. I use the same grub that I use here on testing "(GRUB) 1.99-11".

Conclusion;
Your grub install is screwy. This is either a bug in that version of grub or some kind of strange linkage between your Ubuntu and Debian grub installs.

This could probably be fixed by switching to the Ubuntu install for grub. The easy way to do that is boot to it and run;
Code:
sudo grub-install /dev/sda
This does not fix the problem with grub in Debian it just switches you to Ubuntus grub.

The Debian grub could be fixed. This is not hard either but do not shut down, for any reason before you are done or you will not have a boot loader.

Copy your 40_custom file to a safe place (Desktop?).

Run as root;
Code:
apt-get purge grub-pc grub-common
Open nautilus as root and delete everything in your /boot/grub directory and your /etc/grub.d directory (purge may leave some stuff).

Run as root:
Code:
apt-get install grub-pc grub-common
That should do it.

Myself I would rename my /etc/apt/sources.list to sources.list.def. I would then save this as my sources.list;
Code:
deb http://http.us.debian.org/debian/ testing main
Run as root;
Code:
apt-get update
and
Code:
apt-get install grub-pc grub-common
This will give you a newer version of grub. Should be the one I am using. It really is much better. If you are asked if you want to keep some file that has been modified go with the "maintainers" version so that everything matches.

Get rid of the "new" sources.list. Rename your old sources.list back to what if was. Rerun "apt-get update" to get you back to the repos you belong in.

Rename your 40_custom file to 06_custom and put it back in /etc/grub.d and make sure it is enabled. Run as root;
Code:
update-grub
Reboot to check.

Disable any of the extra scripts that you want to. This really does speed things up.

You can also just copy that 06_custom file to Ubuntus grub.d and use it there too if you want.
 
1 members found this post helpful.
Old 08-15-2011, 01:11 PM   #12
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Original Poster
Rep: Reputation: 0
Thanks all!

Right, then. First;

Quote:
Originally Posted by Larry Webb
If you plan on updating and changing distros often then I would make a separate boot partition and then chainload all the distros
So that has solved that, for the moment. I don't change distros often, though I will want to look into this subject for a specific reason, which will most probably be the theme of a different thread, some time in the future.

Second, the present situation. I have choices here, as I see them;

1. Keep the custom grub configuration as made with 06_custom (yes, now renamed, sorry I missed that), and manually update the configuration by the same means, from my Debian partition, whenever I make changes.
2. Move the boot source over to the Ubuntu partition (more on this in a second).
3. Install the "Wheezy" new standard grub2 and update it, from the Debian partition.

This brings me to my first activity. I got rid of one of the swap partitions and recovered some space for the small Ubuntu partition in so doing. My Debian is now on sda6. The installer CD's for Ubuntu and Debian made those swap partitions automatically. I had noticed them before, and wondered if two were surplus to requirements, but also pondered that they might somehow be associated with their respective installs. Thanks for confirming this issue.

Now, changing the partition fs from ext3 to ext4. Again, the CD automatically formatted the partition to ext3 for Debian. Now I understand that there is a way to change a file system from one to the other without loosing data (or with a small risk of it). It would go something like this, I imagine preferrably from a the Ubuntu partition or from the Gentoo System Rescue CD, with the corresponding partition unmounted.

1. Use tune2fs on sda6 (not sure how to use it, however, despite the man page).
2. Mount the partition
3. Edit the fstab file and change sda6 from ext3 to ext4.
4. Reinstall grub for the new fs.
5. Reboot.

But that's another story. Have not tried it, yet, and will not until better informed. I also understand that Linux has a non-contiguous way of placing files on the HD (unlike that dreadful FAT system of MS-DOS). I am still a bit unclear on how the files, therefore, are "mapped" on the HD in Linux. I would imagine that if the fs is converted to ext4, there will undoubtedly follow a step of remapping the files on the partition(?).

Regarding the * on sda7 (as it was) with reference to this quote;

Quote:
Originally Posted by widget
There is an * at sda7 under the heading "Drive: sda". They update that script all the time and it gets better all the time. That used to indicate that there was a boot flag on that partition.
Indeed, the files used by grub were on the sda7 (Debian) partition. Again, this was done by the Debian install, I would say semi-automatically, because it gave me the option to specify a boot partition or not. It might help to know the order of the installations - Windows 7, Ubuntu, Debian, though I think the sequence of the sda id's give that away, anyway.

My question, though. If I don't specify a boot partition (or go ahead and suppress it now), how will grub boot loader know where to find the rest of the grub files?

So, now, what have I done so far?

I moved the boot partition over to Ubuntu. With that, I do not have the appearance of the deleted Ubuntu kernel images (ie; it is like the manually made one on Debian, plus the mem tests and recovery modes). I assume that this goes to prove (or reinforce the prevalent notion) that there is no problem with the Ubuntu grub and that the error lies in the Debian grub (possibly the 30_os-prober, as suggested in previous posts already?). If so, is this a known bug?

Finally, I am going to try the next step and upgrade to "Wheezy's" grub. This does seem to be functional, as far as I can tell. I have "Wheezy", very recently upgraded, on my 32 bit rig. Though the only other OS on that computer is Win XP, there have been no similar troubles on it to these related in these posts.

BTW, here is the latest boot_info_script for this, my 64 bit rig. What baffles me a bit is why the boot flag is still on my Debian partition despite my now using the Ubuntu partition as the source of the grub files. I am obviously misunderstanding this particular concept.

Code:
                  Boot Info Script 0.60    from 17 May 2011


============================= Boot Info Summary: ===============================

 => Grub2 (v1.97-1.98) is installed in the MBR of /dev/sda and looks at sector 
    1 of the same hard drive for core.img. core.img is at this location and 
    looks in partition 5 for /boot/grub.

sda1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:   No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /bootmgr /Boot/BCD

sda2: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:   No errors found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /Windows/System32/winload.exe

sda3: __________________________________________________________________________

    File system:       Extended Partition
    Boot sector type:  -
    Boot sector info:  

sda5: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info:  
    Operating System:  Ubuntu 10.04.3 LTS
    Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda6: __________________________________________________________________________

    File system:       ext3
    Boot sector type:  -
    Boot sector info:  
    Operating System:  Debian GNU/Linux 6.0
    Boot files:        /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda7: __________________________________________________________________________

    File system:       swap
    Boot sector type:  -
    Boot sector info:  

============================ Drive/Partition Info: =============================

Drive: sda _____________________________________________________________________

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1               2,048       206,847       204,800   7 NTFS / exFAT / HPFS
/dev/sda2             206,848   463,716,613   463,509,766   7 NTFS / exFAT / HPFS
/dev/sda3         463,718,398   976,773,119   513,054,722   5 Extended
/dev/sda5         927,227,904   976,773,119    49,545,216  83 Linux
/dev/sda6    *    463,718,400   911,366,143   447,647,744  83 Linux
/dev/sda7         911,368,192   927,223,807    15,855,616  82 Linux swap / Solaris


"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/sda1        1EE8E162E8E13923                       ntfs       System Reserved
/dev/sda2        B0A8E2A3A8E26776                       ntfs       
/dev/sda5        513e0d38-d48b-49f0-8202-767459d6c1b7   ext4       
/dev/sda6        a9e509fe-72e2-4976-8aa4-71de4ad10382   ext3       
/dev/sda7        95729baf-938b-46ec-b309-a537e8555f9d   swap       

================================ Mount points: =================================

Device           Mount_Point              Type       Options

/dev/sda6        /                        ext3       (rw,errors=remount-ro)


=========================== sda5/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
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  set saved_entry=${prev_saved_entry}
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z ${boot_once} ]; then
    saved_entry=${chosen}
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
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
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
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/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-33-generic' --class ubuntu --class gnu-linux --class gnu --class os {
	recordfail
	insmod ext2
	set root='(hd0,5)'
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux	/boot/vmlinuz-2.6.32-33-generic root=UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 ro   quiet splash
	initrd	/boot/initrd.img-2.6.32-33-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-33-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
	recordfail
	insmod ext2
	set root='(hd0,5)'
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	echo	'Loading Linux 2.6.32-33-generic ...'
	linux	/boot/vmlinuz-2.6.32-33-generic root=UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.32-33-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	insmod ext2
	set root='(hd0,5)'
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux16	/boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
	insmod ext2
	set root='(hd0,5)'
	search --no-floppy --fs-uuid --set 513e0d38-d48b-49f0-8202-767459d6c1b7
	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" {
	insmod ntfs
	set root='(hd0,1)'
	search --no-floppy --fs-uuid --set 1EE8E162E8E13923
	chainloader +1
}
menuentry "Debian GNU/Linux, with Linux 2.6.32-5-amd64 (on /dev/sda7)" {
	insmod ext2
	set root='(hd0,7)'
	search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
	linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a9e509fe-72e2-4976-8aa4-71de4ad10382 ro quiet
	initrd /boot/initrd.img-2.6.32-5-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.32-5-amd64 (recovery mode) (on /dev/sda7)" {
	insmod ext2
	set root='(hd0,7)'
	search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
	linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a9e509fe-72e2-4976-8aa4-71de4ad10382 ro single
	initrd /boot/initrd.img-2.6.32-5-amd64
}
### 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 ###
--------------------------------------------------------------------------------

=============================== sda5/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda5 during installation
UUID=513e0d38-d48b-49f0-8202-767459d6c1b7 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda6 during installation
UUID=a9a335ef-5bb8-448f-8a0e-502371092715 none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
--------------------------------------------------------------------------------

=================== sda5: Location of files loaded by Grub: ====================

           GiB - GB             File                                 Fragment(s)

            ?? = ??             boot/grub/core.img                             1
            ?? = ??             boot/grub/grub.cfg                             1
            ?? = ??             boot/initrd.img-2.6.32-33-generic              1
            ?? = ??             boot/vmlinuz-2.6.32-33-generic                 1
            ?? = ??             initrd.img                                     1
            ?? = ??             vmlinuz                                        1

=========================== sda6/boot/grub/grub.cfg: ===========================

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

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=800x600
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
set timeout=10
play 480 440 1
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set a9e509fe-72e2-4976-8aa4-71de4ad10382
insmod png
if background_image /usr/share/images/desktop-base/spacefun-grub.png; then
  set color_normal=light-gray/black
  set color_highlight=white/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

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

echo "Adding Ubuntu 10.04 LTS on sda5" >&2 
cat << EOF
menuentry "Ubuntu 10.04 LTS" {
        set root=(hd0,5)
        linux /vmlinuz root=/dev/sda5 ro quiet splash
        initrd /initrd.img
}
EOF

echo "Adding Debian 6 on sda7" >&2 
cat << EOF
menuentry "Debian 6" {
        set root=(hd0,7)
        linux /vmlinuz root=/dev/sda7 ro quiet splash
        initrd /initrd.img
}
EOF

echo "Adding Windows 7 on sda1" >&2
# on /dev/sda1
menuentry "Windows 7 (loader)" {
	set root=(hd0,msdos1)
	search --no-floppy --fs-uuid --set 1ee8e162e8e13923
	chainloader +1
}
cat << EOF

### END /etc/grub.d/40_custom ###
--------------------------------------------------------------------------------

=============================== sda6/etc/fstab: ================================

--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sda7 during installation
UUID=a9e509fe-72e2-4976-8aa4-71de4ad10382 /               ext3    errors=remount-ro 0       1
# swap was on /dev/sda8 during installation
UUID=95729baf-938b-46ec-b309-a537e8555f9d none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
--------------------------------------------------------------------------------

=================== sda6: Location of files loaded by Grub: ====================

           GiB - GB             File                                 Fragment(s)

 328.532306671 = 352.758878208  boot/grub/core.img                             1
 328.555835724 = 352.784142336  boot/grub/grub.cfg                             1
 328.505680084 = 352.730288128  boot/initrd.img-2.6.32-5-amd64                 5
 328.573741913 = 352.803368960  boot/vmlinuz-2.6.32-5-amd64                    2
 328.505680084 = 352.730288128  initrd.img                                     5
 328.573741913 = 352.803368960  vmlinuz                                        2
Thanks again.

EDIT:

Incidentally, would this be the very latest Grub 1.99-11, or is it just the same one I have already? ftp://ftp.gnu.org/gnu/grub/ It does not say so, in so many words, as far as I can see. If so, is it worth trying this?


EDIT II:

Okay. All back under control. Thank you very much for the help!


.

Last edited by feeblebrain; 08-15-2011 at 04:02 PM.
 
Old 08-15-2011, 04:21 PM   #13
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: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
First off I would use the grub supplied by the repo. The one from the gnu folks would, on the other hand work fine.

All versions of grub come from the grub project folks no matter what distro you use. All of the different distros can modify the bugger, of coarse. The only place that I am aware of that Debian has modified it is in where the background for your screen menu comes from. Most distros do that (I change it anyway so I don't care what they do).

It is very possible that purging grub from your Debian and reinstalling would take care of your problem. 10_linux, for instance, is corrupted in some manner as is 30_os-prober. A clean install would fix that.

My suggestion to upgrade is based on my confidence in the grub folks improving grub with each version. Yours got corrupted somehow, hopefully a newer version will be more robust.

Note that the version on both your installs is the same. I suspect that they have the same weakness'. You could also grab a grub package from a newer version of Ubuntu and install it there.

I was one of the testers for 10.04 and my wife currently uses 10.04. As I set up her box, I can assure you that she is not using that version of grub. I found it rather fragile and prone to problems.

I am using the newest available in Debian repos and have several Linux installs on here. I have had no trouble with grub getting confused as to where it was since 10.04. I think the other thing that has been improved is the ability to detect and write a working entry for MS. Even the version you are using has had some problems, on some boxes, in doing that. No versions have trouble finding all my MS installs (0).

Your boot flag has nothing in the world to do with grub. Grub goes strictly by where the files are based. I suspect that the presence of the MS boot sector has something to do with the generation of that flag. You can remove it or leave it, Grub will not care.

If you restore the MS boot loader to the MBR I am sure that the flag will be remove and a new one put on the right partition. In that case, if the flag was left on the Debian partition, the MS boot loader would attempt to boot Debian. This would probably not work well.

I do not know how your MS boot speed is but my Dreaded Mother in Laws Vista boots faster using grub than it did using its own system.

Do not waste your time trying to "convert" from ext3 to 4. It is a vast waste of time. You are not reformatting, obviously, and so you get only "some of the benefits of ext4". That quote is from the guide I used to try that out on a copy of my Ubuntu 8.04 install that I wanted to upgrade to 10.04 and have ext4. There was no performance gain that I could see.

There was a marked difference between 10.04 installed on ext4 and another 10.04 installed on ext3.

10.04RC would work on my box the release version, a week later, would not. My 8.04 install had a root "transplant" to Squeeze. The / partition is ext4 and the /home is still ext3. Frankly the biggest difference that you can see is the speed of fsck when it is run. A similar size /home partition (the one I am on now - Debian testing) will finis about 3 times faster than the ext3 /home on that old install.

File opening of my biggest files is somewhat slower on ext3 but certainly not crippling. File transfers are a bit faster too.

I always use manual partitioning when installing. You have the option in Debian to set the format of the file system to what you want. Ext3 is, indeed, the default in the Debian installer though I can't see why.

Your boot info script looks a lot nicer with out the extra /swap. If you look into "swap" formatting you will find that it is "linux swap". One is all you need even if you have 20 (or more) different Linux installs. Does not even need to be on the same drive as long as all drives are "visible" to the install.

I have only seen it in use when opening 30 images at once in Gimp. I had just about everything running that was installed and kept adding images until I got a response from swap. On newer boxes it is only needed for suspend or hibernate or both, I am not sure as I don't have any use for either.

The installer can't assume you will not use those features and so sets it up. As I said, I use manual partitioning and I have always had any Linux installer see my swap partition and configure the fstab to use whatever I had in the swap department with out even offering to put in more.

You should have, to get off topic, been testing Ubuntu 9.10. That is when Ubuntu went to grub2. Threw it in at Alpha2 with no documentation. We spent about 2 weeks editing the grub.cfg file to get anything to work. Then we started to find the, at that time, skimpy documentation available. That was FUN.

Grub as we got it would not boot the OS it was installed with if the OS was on 2 partitions. I had to do a clean install of A2 on one partition and it would boot any of the others, all on 2 partitions, just fine. It has improved since then a good bit.
 
Old 08-15-2011, 10:38 PM   #14
feeblebrain
Member
 
Registered: Feb 2011
Posts: 55

Original Poster
Rep: Reputation: 0
Well, I can say this experience has decided which boot loader I will use for my personal entertainment "recycle/learning" project. In a nutshell I have plans (relatively long term, due to my own time constraints) to concoct a custom Linux for an old Slot 1 Celeron 333 rig I have lying around in disuse. Nothing fancy. I have already played around a little with compiling custom kernels, and am using the Pocket Linux Guide as a loose supplementary reference. I could not decide whether to use LILO or Grub. That is solved, now.

I cannot say if my Windows 7 boots faster with Grub or not; I never tried the MS boot loader. I installed Win 7, Ubuntu and Debian all in succession, before booting any of them, and I rarely use the Win 7 install, anyway. I am not too fond of it. So, my Win 7 has always booted from Grub.

I have got myself rid of the boot flag on sda6, as advised. That is all clear, now. And I obtained the repo-distributed Grub, also as advised. There was one thing that was a bit confusing, though. It is still using the Ubuntu Grub, as I have not exported the new Debian Grub to the MBR. I am a bit wary. I would like to do it from the Debian terminal itself. In fact, I think I would have to, really. As I have only used the CD to reinstall Grub, up till now, I am not sure how this is done. If I do use the CD in text rescue mode, it will only install the faulty Grub again and waste the fact that I obtained the Wheezy related Grub from the testing repo (or would it? When I did use the Debian CD to point Grub at the Ubuntu partition, it used the existing Grub files from Ubuntu).

I know I have to start up Grub in terminal. Then from the Grub prompt type;

Code:
root <somedrive>
setup <somedrive>
...in order to put it on the MBR. Would that <somedrive> be (hd0)?

Once again, my thanks, and apologies for being a pain at the moment. Though still far from complete, I do certainly know a good deal more now than when I started this thread.


.

Last edited by feeblebrain; 08-15-2011 at 10:54 PM.
 
Old 08-16-2011, 11:00 AM   #15
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: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
To install grub2 on the mbr the only command needed is, as root;
Code:
grub-install /dev/sdx
where "x" is the drive designation, in your case "a".

This can, most easily, be done from the terminal on your Debian install. It can, of coarse, be done in a chroot environment from your Ubuntu install or a live CD.

I am not an expert on chroot. I do have a script that I use to chroot to all my installs for doing things like this and just update/upgrades. This script does depend on having the partitions labeled.

I like to have the chroot script for any of my installs on that installs desktop too. That way I can fire up a Live Session and have it easily available. This is a habit from using Ubuntu testing installs.

Have no idea if you are interested in that or not but for what it is worth;
Code:
#!/bin/sh

mkdir /mnt/Lounge-root
mount /dev/sda11 /mnt/Lounge-root/
mount -o bind /proc /mnt/Lounge-root/proc
mount -o bind /dev /mnt/Lounge-root/dev
mount -o bind /dev/pts /mnt/Lounge-root/dev/pts
mount -o bind /sys /mnt/Lounge-root/sys
cp /etc/resolv.conf /mnt/Lounge-root/etc/resolv.conf
chroot /mnt/Lounge-root /bin/bash
My installs are all on 2 partitions. You need to chroot to your root partition to do these kinds of chores. If you are on one partition that is your root partition.

Obviously this would need to be edited for your box. After the first use the "mkdir /mnt/Lounge-root" line can be commented out (## infront of it with a space between the ## and the first letter of the line). If using this under Ubuntu the sudo command needs to be at the beginning of each line.

Lilo is a fine boot loader, I prefer grub. Linux is nice in that there are usually some choices of the tool you want to use. That way you can use what is most comfortable to you. I like that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] lost grub menu after windows installation & forgot to backup menu.lst jesman1 Linux - Kernel 4 08-12-2010 11:57 PM
editing menu.lst in puppy grub tigertim71 Puppy 13 08-17-2009 06:01 PM
Problem editing /boot/grub/menu.lst baldur2630 Linux - Server 10 10-03-2008 12:12 PM
Grub Menu doesn't reflect menu.lst file fatsheep Linux - Software 4 06-11-2007 01:29 PM
Editing /boot/grub menu.lst OpenSUSE 10.2 ceeleelewis Linux - Newbie 7 03-16-2007 09:05 AM

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

All times are GMT -5. The time now is 10:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration