oblib
October 22nd, 2005, 12:03 PM
If you do not want to use grub for your bootloading control, you can do the following. This assumes Ubuntu is already installed, and the Windows MBR is still intact. This would be the case if you are booting from a floppy, or have it set up like I do. I have Windows installed on hda1 (C:\) and Ubuntu on hdb (used to be D:\) and I used to just choose the boot drive in BIOS before booting to select Windows or Ubuntu.
The goal is to make a copy of a bootrecord that you can put on the windows drive. Use http://www.ubuntuforums.org/showthread.php?t=56723 instead if you already have a boot floppy for Ubuntu. If you don't then you can do the following, adapted from http://jaeger.morpheus.net/linux/ntldr.php.
You need to know what your root partition is. In fstab (type: cat /etc/fstab) it is the entry with / as the mount point. For me it is hdb1, so wherever I say hdb1, replace it with your root.
Get lilo from synaptic.
Run liloconfig as root:
sudo liloconfig
It will ask you some questions:
Install a partition boot record to boot Linux from /dev/hdb1? (answer yes if this is your root partition. If not, something is weird)
Use LBA32 for addressing big disks using new BIOS features ? (answer yes if your drive supports it, which is likely)
Enter the number of the bitmap: (choose a bitmap, doesn't matter)
Install a master boot record on /dev/hdb? (answer 'no' unless you want to replace grub on that drive)
Make /dev/hdb1 the active partition? (answer yes)
Then it creates /etc/lilo.conf. I had a couple of warnings about not being on the first disk in the system and the video adapter, but they are not important.
Now we need to edit lilo.conf.
sudo gedit /etc/lilo.conf
Change:
prompt
timeout=50
to
#prompt
#timeout=50
so that it won't pause. Now scroll down the the very bottom and comment out all of the images that you don't want to boot with # like above. My whole lilo.conf looked like this:
# Generated by liloconfig
# This allows booting from any partition on disks with more than 1024
# cylinders.
lba32
# Specifies the boot device
boot=/dev/hdb1
# Specifies the device that should be mounted as root.
# If the special name CURRENT is used, the root device is set to the
# device on which the root file system is currently mounted. If the root
# has been changed with -r , the respective device is used. If the
# variable ROOT is omitted, the root device setting contained in the
# kernel image is used. It can be changed with the rdev program.
root=/dev/hdb1
# Bitmap configuration for /boot/sarge.bmp
bitmap=/boot/sarge.bmp
bmp-colors=1,,0,2,,0
bmp-table=120p,173p,1,15,17
bmp-timer=254p,432p,1,0,0
# Enables map compaction:
# Tries to merge read requests for adjacent sectors into a single
# read request. This drastically reduces load time and keeps the map
# smaller. Using COMPACT is especially recommended when booting from a
# floppy disk.
# compact
# Install the specified file as the new boot sector.
# LILO supports built in boot sectory, you only need
# to specify the type, choose one from 'text', 'menu' or 'bitmap'.
# new: install=bmp old: install=/boot/boot-bmp.b
# new: install=text old: install=/boot/boot-text.b
# new: install=menu old: install=/boot/boot-menu.b or boot.b
# default: 'menu' is default, unless you have a bitmap= line
# Note: install=bmp must be used to see the bitmap menu.
# install=menu
install=bmp
# Specifies the number of _tenths_ of a second LILO should
# wait before booting the first image. LILO
# doesn't wait if DELAY is omitted or if DELAY is set to zero.
# delay=20
# Prompt to use certaing image. If prompt is specified without timeout,
# boot will not take place unless you hit RETURN
#prompt
#timeout=50
# Specifies the location of the map file. If MAP is
# omitted, a file /boot/map is used.
map=/boot/map
# Specifies the VGA text mode that should be selected when
# booting. The following values are recognized (case is ignored):
# NORMAL select normal 80x25 text mode.
# EXTENDED select 80x50 text mode. The word EXTENDED can be
# abbreviated to EXT.
# ASK stop and ask for user input (at boot time).
# <number> use the corresponding text mode. A list of available modes
# can be obtained by booting with vga=ask and pressing [Enter].
vga=normal
# These images were automagically added. You may need to edit something.
#image=/boot/vmlinuz-2.6.10-5-386
# label="Lin 2.6.10img0"
# initrd=/boot/initrd.img-2.6.10-5-386
# read-only
#image=/boot/vmlinuz-2.6.11-1-386
# label="Lin 2.6.11img1"
# initrd=/boot/initrd.img-2.6.11-1-386
# read-only
#image=/boot/vmlinuz-2.6.11-1-686
# label="Lin 2.6.11img2"
# initrd=/boot/initrd.img-2.6.11-1-686
# read-only
image=/boot/vmlinuz-2.6.12-9-386
label="Lin 2.6.12img3"
initrd=/boot/initrd.img-2.6.12-9-386
read-only
#image=/boot/memtest86+.bin
# label="Memory Test+"
# read-only
# If you have another OS on this machine (say DOS),
# you can boot if by uncommenting the following lines
# (Of course, change /dev/hda2 to wherever your DOS partition is.)
# other=/dev/hda2
# label="MS Windows"
You won't have as many images if you did a fresh Breezy install. You want the image with 2.6.12-9 if you are using the basic Breezy setup. Use 'uname -r' if you aren't sure.
Save the file and run lilo:
sudo lilo
It should return something like (after any repeated warnings):
Added Lin_2.6.12img3 *
Now you have written a good bootrecord to the root. To copy it:
sudo dd if=/dev/hdb1 of=bootsect.lnx bs=512 count=1
Once you have created bootsect.lnx, you have to get that to C:\ however you can. Email, shared drive, floppy, that's up to you.
Boot to windows and edit C:\boot.ini. This is the file that Windows looks at on boot. Add the following line:
c:\bootsect.lnx="Ubuntu Linux"
You might want to adjust the timeout to your liking, and select which will be default.
Now if you reboot to your windows drive, it should give you the option of booting Ubuntu or booting Windows. If it doesn't work, however you used to boot Ubuntu (through BIOS in my case) should still work as before.
If you ever change kernels or upgrade (like when I just upgraded to Breezy) you will need to edit your lilo.conf to reflect the kernel change, run lilo, and copy the record over to Windows again.
The goal is to make a copy of a bootrecord that you can put on the windows drive. Use http://www.ubuntuforums.org/showthread.php?t=56723 instead if you already have a boot floppy for Ubuntu. If you don't then you can do the following, adapted from http://jaeger.morpheus.net/linux/ntldr.php.
You need to know what your root partition is. In fstab (type: cat /etc/fstab) it is the entry with / as the mount point. For me it is hdb1, so wherever I say hdb1, replace it with your root.
Get lilo from synaptic.
Run liloconfig as root:
sudo liloconfig
It will ask you some questions:
Install a partition boot record to boot Linux from /dev/hdb1? (answer yes if this is your root partition. If not, something is weird)
Use LBA32 for addressing big disks using new BIOS features ? (answer yes if your drive supports it, which is likely)
Enter the number of the bitmap: (choose a bitmap, doesn't matter)
Install a master boot record on /dev/hdb? (answer 'no' unless you want to replace grub on that drive)
Make /dev/hdb1 the active partition? (answer yes)
Then it creates /etc/lilo.conf. I had a couple of warnings about not being on the first disk in the system and the video adapter, but they are not important.
Now we need to edit lilo.conf.
sudo gedit /etc/lilo.conf
Change:
prompt
timeout=50
to
#prompt
#timeout=50
so that it won't pause. Now scroll down the the very bottom and comment out all of the images that you don't want to boot with # like above. My whole lilo.conf looked like this:
# Generated by liloconfig
# This allows booting from any partition on disks with more than 1024
# cylinders.
lba32
# Specifies the boot device
boot=/dev/hdb1
# Specifies the device that should be mounted as root.
# If the special name CURRENT is used, the root device is set to the
# device on which the root file system is currently mounted. If the root
# has been changed with -r , the respective device is used. If the
# variable ROOT is omitted, the root device setting contained in the
# kernel image is used. It can be changed with the rdev program.
root=/dev/hdb1
# Bitmap configuration for /boot/sarge.bmp
bitmap=/boot/sarge.bmp
bmp-colors=1,,0,2,,0
bmp-table=120p,173p,1,15,17
bmp-timer=254p,432p,1,0,0
# Enables map compaction:
# Tries to merge read requests for adjacent sectors into a single
# read request. This drastically reduces load time and keeps the map
# smaller. Using COMPACT is especially recommended when booting from a
# floppy disk.
# compact
# Install the specified file as the new boot sector.
# LILO supports built in boot sectory, you only need
# to specify the type, choose one from 'text', 'menu' or 'bitmap'.
# new: install=bmp old: install=/boot/boot-bmp.b
# new: install=text old: install=/boot/boot-text.b
# new: install=menu old: install=/boot/boot-menu.b or boot.b
# default: 'menu' is default, unless you have a bitmap= line
# Note: install=bmp must be used to see the bitmap menu.
# install=menu
install=bmp
# Specifies the number of _tenths_ of a second LILO should
# wait before booting the first image. LILO
# doesn't wait if DELAY is omitted or if DELAY is set to zero.
# delay=20
# Prompt to use certaing image. If prompt is specified without timeout,
# boot will not take place unless you hit RETURN
#prompt
#timeout=50
# Specifies the location of the map file. If MAP is
# omitted, a file /boot/map is used.
map=/boot/map
# Specifies the VGA text mode that should be selected when
# booting. The following values are recognized (case is ignored):
# NORMAL select normal 80x25 text mode.
# EXTENDED select 80x50 text mode. The word EXTENDED can be
# abbreviated to EXT.
# ASK stop and ask for user input (at boot time).
# <number> use the corresponding text mode. A list of available modes
# can be obtained by booting with vga=ask and pressing [Enter].
vga=normal
# These images were automagically added. You may need to edit something.
#image=/boot/vmlinuz-2.6.10-5-386
# label="Lin 2.6.10img0"
# initrd=/boot/initrd.img-2.6.10-5-386
# read-only
#image=/boot/vmlinuz-2.6.11-1-386
# label="Lin 2.6.11img1"
# initrd=/boot/initrd.img-2.6.11-1-386
# read-only
#image=/boot/vmlinuz-2.6.11-1-686
# label="Lin 2.6.11img2"
# initrd=/boot/initrd.img-2.6.11-1-686
# read-only
image=/boot/vmlinuz-2.6.12-9-386
label="Lin 2.6.12img3"
initrd=/boot/initrd.img-2.6.12-9-386
read-only
#image=/boot/memtest86+.bin
# label="Memory Test+"
# read-only
# If you have another OS on this machine (say DOS),
# you can boot if by uncommenting the following lines
# (Of course, change /dev/hda2 to wherever your DOS partition is.)
# other=/dev/hda2
# label="MS Windows"
You won't have as many images if you did a fresh Breezy install. You want the image with 2.6.12-9 if you are using the basic Breezy setup. Use 'uname -r' if you aren't sure.
Save the file and run lilo:
sudo lilo
It should return something like (after any repeated warnings):
Added Lin_2.6.12img3 *
Now you have written a good bootrecord to the root. To copy it:
sudo dd if=/dev/hdb1 of=bootsect.lnx bs=512 count=1
Once you have created bootsect.lnx, you have to get that to C:\ however you can. Email, shared drive, floppy, that's up to you.
Boot to windows and edit C:\boot.ini. This is the file that Windows looks at on boot. Add the following line:
c:\bootsect.lnx="Ubuntu Linux"
You might want to adjust the timeout to your liking, and select which will be default.
Now if you reboot to your windows drive, it should give you the option of booting Ubuntu or booting Windows. If it doesn't work, however you used to boot Ubuntu (through BIOS in my case) should still work as before.
If you ever change kernels or upgrade (like when I just upgraded to Breezy) you will need to edit your lilo.conf to reflect the kernel change, run lilo, and copy the record over to Windows again.