Debian

From Soekris Info Wiki

Revision as of 03:07, 22 March 2015 by Firas (Talk | contribs)
Jump to: navigation, search

*THIS IS A WORK IN PROGRESS*

This page assumes that you are familiar with operating a Soekris box, and describes the steps needed to install Debian 7 (codenamed Wheezy) on it. More precisely, it was how I installed it on my net4801. It can also be used, with some modifications, to install other versions of Debian or Debian derivatives (however be careful that Ubuntu requires a PAE-enabled processor starting with version 12.04).

There are two main methods to install Debian (and its derivatives) on systems which are unable to use traditional bootable installation media. The first, and most commonly used among Soekris users, is to boot from the network using PXE. The second is similar to how some other distributions such as Gentoo are installed: the base system is first loaded on the target installation media by connecting it to a pre-existing system (in Debian, this is done with the debootstrap tool), and the media is then transferred to the target system. The first solution may be simpler for beginners since the installer program is the same as that found on the traditional installation media, but on the other hand it requires an external PXE server for booting.

Here, I will only cover the first solution for now, but I may add the second one later (I do not currently have a CompactFlash reader to connect the target CF to another system).

Booting and installing by PXE

To boot and install Debian on your Soekris box by PXE, you will need an additional machine on your network to serve as a PXE server. A fast Internet connection is also desirable since everything will be downloaded from the Internet. Although many other pages on this Wiki describe how to setup a PXE booting server, I will still do it here for the sake of completeness (and to offer my personal perspective). Because the PXE server will also act as a DHCP server, it is best to temporarily disable all other DHCP servers on your network (in particular, the one on your Internet gateway if there is one).

I use Ubuntu 14.04 as my PXE server. Also, to minimise disruption, I like to use a VirtualBox [1] virtual machine as PXE server: with the network interface of the virtual machine configured in "bridged" mode, it will behave as if it were another physical machine on the network. Since the server will act as the DHCP server on the network, its network interface must be configured with a static IP address, with an entry in /etc/network/interfaces similar to the following:

auto eth0
iface eth0 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1

Install the packages isc-dhcp-server (which may be called dhcp3-server on older systems), tftpd-hpa, and openbsd-inetd. We will first configure the DHCP server; open /etc/dhcp/dhcpd.conf in a text editor. First, specify the DNS-related information which the server will send to the clients by editing those two lines (which are lines 16-17 on my machine):

option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;

The domain name is generally not necessary, so you can comment this line out, and the name server line is self-explanatory. For me, it becomes:

#option domain-name "example.org";
option domain-name-servers 192.168.0.1;

We can then use this template (lines 38-41) for the rest of the configuration:

#subnet 10.254.239.0 netmask 255.255.255.224 {
#  range 10.254.239.10 10.254.239.20;
#  option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
#}

For me, it looks like this:

subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.100 192.168.0.199;
  option routers 192.168.0.1;
  filename "pxelinux.0";
}

Again, all the options are self-explanatory: subnet and netmask specify the network we are operating on, range specifies the range of IP addresses which the DHCP server will assign to the clients, and routers is the address of the gateway. Finally, filename specifies the name of the PXE image for booting, more details about this later. Save the file and restart the DHCP server with

$ sudo service isc-dhcp-server restart

You can check that the DHCP server is running with

$ service isc-dhcp-server restart

(if it is not running, it is probably due to a mistake in your dhcpd.conf or network configuration, for example if the server's IP address is not in the network specified in dhcpd.conf).

We will now configure the TFTP server. First look in /etc/default/tftpd-hpa to obtain the TFTP root directory (for me it is /var/lib/tftpboot). Then add the following line in /etc/inetd.conf:

tftp    dgram   udp    wait    root    /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

(replace /var/lib/tftpboot with your TFTP root directory if it is different), and restart inetd with

$ sudo service restart openbsd-inetd

Finally, we will extract the installation files to the TFTP root directory. Those files are located in the netboot.tar.gz archive which can be found on the Debian FTP mirrors. For an i386 install of Debian Wheezy, the file you want is

ftp://ftp.debian.org/debian/dists/wheezy/main/installer-i386/current/images/netboot/netboot.tar.gz

but you can replace wheezy with, e.g., testing or sid to obtain the corresponding archive. Extract it to the TFTP root folder with

$ cd /var/lib/tftpboot/
$ wget ftp://ftp.debian.org/debian/dists/wheezy/main/installer-i386/current/images/netboot/netboot.tar.gz -O-|sudo tar xz

We need to do some additional configuration for the boot process to operate on the serial line. First, add those two lines to pxelinux.cfg/default:

SERIAL 0 19200 0
CONSOLE 0

(of course, replace 19200 with the speed of your serial line if it is different; 19200 is the default for Soekris boxes). Finally, in debian-installer/i386/boot-screens/txt.cfg edit the append line from this

append vga=788 initrd=debian-installer/i386/initrd.gz -- quiet

to this:

append initrd=debian-installer/i386/initrd.gz console=ttyS0,19200 --

We are now ready to boot and install. The boot process is well-documented on this Wiki (basically, press Ctrl+P to enter comBIOS, and type boot f0 at the prompt), and the installer is the same as with traditional installation media.

After the installation, the system, including GRUB, has automatically been configured to operate over the serial line, but for some reason the kernel is not run with the correct console parameter, so the boot messages are not visible. To fix this this, edit the GRUB configuration file /etc/default/grub.

Personal tools