LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 05-22-2012, 02:07 AM   #1
crs17
LQ Newbie
 
Registered: Mar 2004
Posts: 21

Rep: Reputation: 0
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 ###
 
Old 05-22-2012, 04:15 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,487

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
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.

Last edited by syg00; 05-22-2012 at 04:16 AM. Reason: keep forgetting Ubuntu needs sudo ...
 
Old 05-22-2012, 04:34 AM   #3
Babertje
Member
 
Registered: Jun 2009
Location: Haarlem, The Netherlands
Distribution: Archlinux
Posts: 125

Rep: Reputation: 20
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.
 
Old 05-22-2012, 09:13 AM   #4
crs17
LQ Newbie
 
Registered: Mar 2004
Posts: 21

Original Poster
Rep: Reputation: 0
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
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Grub : Lost my windows partition, can't find menu.lst in /boot/grub.Someone can help? lucid_dino Ubuntu 9 11-01-2010 02:51 PM
Uninstal Ubuntu and delete grub, and the partitions without deleting windows. afullmetalwar Linux - Software 1 06-04-2010 04:11 AM
GRUB won't boot into windows 7, and windows 7 recovery erases ubuntu... amiejay Linux - Newbie 2 01-03-2010 02:07 AM
Ubuntu 8.04 on dual boot Grub does not find Windows XP ronmettler Linux - Newbie 4 05-02-2008 09:38 AM
Lost Windows Partitions with grub-inst, Please help! fprumbau Linux - Newbie 3 11-18-2005 11:20 PM


All times are GMT -5. The time now is 04:10 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration