previous  next

Installing Debian on a Cobalt Qube 3

February 27, 2009

The Cobalt Qube 3 is an entirely different beast from the first two models in this line. This is the third Qube I have received free but it could not be more different from the other two.

(Update, March 29, 2010: Updated the Qube 3 to lenny without any problems or the need to upgrade the kernel. Just the usual apt-get update && apt-get dist-upgrade was enough, after changing the sources.list to pull in lenny. I run bind, apache2, wordpress, postfix, squirrelmail and mysql on this box.)

For one thing, the processor is an x86 (AMDK6-2). While this means one can use the bog standard i386 port of Debian, given the fact that a remote install is the only way that can be used with the Qube 3, and also given the individualistic boot process that the Qube 3 uses, there are some obstacles to be overcome.

The Qube 3 initially boots from a ROM and then looks for a zipped kernel in the boot directory. Earlier versions of the ROM only supported the 2.2 series; finding updated ROMs is a task in itself as the line has gone out of production.

The good points about the Qube 3 are its form factor; the memory used which is fairly easily available even now (PC133 or PC100 SDRAM); and the hard drive is easily changed. I put in a 40GB drive and the maximum amount of memory — 512 MB — before starting out.

For me, there were additional complications as the Debian version with which the Qube 3 could cope (it had a 2.10.1 ROM which could support a 2.4 series kernel and an ext3 filesystem) was Sarge which has now been archived and has no security updates.

I found Tim Wiley's guide very helpful and with bits of information from a few other sources I got Sarge installed and running on my Qube 3. The procedure described below is mostly taken from Wiley's site; I have dumbed it down a bit and added a few things here and there.

To install Debian on the Qube 3, you will need a null modem cable, a crossover cable, a second PC (which will be called the server henceforth), and the Cobalt Qube 3, of course. The second PC needs to be connected, either directly or through a LAN, to the internet.

I used a PC with two network cards as server; one was used to connect the Cobalt via a crossover cable and the second was connected to my home server via a switch. I had the Cobalt and eth1 on 192.168.2.0 and eth0 was on 192.168.1.0 which is the subnet I use for my home LAN.

On the box you are using as server, install debootstrap, nfs-user-server and a DHCP server
apt-get update && apt-get install debootstrap nfs-user-server dhcp3-server

Install what's needed to boot the Qube 3 from your server:
debootstrap --arch i386 sarge /nfsroot-x86 http://archive.debian.org/debian/

Edit /nfsroot-x86/etc/inittab
Comment out the six lines from tty1 to tty6 which start this way:
1:2345:respawn:/sbin/getty 38400 tty1

Uncomment the line for ttyS0 and change 9600 to 115200:
T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100

Create a sources.list in /nfsroot-x86/etc/apt/sources.list; as of this writing this is all you can use:
deb http://archive.debian.org/debian sarge main contrib non-free

deb-src http://archive.debian.org/debian sarge main contrib non-free
deb http://archive.debian.org/backports.org/ sarge-backports contrib main non-free

Chroot into /nfsroot-x86 to install software needed for putting Debian on the Qube 3
chroot /nfsroot-x86

apt-get update && apt-get install debootstrap alien vim

Leave the chroot. Create an fstab file in /nssroot-x86/etc/:
192.168.2.1:/nfsroot-x86 / nfs defaults 0 0

proc /proc proc defaults 0 0

Specify the directory to be exported for the NFS mount:
echo '/nfsroot-x86 192.168.2.0/255.255.255.0(rw,no_root_squash)' >> /etc/exports


Restart the nfs server so that the changes are incorporated:
/etc/init.d/nfs-user-server restart

Set up the DHCP server on the box you are using as server. Edit /etc/dhcp3/dhcpd.conf and add the following; comment out all other subnet settings:
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.2 192.168.2.100;

option domain-name-servers 192.168.1.1;

option domain-name "gnubies.com";

option routers 192.168.2.1;

default-lease-time 600;

max-lease-time 7200;
}


host cobalt {

hardware ethernet 00:10:e0:05:23:41;
fixed-address 192.168.2.2;
option routers 192.168.2.1;
next-server 192.168.2.1;
option root-path "/nfsroot-x86";
option host-name "cobalt";

(These settings mean I am using the 192.168.2.0 network for the install; my server is 192.168.2.1, the Qube 3 will be allocated 192.168.2.2. I have a valid DNS server running on 192.1681.1.1. Adjust your settings accordingly. To get the MAC address of the NIC on the Qube 3 to which the server is connected, use the ROM menu on the Cobalt. Else, run ethereal on the server and check the output after you boot the Qube 3. Or run tcpdump -i -e eth1 (the network interface on your server which is connected via the crossover cable to the Qube 3) and look at the output. Or tail -f /var/log/syslog and pick it up from the output.)

Restart the dhcp server:
/etc/init.d/dhcp3-server restart

I ran these two commands on the box doing the function of server, to ensure internet access for the Qube 3; this is because this box is not my gateway and ordinarily does not do IP masquerading:
echo 1 > /proc/sys/net/ipv4/ip_forward

/sbin/iptables --table nat --append POSTROUTING --protocol all --source 192.168.2.2 --jump MASQUERADE --out-interface eth0 --verbose

You may not need to do so.

Now we come to the second part of the installation

Connect the Qube 3 to your server using a null modem cable and a crossover cable.

Open a terminal on the server and as root enter:
screen /dev/ttyS0 11520

Start the Qube 3. Watch the output in the terminal and take note of the ROM version which is present. This will determine whether you can use ext3 for your filesystem. When it comes to "hit spacebar to enter ROM menu", do so. Then enter bfn and it will boot from the network and give you a login prompt. Log in as root.

Now you can partition the hard drive. You have to create a device for the drive after entering the dev directory:
mknod hda b 3 0


You can use either fdisk or cfdisk for partitioning; I used the latter.
cfdisk /dev/hda


The default Qube 3 ROM settings need the root and boot partitions to be on hda1. The filesystem you can choose is dependent on the ROM version in your Qube 3. I had version 2.10.1 which supported ext3. Earlier ROMs support only ext2.

Once again, depending on the ROM version, you can change the boot device and root device by using commands from the ROM menu.

Format the partitions you have created and then mount them with /mnt for the root partition. Use mke2fs /dev/hdaX for ext2 or mkfs -t ext3 /dev/hdaX for ext3. For your swap partition use mkswap.

Create directories under /mnt as needed; for example, if you have made a separate partition on your drive for /usr, then make a directory usr inside /mnt and mount your /usr partition on /mnt/usr. I use separate partitions for /, home, usr and var on my servers.

After mounting you can pull down the initial part of Debian for the Qube 3:
debootstrap --arch i386 sarge /mnt http://archive.debian.org/debian/
This takes a while to complete.

Now copy the files /etc/inittab and /etc/securetty into /mnt/etc; copy /etc/apt/sources.list into /mnt/etc/apt/.

Edit /mnt/etc/interfaces and set it up for use after you reboot the Qube 3:
auto lo
iface lo inet loopback

auto eth0

iface eth0 inet static

address 192.168.x.y (this address must make the Qube 3 accessible on your LAN after you have finished the install and rebooted)
netmask 255.255.255.0
network 192.168.x.0

broadcast 192.168.x.255

gateway 192.168.x.1
(it is the usual convention to use this address on the gateway box).

Modify the /mnt/etc/fstab file to represent the setup on your Qube 3:
/dev/hda1 / ext2 defaults,errors=remount-ro 0 1

/dev/hda2 none swap sw 0 0
proc /proc proc defaults 0 0

tmpfs /dev/shm tmpfs defaults
0 0

Edit /mnt/etc/hosts:
127.0.0.1 localhost.localdomain localhost

192.168.x.y cobalt.yourdomain.com cobalt
::1 ip6-localhost ip6-loopback


fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts


Edit /mnt/etc/hosts.deny:
ALL: ALL


Edit /mnt/etc/hosts.allow
ALL: 192.168.1.0/255.255.255.0

add other localnets as needed


Now you need to install a kernel. I have one 2.4 kernel here which I used initially. You also need to install the right version of modutils for this kernel – I have put it here. I obtained both from this site: imbezol.criticaldamage.com/linux/cobalt/. Have a look there if your needs are not the same as mine – remember, I had a 2.10.1 ROM which supports the 2.4 kernel.

Keeping the files (kernel and modutils) in /mnt/rom is recommended both by former Sun Cobalt engineer Tim Hockin and Wiley.

Convert the kernel rpm and the modutils rpm to .debs using alien. Chroot into /mnt and then install both. After that check /boot and see if a vmlinuz.bz2 is present – it should be there. The Qube 3 needs this for the second stage of booting.

You may need to add a line for eth0 to /etc/modules – both the network interfaces on the Qube 3 use the natsemi module.

You can install any additional software now – I installed ssh so I could use it to log in to the Qube 3 after rebooting instead of using screen.

Make sure you unmount all your partitions before rebooting
. If you install ssh, you will need to kill the process after it is installed, else /mnt will be busy and you will be unable to unmount it.

Reboot and if all has gone well, then you have a Qube 3 running Debian with a 2.4 series kernel. You will need to update this to a 2.6 series kernel.

Updating to a 2.6 series kernel


You first need to update your Qube 3 ROM; you can get a 2.10.3 ROM either from the Cobalt ROM Sourceforge project (the project now appears to be have been discontinued) or from my site. The ROM is here and the romutils includes the tool for flashing. You need to unzip the latter file.

Now you first need to back up your existing ROM:
./flashtool -v -r > backup.rom

Then flash the system with the new ROM
./flashtool -v -w cobalt-2.10.3-ext3-1M.rom

Only reboot if the process goes okay. Try again if it fails. If it fails repeatedly, try burning back the saved backup.rom.

Next download all the tools which you will need to compile a kernel the Debian way:
apt-get install build-essential bzip2 kernel-package gcc libncurses5 libncurses5-dev bin86 gawk ncurses-dev initramfs-tools

Tim Wiley has a Cobalt specific patch and config available for kernel 2.6.24-3 so I have used the same.

Most of the rest of the action is done in /usr/src/ Download the kernel source in that directory:
wget -c 'http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.24.3.tar.bz2'

Decompress the source: tar -jxvf linux-2.6.24.3.tar.bz2

Rename the source directory to identify it as the patched source: mv linux-2.6.24.3 linux-2.6.24.3-cobalt3-tw

Make a symlink to the source directory: ln -s linux-2.6.24.3-cobalt3-tw linux and then move into it cd /linux

Download the patch (alternative download site) and apply it:
patch -p1
< linux-2.6.24.3-cobalt3-tw.patch

Tim Wiley has a working config for the kernel. Or get it here.

Copy it as .config: cp linux-2.6.24.3-cobalt3-tw.config .config

Choose kernel options: make oldcconfig Wiley's config works a treat with my Qube 3, I didn't need any further options. If you want to add any more options use make menuconfig as well.

Clean the source: make-kpkg clean

Compile your source: make-kpkg --initrd --revision='2009.02.27-1' kernel_image kernel_headers modules_image (I put in the date of my kernel compile)

Install your kernel and kernel-headers, both of which will be in /usr/src
dpkg -i linux-image-2.6.24.3-cobalt3-tw_2009.02.27-1_i386.deb

dpkg -i linux-headers-2.6.24.3-cobalt3-tw_2009.02.27-1_i386.deb

Now create the vmlinux for the second stage of booting the Qube 3:
Re-enter the /linux directory and then make vmlinux modules modules_install
strip vmlinux
bzip2 -c vmlinux > /boot/vmlinuz-2.6.24.3-cobalt3-tw.bz2

The Qube 3 has no bootloader hence you need to create links to the new kernel for the ROM which manages the first stage of booting:
Enter the /boot directory. Then rm System.map vmlinux.bz2 initrd.img
ln -s System.map-2.6.24.3-cobalt3-tw System.map

ln -s initrd.img-2.6.24.3-cobalt3-tw initrd.img

ln -s vmlinuz-2.6.24.3-cobalt3-tw.bz2 vmlinux.bz2

Now you can reboot and when your Qube comes up again, it should be running the new kernel.

Contact me (remove the nospam before emailing).

previous next