This section explains how to install Debian GNU/Linux from an existing Unix or Linux system, without using the menu-driven installer as explained in the rest of the manual. This “cross-install” HOWTO has been adapted from the Debian Installer guide for debonaras.org .This guide is for NSLU2 with OpenSlug, you can't run it on UcSlugC. In this section some familiarity with entering *nix commands and navigating the file system is assumed.
Once you've got the new Debian system configured to your preference, you can migrate your existing user data (if any) to it, and keep on rolling. This is therefore a “zero downtime” Debian GNU/Linux install. It's also a clever way for dealing with hardware that otherwise doesn't play friendly with various boot or installation media.
With your current *nix partitioning tools, repartition the hard drive as needed, creating at least one filesystem plus swap. You need at least 128mb for the base debootstrap. That includes 42mb of packages you can clean out when you get into the chroot. More space is prefered if you want to install any software at all.
To create file systems on your partitions. For example, to create an
ext3 file system on partition /dev/sda1 (that's
our example root partition):
# mke2fs -j /dev/sda1
To create an ext2 file system instead, omit -j.
Initialize and activate swap (substitute the partition number for your intended Debian swap partition):
# mkswap /dev/sda2 # sync; sync; sync # swapon /dev/sda2
Mount one partition as /mnt/debinst (the
installation point, to be the root (/) filesystem
on your new system). The mount point name is strictly arbitrary, it is
referenced later below.
# mkdir /mnt/debinst # mount /dev/sda1 /mnt/debinst
If you want to have parts of the filesystem (e.g. /usr) mounted on separate partitions, you will need to create and mount these directories manually before proceding with the next stage.
The tool that the Debian installer uses, which is recognized as the
official way to install a Debian base system, is
debootstrap. It uses wget and
ar, but otherwise depends only on
/bin/sh. Install wget and
ar if they aren't already on your current system,
then download and install debootstrap.
Or, you can use the following procedure to install it manually. Make a work folder for extracting the .deb into:
# cd /mnt/debinst # mkdir work # cd work
The debootstrap binary is located in the Debonaras archive.. Download the debootstrap .deb from the pool, copy the package to the work folder, and extract the binary files from it. You will need to have root privileges to install the binaries.
# ar -x debootstrap_0.X.X_arch.deb # zcat data.tar.gz | tar xv
Please edit the usr/sbin/debootstrap script and change DEBOOTSTRAP_DIR= to point at the location of your debootstrap file.
# vi ./usr/sbin/debootstrap
( /mnt/debinst/work/usr/lib/debootstrap )
Note that running debootstrap may require you to have
a minimal version of glibc installed (currently
GLIBC_2.3). debootstrap itself is a shell script, but
it calls various utilities that require glibc. (i.e. you can't run it on UcSlugC)
Substitute one of the following for ARCH
in the debootstrap command:
alpha,
arm,
armeb,
hppa,
i386,
ia64,
m68k,
mips,
mipsel,
powerpc,
s390, or
sparc.
# ./usr/sbin/debootstrap --arch ARCH sarge /mnt/debinst http://ftp.debonaras.org/sarge/debian
( For nslu2 that is armeb )
Copy over working interfaces file, later we will add more to it.
# cp /etc/network/interfaces /mnt/debinst/etc/network/interfaces
Now you've got a real Debian system, though rather lean, on disk. Chroot into it:
# LANG= chroot /mnt/debinst /bin/bash
You need to create /etc/fstab.
# editor /etc/fstab
Here is a sample you can modify to suit:
#################START##################################### # /etc/fstab: static file system information. # # file system mount point type options /dev/sda1 / ext3 defaults 1 1 /dev/sda2 swap swap defaults 0 0 proc /proc proc defaults 0 0 usbfs /proc/bus/usb usbfs defaults 0 0 ####################END#####################################
Use mount -a to mount all the file systems you
have specified in your /etc/fstab, or to mount
file systems individually use:
# mount /path # e.g.: mount /usr
You can mount the proc file system multiple times and to arbitrary
locations, though /proc is customary. If you didn't use
mount -a, be sure to mount proc before continuing:
# mount -t proc proc /proc
The command ls /proc should now show a non-empty
directory. Should this fail, you may be able to mount proc from outside
the chroot:
# mount -t proc proc /mnt/debinst/proc
To configure your keyboard:
# dpkg-reconfigure console-data
Note that the keyboard cannot be set while in the chroot, but will be configured for the next reboot.
To configure networking, edit
/etc/network/interfaces,
/etc/resolv.conf, and
/etc/hostname.
# editor /etc/network/interfaces
Here are some simple examples merged from
nslu2 and debonaras wiki , plus some irc logs:
##########################START########################################
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# See the interfaces(5) manpage for information on what options are
# available.
######################################################################
# We always want the loopback interface.
#
auto lo
iface lo inet loopback
#
# The NSLU2 built-in ethernet
auto eth0
# The pre-up option must always be supplied, regardless
# of configuration, to set the hardware correctly.
# Severe network problems may result if this option is
# removed.
iface eth0 inet dhcp
pre-up modprobe -f ixp425_eth
pre-up modprobe -f ixp400
pre-up ifconfig eth0 hw ether 00:04:5A:XX:YY:ZZ
# make sure you copy in your own ethernet MAC address from the sticker on the bottom of your slug, replace XX:YY:ZZ
# set static fallback address ...
# It would be a good idea to set this, really.
#address give.me.an.ip
#netmask give.me.a.netmask
#gateway give.me.a.gw
#
#######################END##################################################
Edit your nameserver(s) and search directives in
/etc/resolv.conf:
# editor /etc/resolv.conf
A simple /etc/resolv.conf:
##########START################## search hqdom.local\000 nameserver 10.1.1.36 nameserver 192.168.9.100 ##################END#############
Enter your system's host name (2 to 63 characters):
# echo DebianHostName > /etc/hostname
If you have multiple network cards, you should arrange the names of
driver modules in the /etc/modules file into the
desired order. Then during boot, each card will be associated with the
interface name (eth0, eth1, etc.) that you expect.
Set your timezone, add a normal user, and choose your apt sources by running
# /usr/sbin/base-config new
For now choose apt-sources by hand and edit your /etc/apt/sources.list , add this:
#########START####################### # Use this /etc/apt/sources.list for now please deb http://ftp.debonaras.org/sarge/debian sarge main deb http://ftp.debonaras.org/sarge/debonaras sarge main ###########END########################
Update you package lists:
# apt-get update
# apt-get remove modutils # apt-get install module-init-tools # rm /etc/rcS.d/S20modutils
# apt-get install udev
We want to be popular so please install the popcon package.
# apt-get install anacron popularity-contest
We need ssh to be able to connect to the slug after boot.
# apt-get install ssh
Edit /etc/inittab to disable the tty[1-6] entries and add the following serial console entry:
S0:2345:respawn:/sbin/getty 115200 ttyS0
Edit /etc/init.d/checkroot.sh to remove /.recovery rm -f /.recovery
To configure your locale settings to use a language other than English, install the locales support package and configure it:
# apt-get install locales # dpkg-reconfigure locales
NOTE: Apt must be configured before, ie. during the base-config phase. Before using locales with character sets other than ASCII or latin1, please consult the appropriate localization HOWTO.
If you intend to boot this system, you probably want a Linux kernel and a boot loader. Identify available pre-packaged kernels with
# apt-cache search kernel-image
Then install your choice using its package name. For now that is the nslu2 kernels in the debonaras feed.
# apt-get install kernel-image-2.X.X-arch-nslu2
Kernel does NOT include the IXP modules, as they are not DFSG-compliant!
So we either symlink the OpenSlug modules since you already have them installed on the flash and you have accepted the license by installing OpenSlug already (1). Or we copy the modules over from the openslug rootfs (2).
(1) # rm -rf /lib/modules ; ln -s /initrd/lib/modules /lib/modules (2) Be outside the chroot # cp -R /lib/modules/2.6.12.2/* /mnt/debinst/lib/modules/2.6.12.2/
Please make sure kernel versions match.
We need to prepare for umounting the Debian rootfs.
# /etc/init.d/anacron stop # /etc/init.d/exim4 stop # /etc/init.d/syslogd stop # umount /proc/bus/usb/ # umount /proc/ # swapoff -a
You may need to kill syslogd the hard way, with 'kill -9 syslogd.pid'
To make your Debian GNU/Linux system bootable, we rely on the OpenSlug in flash to load the installed kernel with your new root partition. Note that debootstrap does not install a boot loader, we need to get out of the Debian chroot to set this up. OpenSlug is used both as a boot loader and as a recovery root filesystem.
Exit the Debian chroot for the next steps.
# exit
Reflash the new Debian kernel.
# reflash -k /mnt/debinst/vmlinuz
Unmount the Debian rootfs
# cd / # umount /mnt/debinst
Turnup disk get you new root fs to load
# turnup disk -s7 /dev/sda1 -t ext3