Installing Ubuntu Via Debootstrap


Table of Contents

Installing Ubuntu From Knoppix 
Introduction & warning 
Get debootstrap scripts 
Run debootstrap 
Set up the host name 
Set up fstab 
Set up Networking 
Enter the install environment 
Install the kernel and bootloader 
Set up base system 
Installing Ubuntu From Another Distro 
Introduction and Warning 
Before We Begin 
Summary of Actions to be taken 
Installation 

Installing Ubuntu From Knoppix 

https://help.ubuntu.com/community/Installation/FromKnoppix

Introduction & warning 

This page describes how to install Ubuntu Linux on a machine using a Knoppix LiveCD and a network connection. There's no need for the Ubuntu install disk.

Get debootstrap scripts 

Knoppix includes debootstrap, but doesn't have the ubuntu scripts. The only way I know of to get these scripts is to get them from the debootstrap source archive.

  1. Grab the latest debootstrap_*.tar.gz from [WWW] http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/ Save the archive into the /home/knoppix/tmp directory because /tmp is probably too small.
  2. Uncompress and extract the archive, then cd into the newly created directory and build the program:

    # cd /ramdisk/home/knoppix/tmp
    # tar zxvf debootstrap_*.tar.gz
    # cd debootstrap-*
    # make

Run debootstrap 

You should run the debootstrap you just built, which requires a slightly odd invocation:

# DEBOOTSTRAP_DIR=`pwd` ./debootstrap --arch i386 breezy /mnt/ubuntu http://archive.ubuntu.com/ubuntu breezy

The Ubuntu debootstrap will now run the Ubuntu scripts. If your network is unreliable, you may need to run debootstrap multiple times to get all the files. It resumes where it left off.

Near the end of debootstrap's copious output, you should see "Base system installed successfully". If not, remove everything in /mnt/ubuntu apart from the lost+found directory and try again.

Set up the host name 

Of course, you should replace HOSTNAME in the command below with the desired name for your machine. You need to remove /mnt/ubuntu/etc/hostname first, because it will be a symbolic link to Knoppix's /etc/hostname by default due to a bug in debootstrap.

# rm -f /mnt/ubuntu/etc/hostname
# echo HOSTNAME > /mnt/ubuntu/etc/hostname

Set up fstab 

1) Create your fstab. Knoppix has already created one that is appropriate for your system, but you do need to make some changes.

# cp /etc/fstab /mnt/ubuntu/etc/fstab
# kate /mnt/ubuntu/etc/fstab
  • Change the mount points on the partition(s) you set up in step 1
  • Change their options to defaults
  • Change /mnt/auto/floppy to /mnt/floppy. Do the same for /mnt/cdrom.
  • Add sync to the options for /mnt/floppy
  • Remove the /dev/pts line — not needed?

Here is a decent /etc/fstab:

proc     /proc    proc    defaults   0 0

/dev/hda3 /       ext3    defaults   0 1
/dev/hda5 none    swap    defaults   0 0

/dev/fd0  /mnt/floppy auto user,noauto,sync,exec,umask=000 0 0
/dev/cdrom /mnt/cdrom auto user,noauto,exec,ro   0 0

Set up Networking 

Start with Knoppix's network/interfaces and resolv.conf files, then modify them to suit your needs.

# cp /etc/network/interfaces /mnt/ubuntu/etc/network/
# cp /etc/resolv.conf /mnt/ubuntu/etc/
# kate /mnt/ubuntu/etc/network/interfaces

You also need to set up the hosts file to include your machine name. Change "Knoppix" to your machine name. Feel free to delete all the IPV6 stuff.

# cp /etc/hosts /mnt/ubuntu/etc/
# kate /mnt/ubuntu/etc/hosts

Here is my /etc/hosts for lea.rinspin.com.

127.0.0.1   localhost
127.0.0.1   lea.rinspin.com     lea

Enter the install environment 

# chroot /mnt/ubuntu
# mount /proc

You don't need to worry about the root partition because you mounted that in the first step. You'll need to mount /proc and any other partitions that you set earlier.

Install the kernel and bootloader 

The default bootloader for Ubuntu is grub.

# apt-get install linux-image-386
# apt-get install grub

Now configure grub to boot off hda3. Because Linux starts numbering at hda1, but grub starts at hda0, you must subtract 1 from the partition number. (hd0,2) is equivalent to hda3, and (hd1,0) is equivalent to hdb1.

I'm not sure why grub can't find stage1 in /lib/grub, where the grub package installs it. Until I know more, the easy way to fix this is to simply copy everything to /boot/grub, where grub is looking for it.

# mkdir /boot/grub
# cp /lib/grub/i386-pc/* /boot/grub
# nano /boot/grub/grub.conf

Here's a sample /boot/grub/menu.lst that you can use.

default 0
timeout 4

title=Ubuntu
  root (hd0,2)
  kernel /vmlinuz root=/dev/hda3
  initrd /initrd.img

title=Windows
  root (hd0,0)
  makeactive
  chainloader +1

title=Memtest86
  root (hd0,2)
  kernel /boot/memtest86+.bin

Remember to make a symbolic link from /boot/grub/grub.conf to /boot/grub/menu.lst (that is what grub looks for at boot time…)

ln -s /boot/grub/grub.conf /boot/grub/menu.lst

Run grub to install the bootsector in the MBR.

# grub --no-floppy
grub> root (hd0,2)
grub> setup (hd0)
grub> quit

Now unmount the drives, exit the subshell, and reboot! Your Ubuntu system should be ready to go.

# exit             <-- exits the chroot subshell
# umount /mnt/ubuntu
# shutdown -r now

FOLLOW UP: Installing the kernel and bootloader then following up with the base-config works. /etc/network/interfaces and /etc/apt/sources.list must be setup correctly.

Set up base system 

Set up the keyboard.

# dpkg-reconfigure console-data

Set up timezones, users, and apt. This is a lengthy process that will try to launch GDM at the end. Of course, GDM can't run because Knoppix already has the screen, but the screen may flash as they fight.

[Note]

it's probably more correct to install the kernel and bootloader. Then, reboot into the newly installed system and run base-config.

# /usr/sbin/base-config new

Set up locales. You might want to skip this step if you only want to use English on this machine.

# dpkg-reconfigure locales

NB, Doing base-config is essential to use apt in the chroot environment.

documented on: 2006-02-22 00:04:03 by DennisKaarsemaker