LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Grub, Ubuntu, Debian, Windows, Oh my!! Grub can't find Windows partitions (http://www.linuxquestions.org/questions/linux-general-1/grub-ubuntu-debian-windows-oh-my-grub-cant-find-windows-partitions-946242/)

crs17 05-22-2012 01:07 AM

Grub, Ubuntu, Debian, Windows, Oh my!! Grub can't find Windows partitions
 
When I boot my system I don't see the memtest options or my windows partitions on the initial grub os choosing screen. But as you can see below, they are all in boot.cfg.

This could all be related to the odd history of this machine.

/sda1 ntfs boot partition from original Windows 7 installation
/sda2 ntfs Windows 7 main partition
/sda4 extended
/sda5 ext2 ubuntu 12.04 / (ie root directory)
/sda9 ext3 debian / (ie root) recently installed and to be abandoned
/sda6 ntfs programs and data
/sda7 ntfs media files (ie more data)
/sda8 linux-swap
/sda3 ntfs Lenovo_Recovery for windows (came with Win7)

It was bought as a standard Windows 7 installation. I installed ubuntu
in /sda5 and /sda8. Recently I was dissatisfied with Ubuntu and installed debian in /sda9 and /sda8 (not the "stable" but the more up-to-date but not bleeding edge version - I forget the version number). Debian brought a new boot loader with it and that caused the problem.

I've fixed my ubuntu problem and would just as soon reinstall the ubuntu version of the boot loader (which had worked). Then I'd kill and reformat the debian partition and add it back to the previous neighboring partition.

Right now the grub reports it is v1.98. Any idea how I restore a working grub and disconnect from the Debian partition so I can delete it?

Thanks a lot.

Craig

Here's the 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 ###
..... deleted since I don't think this is interesting here ....
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
..... deleted since I don't think this is interesting here ....
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="$1"
if [ "$1" = "keep" ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
}
if [ ${recordfail} != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 3.2.0-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root 4ef827ec-fbf6-44d4-b0ea-35f4e2791124
linux /boot/vmlinuz-3.2.0-24-generic root=UUID=4ef827ec-fbf6-44d4-b0ea-35f4e2791124 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.2.0-24-generic
}
menuentry 'Ubuntu, with Linux 3.2.0-24-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root 4ef827ec-fbf6-44d4-b0ea-35f4e2791124
echo 'Loading Linux 3.2.0-24-generic ...'
linux /boot/vmlinuz-3.2.0-24-generic root=UUID=4ef827ec-fbf6-44d4-b0ea-35f4e2791124 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.2.0-24-generic
}
submenu "Previous Linux versions" {
menuentry 'Ubuntu, with Linux 3.0.0-19-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root 4ef827ec-fbf6-44d4-b0ea-35f4e2791124
linux /boot/vmlinuz-3.0.0-19-generic root=UUID=4ef827ec-fbf6-44d4-b0ea-35f4e2791124 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.0.0-19-generic
}
menuentry 'Ubuntu, with Linux 3.0.0-19-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root 4ef827ec-fbf6-44d4-b0ea-35f4e2791124
echo 'Loading Linux 3.0.0-19-generic ...'
linux /boot/vmlinuz-3.0.0-19-generic root=UUID=4ef827ec-fbf6-44d4-b0ea-35f4e2791124 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.0.0-19-generic
}
menuentry 'Ubuntu, with Linux 2.6.38-12-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root 4ef827ec-fbf6-44d4-b0ea-35f4e2791124
linux /boot/vmlinuz-2.6.38-12-generic root=UUID=4ef827ec-fbf6-44d4-b0ea-35f4e2791124 ro quiet splash $vt_handoff
initrd /boot/initrd.img-2.6.38-12-generic
}
menuentry 'Ubuntu, with Linux 2.6.38-12-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root 4ef827ec-fbf6-44d4-b0ea-35f4e2791124
echo 'Loading Linux 2.6.38-12-generic ...'
linux /boot/vmlinuz-2.6.38-12-generic root=UUID=4ef827ec-fbf6-44d4-b0ea-35f4e2791124 ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.38-12-generic
}
}
### END /etc/grub.d/10_linux ###

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

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root 4ef827ec-fbf6-44d4-b0ea-35f4e2791124
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root 4ef827ec-fbf6-44d4-b0ea-35f4e2791124
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)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root 34F87108F870CA1E
chainloader +1
}
menuentry "Windows 7 (loader) (on /dev/sda2)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root D8EC72E6EC72BDF6
chainloader +1
}
menuentry "Windows NT/2000/XP (on /dev/sda6)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set=root 4DD82CB12076D8E3
drivemap -s (hd0) ${root}
chainloader +1
}
menuentry "Debian GNU/Linux, with Linux 2.6.32-5-686-bigmem (on /dev/sda9)" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd0,msdos9)'
search --no-floppy --fs-uuid --set=root 4d2a4762-03eb-4961-8bac-020f2620d5db
linux /boot/vmlinuz-2.6.32-5-686-bigmem root=UUID=4d2a4762-03eb-4961-8bac-020f2620d5db ro quiet
initrd /boot/initrd.img-2.6.32-5-686-bigmem
}
menuentry "Debian GNU/Linux, with Linux 2.6.32-5-686-bigmem (recovery mode) (on /dev/sda9)" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(hd0,msdos9)'
search --no-floppy --fs-uuid --set=root 4d2a4762-03eb-4961-8bac-020f2620d5db
linux /boot/vmlinuz-2.6.32-5-686-bigmem root=UUID=4d2a4762-03eb-4961-8bac-020f2620d5db ro single
initrd /boot/initrd.img-2.6.32-5-686-bigmem
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
### END /etc/grub.d/40_custom ###
...... nothing here .......
### BEGIN /etc/grub.d/41_custom ###
...... nothing here ........
### END /etc/grub.d/41_custom ###

syg00 05-22-2012 03:15 AM

That's the Ubuntu cfg - apparently not what you're seeing on boot.
Boot into Ubuntu, from a terminal run
Code:

sudo grub-install /dev/sda
sudo update-grub

The latter probably isn't needed, but always worthwhile doing.

After that, delete Debian whenever you want, and rerun the update-grub to delete the boot menu entries for it.

Babertje 05-22-2012 03:34 AM

Backup : /etc/default/grub and /etc/grub.d/30_os-prober

Add this or edit this line in /etc/default/grub : GRUB_DISABLE_OS_PROBER=true

Edit /etc/grub.d/30_os-prober (as root) and remove the debian entries,
also one of the Win7 entries can be removed OS-Prober finds the Win7 bootloader and Win7 itself only one is needed, check which one to remove!
Leave the XP entry intact if you still use it
so basicly you keep something like this
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.
menuentry "Windows 7 (loader) (on /dev/sda2)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root D8EC72E6EC72BDF6
chainloader +1
}
menuentry "Windows NT/2000/XP (on /dev/sda6)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set=root 4DD82CB12076D8E3
drivemap -s (hd0) ${root}
chainloader +1
}

save this as /etc/grub.d/40_custom (overwrite)
now run update-grub, grub won't tamper or changes 40_custom as it presumes that you did the right thing here.
but keep in mind that if you swap sata-ports around, add/remove partitions that you need to update this custom file accordingly by hand.

crs17 05-22-2012 08:13 AM

Thanks syg00 and Babertje,

The install of grub from the ubuntu partition worked like a charm - got me v1.99 instead of v1.98 and things worked. As to the suggestion about cleaning up the grub.cfg file: I see where that is coming from but I decided that I don't mind navigating around the useless choices (yes I don't use the XP entry - I don't believe it's actually bootable but there is still enough of a Windows XP installation on the partition I copied off of an old PC so that grub thinks it's a bootable partition). I'd rather have the extraneous boot options than have to fiddle with grub.cfg every time I change my partitions.

So thanks, both of you, for your answers.

Craig


All times are GMT -5. The time now is 11:19 AM.