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

11 thoughts on “Installing Ubuntu Hoary from LiveCD”

  1. Hi,

    I followed your steps almost exactly, unfortunately, running update-grub doesnt generate any menu.lst file. I only get a single line output, that it found my boot directory at “/boot/grub”. Looking there, I couldnt find the menu.lst (or indeed anything). Any ideas what may be wrong ?

    In the end, I simply added an entry into my existing ubuntu warty’s grub to load the OS. Also I ran the grub commands:

    # grub
    grub> root (hd0,0)
    grub> setup (hd0,0)
    grub> quit
    to load grub into /dev/hda1 (where my installation lies).

    The OS loaded almost ok: I got a kernel panic stating VFS wasnt able to load any “hda1” device. I tried adding devfs=mount, to no effect.

    Any idea how I could fix these problems ?

    Rajeev J Sebastian

  2. If you put the following into the file /etc/kernel-img.conf:

    # Do not create symbolic links in /
    do_symlinks = no
    relative_links = yes
    do_bootloader = no
    do_bootfloppy = no
    do_initrd = yes
    link_in_boot = no
    postinst_hook = /sbin/update-grub
    postrm_hook = /sbin/update-grub

    … then kernel package installation will cause the grub menu.lst to be updated.

  3. Thanks for sharing the info. I’ve been looking for information on how to install a livecd that doesn’t include an installer. Although this is not quite what I was looking for it is a start and will help out if I want to make a custom Ubuntu Live CD. If I have the time. Take care.

  4. Thanks for writing this up! I am finding this useful.

    One thing (and this comes straight from Gentoo): since our resolv.conf already works (you said to configure it to apt-get cloop-utils), we could copy that to the directory with the chroot environment before we chroot into it (like when you copy /etc/network/interfaces).

    But, as the immortal Larry Wall says, TMTOWTDI. Great document!

    Peace,
    Derek Arnold
    Fellow Ubuntuer and WordPresser

  5. 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

  6. Thanks for the howto! Seriously, has nearly everything been done? I need some geeky projects and people keep hammering out this lil ideas I have for spending a week hating and loving all things techy. 😛

  7. If your hard drive devices don’t exist in your newly created /dev then update-grub won’t create the menu.1st file and you won’t be able to run any of the commands in grub correctly. I had to do a cp -a /dev/sda* /mnt/dev/
    After I did that everything worked fine.

    Thanks a lot for the howto.

  8. NO , i make step bye step in this document . but i can’t boot to X window system and i use kubuntu . i get error “Fatal server error” xauth:(argv):1: bad display name “:0” in “remove” command

    I not sure i maybe wrong.

    who can explain .

  9. I tried this with debian live.But there is squashfs instead of cloop.I installed it but have no idea about extracting sqashfs.Anybody help??

Leave a Reply

Your email address will not be published. Required fields are marked *