LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux Mint (https://www.linuxquestions.org/questions/linux-mint-84/)
-   -   Installing Grub2/Grub after the fact (https://www.linuxquestions.org/questions/linux-mint-84/installing-grub2-grub-after-the-fact-851455/)

Blasthoff 12-20-2010 05:41 PM

Installing Grub2/Grub after the fact
 
Hi, I am a new member in need of advice. I don't want to risk trial and error with this particular problem, so I'm seeking advice.

I built a new machine with Win7 installed on an SSD. I installed Linux Mint 10 on a second drive, giving it 100 gig space to partition as it saw fit. I've spent the last week learning, tweaking and sorting out bugs with both.

My situation is, I need a boot manager. Right now I boot by switching the boot order in the bios. If Mint hadn't turned to to be such a nice experience, I could live with that. The fact is, I really want to work with this system a lot now and want easy access. Is there an approach to installing a boot manager at this stage of the game?

Thanks, in advance, for any advice.

syg00 12-20-2010 06:59 PM

If you can boot it from the BIOS, you've already got all you need. I'm surprised grub doesn't list Win7 as an (boot) option. Show us the output of these from a Mint terminal
Code:

sudo fdisk -l
cat /boot/grub/grub.cfg


Blasthoff 12-21-2010 04:57 AM

First, I should explain that I'm a newbie to Linux, so many things about Linux are still foreign to me. That out of the way, I'll continue.

First, I am not sure Grub was even installed. So, I met my first bugaboo trying to use the command string you suggested. sudo requires a password so, as I attempt to enter it (or anything else), my keyboard no longer functions. I'm not sure if it's me missing a basic in using terminal or what, but I'm stuck. Thanks

syg00 12-21-2010 05:08 AM

The password won't display - that's a security feature. Simply type your (logon) password and hit <Enter>. Then enter the cat command.

Blasthoff 12-23-2010 12:04 AM

Thanks for the help, it is appreciated. Here is what I got:
Quote:

blasthoff@blasthoff ~ $ sudo fdisk -1
[sudo] password for blasthoff:
fdisk: invalid option -- '1'

Usage:
fdisk [options] <disk> change partition table
fdisk [options] -l <disk> list partition table(s)
fdisk -s <partition> give partition size(s) in blocks

Options:
-b <size> sector size (512, 1024, 2048 or 4096)
-c switch off DOS-compatible mode
-h print help
-u <size> give sizes in sectors instead of cylinders
-v print version
-C <number> specify the number of cylinders
-H <number> specify the number of heads
-S <number> specify the number of sectors per track

blasthoff@blasthoff ~ $ cat /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
set have_grubenv=true
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
}

function load_video {
insmod vbe
insmod vga
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set b35d054f-0b43-40ff-a13c-c0acbcf2463a
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set b35d054f-0b43-40ff-a13c-c0acbcf2463a
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/06_mint_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set b35d054f-0b43-40ff-a13c-c0acbcf2463a
insmod png
if background_image /boot/grub/linuxmint.png ; then
set color_normal=white/black
set color_highlight=white/light-gray
else
set menu_color_normal=white/black
set menu_color_highlight=white/light-gray
fi
### END /etc/grub.d/06_mint_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Linux Mint 10 64-bit, 2.6.35-22-generic (/dev/sda2)' --class linuxmint --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set b35d054f-0b43-40ff-a13c-c0acbcf2463a
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=b35d054f-0b43-40ff-a13c-c0acbcf2463a ro vga=795 quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Linux Mint 10 64-bit, 2.6.35-22-generic (/dev/sda2) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set b35d054f-0b43-40ff-a13c-c0acbcf2463a
echo 'Loading Linux 2.6.35-22-generic ...'
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=b35d054f-0b43-40ff-a13c-c0acbcf2463a ro single vga=795
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-22-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/10_lupin ###
### END /etc/grub.d/10_lupin ###

### 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,msdos2)'
search --no-floppy --fs-uuid --set b35d054f-0b43-40ff-a13c-c0acbcf2463a
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set b35d054f-0b43-40ff-a13c-c0acbcf2463a
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ "x${timeout}" != "x-1" ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep --interruptible 3 ; then
set timeout=0
fi
fi
fi
### 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 ###

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

pierre2 12-26-2010 06:51 AM

It seems that Win7 didn't make it into that menu list.

from a terminal, type:-

Code:

sudo apt-get install os-prober
sudo update-grub
grep menuentry /boot/grub/grub.cfg


reboot the machine,
& post the output of that file, again.

Blasthoff 12-27-2010 08:05 PM

Ok, I hope I did this right. This is what I got first time:
Quote:

blasthoff@blasthoff ~ $ sudo apt-get install os-prober
[sudo] password for blasthoff:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
blasthoff@blasthoff ~ $ sudo update-grub
Generating grub.cfg ...
grep menuentFound Debian background: linuxmint.png
Found linux image: /boot/vmlinuz-2.6.35-22-generic
Found initrd image: /boot/initrd.img-2.6.35-22-generic
Found memtest86+ image: /boot/memtest86+.bin
done
blasthoff@blasthoff ~ $ grep menuentry /boot/grub/grub.cfg
menuentry 'Linux Mint 10 64-bit, 2.6.35-22-generic (/dev/sda2)' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry 'Linux Mint 10 64-bit, 2.6.35-22-generic (/dev/sda2) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry "Memory test (memtest86+)" {
menuentry "Memory test (memtest86+, serial console 115200)" {
blasthoff@blasthoff ~ $
Second time:
Quote:

blasthoff@blasthoff ~ $ sudo apt-get install os-prober
[sudo] password for blasthoff:
Reading package lists... Done
Building dependency tree
Reading state information... Done
os-prober is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
blasthoff@blasthoff ~ $ sudo update-grub
Generating grub.cfg ...
Found Debian background: linuxmint.png
Found linux image: /boot/vmlinuz-2.6.35-22-generic
Found initrd image: /boot/initrd.img-2.6.35-22-generic
Found memtest86+ image: /boot/memtest86+.bin
done
blasthoff@blasthoff ~ $ grep menuentry /boot/grub/grub.cfg
menuentry 'Linux Mint 10 64-bit, 2.6.35-22-generic (/dev/sda2)' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry 'Linux Mint 10 64-bit, 2.6.35-22-generic (/dev/sda2) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
menuentry "Memory test (memtest86+)" {
menuentry "Memory test (memtest86+, serial console 115200)" {
blasthoff@blasthoff ~ $

syg00 12-27-2010 10:17 PM

That was "sudo fdisk -l" (lower case ell as in list, not the digit one).

Seems @pierre2is correct - os-prober is not recognising the Win7 on the SSD. Your options are to build a custom entry for it (see this for info), or to use the Win7 loader to chainload grub. Unfortunately this latter isn't as easy as it used to be - grub2 complains about being installed into a partition, and may fail unexpectedly at some point in the future. I haven't had this happen, but it might.

Blasthoff 01-04-2011 05:15 PM

I just want to say thanks to syg00 and pierre2 for the help. I'm going to put this task aside for a bit since it isn't critical. Actually, you helped me more then you know. One of my main reasons for installing Linux was to begin learning Linux commands and before I even pulled up a book, you helped me reach first base. That's big, because experience has taught me the first step is hardest. I'm not new to computers, just Linux and I'm way past due jumping in. I'll tackle this again in the near future after getting my feet wet a bit. I'll report back here on how I make out or if I hit a snag in understanding something.

Many Thanks!


All times are GMT -5. The time now is 11:39 PM.