Dual-Boot Windows XP with Ubuntu Linux

If you install grub, setting it up for a dual boot Linux and WindowsXP, and then you get an “autochk fail” error when you try booting into WindowsXP, check that the Windows partition is not hidden.

If it is, add an “unhide” line before the “root” line in your menu.lst. Like so,

title Windows XP Professional
unhide (sd0,1)
root (sd0,1)
makeactive
chainloader +1

This example shows a SCSI disk with WindowsXP on the 2nd partition.

Installing Ubuntu Hoary from LiveCD

Note: This will not necessarily get you the installation you would have from an official installation CD! Use with caution…

I installed Hoary into a single partition, formatted as ext3 on a SCSI disk, with one other partition as swap. So I’ll be referring to /dev/sda5 and /dev/sda6 in this walk-through – you will need to use the right names for your installation.

Why did I do this?

I wanted Hoary on one of my machines. My original plan had been to install Warty and then use dist-upgrade, but for some reason, Warty hung in the installation after reboot. So since I didn’t actually want Warty, I thought about trying this approach instead.

Before you start

Make free space for new partitions on disk.

Boot from LiveCD into Hoary

You’ll do all the setup running Hoary from the LiveCD.

Create new partitions

Using fdisk, create two new partitions in the free space on disk you made earlier: “/” and swap.

Set partition IDs appropriately (0x82 and 0x83)

Make new filesystems on the partitions

I wanted to use ext3, you may prefer a different format. My new partitions were /dev/sda5 (Linux) and /dev/sda6(swap) so:

mkfs.ext3 /dev/sda5
mkswap /dev/sda6

Create /mnt and mount the new Linux partition on it.

# mkdir /mnt
# mount /dev/sda5 /mnt

Setup networking

You need this because you’ll need to install cloop-utils over the network in a minute.

Add your interface to /etc/network/interfaces and then bring it up. For example,

# vi /etc/network/interfaces
# ifup eth0

Add a known working nameserver in /etc/resolv.conf

Install cloop-utils

# apt-get update
# apt-get install cloop-utils

Populate filesystem

Now you’ve got cloop-utils, you can create the filesystem on your new Linux partition.

We’ll take this from the LiveCD.

First, extract the compressed filesystem to the hard disk.

# extract_compressed_fs /cdrom/casper/filesystem.cloop > /mnt/extracted_fs

Second, mount this now uncompressed filesystem

# mkdir /mnt/cloop
# mount /mnt/extracted_fs /mnt/cloop -o loop

Finally, copy the filesystem over to the new Linux partition.

# rsync -av /mnt/cloop/* /mnt/

Setup new Hoary system

Before you can boot your new Hoary system, you’ll need to do some of the things that the install process usually does for you, including installing the Grub bootloader.

Chroot into your new filesystem, so that all changes get made in the new partition.

# mount -t proc proc /mnt/proc
# cp /etc/network/interfaces /mnt/etc/network/interfaces
# chroot /mnt /bin/bash

You’ll need to modify resolv.conf within the chroot-ed environment, else name resolution won’t work.

# vi /etc/resolv.conf

Edit /etc/fstab (it’s currently empty) and set it up correctly. You need to get this right! Here’s an example.

# /etc/fstab: static file system information.
#
# proc /proc proc defaults 0 0
/dev/sda5 / ext3 defaults 0 1
/dev/sda6 none swap sw 0 0

Add yourself to sudoers list

You’ll need to use visudo

Install Grub

You’ll need to know what you’re doing with Grub. If you’re not sure, especially if you’ve already got Windows installed, check what you’re doing with someone who does understand it first!

# apt-get update
# apt-get install grub grub-doc

Generate a new menu.lst file

# update-grub

and edit it to suit you. If you have a dual-boot machine, then you’ll also need to add the other bootable partitions manually

Unless anyone knows how to do this automagically? please let me know

Then, copy over the stage 1 files

# cp /lib/grub/i386-pc/* /boot/grub

And now install grub

# grub
grub> root (hd0,4)
grub> setup (hd0)
grub> quit

Rebuild new kernel

I needed to rebuild the kernel at this point, since the default one didn’t seem to include SCSI. This might not have been necessary…

Follow instructions at http://www.ubuntulinux.org/wiki/KernelHowto

Remake initrd

Thanks to "noone cool" for this.

You should remove the current initrd file and run mkinitrd as the last step before rebooting. So any needed drivers at boot time will be available. This fixes a VFS root mount error you might get if you use ext3, sata, scsi, etc.


# rm /boot/initrd.img-2.6.10-3-386 (—change this if needed—)
# mkinitrd -o initrd.img-2.6.10-3-386 2.6.10-3-386

Reboot

Reboot, taking out the LiveCD. If you’ve got everything right, you’ll now have a running Hoary installation. If not, boot up the LiveCD and fix the problems.

Comments welcome!
Rachel

What I want from a PVR

Before we moved house, we lived in a Freeview area. I’d bought a great cheap Humax box which acted as a Freeview box with hard disk recorder. It was great, no messing around with videos, automatic channel change, timeslip function, the works.

Then we moved…

Now I live in a Telewest area, so we use that instead, a much cheaper option than upgrading the TV aerial to digital etc. And we use the cable for phone, and I use the Internet option for work. All round a good cable solution.

Except I really miss my nice Humax box (now donated to my brother…) Now I could use my video recorder, but that has these problems:

  • You have to use tapes. Once you get used to the convenience of recording to disk, you never want to go back to recording onto tapes which you then need to label, keep track off (now where was that half-hour program I recorded 3 weeks ago?)
  • You have set two machines not one each time you want to record a show. Thanks to the advances of modern technology, your Telewest box won’t automatically change channel when your VCR wants to record, so you can only record what the Telewest box is set to. So you must set the Telewest box to switch channel at the right time, and the VCR to record at the right time. Way too much hassle
  • No timeslip.

So given that I can’t find one to buy, I’m going to build one. Watch this space to see how…