Debian Lenny on a Soekris net4501

IMPORTANT: this is a work in progress!

I have a second hand net4501 and wanted to transfer an existing Debian lenny install to it.

These notes make a few assumptions at various levels:

In practice it took me several iterations to discover all the things I needed to fix; this process is not reflected here, only the outcome.

Cloning The System

I cloned the system onto a spare 2GB compact flash card connected via a card reader to the origin system. I allocated 1.5GB to / and the remaining 0.5GB to swap. Here's what the fdisk output looks like:

   Disk /dev/sda: 2080 MB, 2080374784 bytes
128 heads, 32 sectors/track, 992 cylinders
Units = cylinders of 4096 * 512 = 2097152 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         715     1464304   83  Linux
/dev/sda2             716         992      567296   82  Linux swap / Solaris

Use mkfs and mkswap to create a filesystem and swap partition. Make sure you get the right device names. I'd hoped to do without swap but it turns out that the 4501 does not have enough RAM to run dpkg. Then mount the filesystem, e.g. on /mnt.

If you prefer to identify filesystems by UUID, then you should find it out now, for instance with a command like this:

tune2fs -l /dev/sda1|grep UUID

Having created and formatted a root partition as ext3, copy the origin system onto it and chroot into it to make further preparations for the change of hardware.

I missed /proc and /sys when I cloned the system (probably precisely because they are mounted filesystems). Be sure to check that they exist before proceeding further.

I had an hdparm command left over from the old system. This was inappropriate for the new one and caused it to hang.

Kernel And Ramdisk

Install the linux-image-486 metapackage to get the right kernel package, and remove the old -686 kernel if present. Similarly if you have libc6-i686 or other inappropriate CPU-specific packages installed now would be as good a time as any to remove them.

In /etc/initramfs-tools/initramfs.conf set:

MODULES=list

...and then list the required modules in /etc/initramfs-tools/modules:

ide_generic
ide_disk
ext3
natsemi
ide_core

The first of these steps help eliminate unwanted modules from the ramdisk. This isn't strictly necessary but you'll be glad of it if you rebuild the ramdisk often. The second ensures that the necessary modules are actually loaded; ide_generic in particular is critical as the system will not detect the CF card without it!

natsemi is the network driver. The rest are to do with disk IO.

After making these changes run:

update-initramfs -v -u

Linux Configuration

Edit /etc/udev/rules.d/70-persistent-net.rules to mention the new systems MAC addresses (helpfuly printed on the bottom of the unit). This ensures a predictable and consistent relationship between the device names and the physical ports.

Update /etc/fstab for the new system.

UUID=a074580f-dc9c-4d09-8133-8fdb05bf7365 / ext3 defaults,noatime,errors=remount-ro 0 1
/dev/hda2 none swap sw 0 0

Edit the virtual console lines (1-6) out of /etc/inittab and added a line for the serial console:

S0:2345:respawn:/sbin/getty -L 57600 ttyS0 vt100

Boot Loader

Grub works fine (I hear that LILO works fine too, but won't cover that here). First it is necessary to install it on the CF card. In the chroot, /boot/grub/device.map should reflect the device name of the CF card, in my case /dev/sda but check:

(hd0)	/dev/sda

(Note that this will need to be changed later on.)

Then you can install Grub:

grub-install --no-floppy /dev/sda

Next edit the kopt line in /boot/grub/menu.lst:

# kopt=root=/dev/hda1 ro console=ttyS0,57600n8 noreplace-paravirt

To clarify:

The console setting makes Linux use a serial console.

The noreplace-paravirt setting suppresses some paravirtualization support which does not run on the 4501's CPU. Unless you want to virtual machines on the system this is harmless! See #511703 and #515982. Without it the crash will look like this:

[    0.120007] Checking 'hlt' instruction... OK.
[    0.144009] BUG: unable to handle kernel NULL pointer dereference at 00000286
[    0.156009] IP: [<c010797d>] text_poke_early+0x41/0x52
[    0.164010] *pde = 00000000
[    0.172010] Oops: 0000 [#1]
[    0.172010] Modules linked in:
[    0.172010]
[    0.172010] Pid: 0, comm: swapper Not tainted (2.6.26-2-486 #1)
[    0.172010] EIP: 0060:[<c010797d>] EFLAGS: 00010286 CPU: 0
[    0.172010] EIP is at text_poke_early+0x41/0x52
[    0.172010] EAX: 00000286 EBX: 0000000a ECX: 00000000 EDX: 00000286
[    0.172010] ESI: c0363ee0 EDI: c010797f EBP: c0107975 ESP: c0363eb0
[    0.172010]  DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
[    0.172010] Process swapper (pid: 0, ti=c0362000 task=c033a320 task.ti=c0362000)
[    0.172010] Stack: 00000286 00000000 c036a62e c03ab534 0000000a c0363ee0 c0363ed6 c0107a71
[    0.172010]        c03b21bc 9d50c1ef 26b48d90 00000000 000000b6 00000000 c03ec868 00000046
[    0.172010]        00000046 c033e5e0 00000000 c0344d60 00000000 00000000 c0105dcc c0363fec
[    0.172010] Call Trace:
[    0.172010]  [<c036a62e>] native_init_IRQ+0x46/0x79
[    0.172010]  [<c0107a71>] apply_paravirt+0x81/0x91
[    0.172010]  [<c0105dcc>] do_IRQ+0x50/0x60
[    0.172010]  [<c0104763>] common_interrupt+0x23/0x30
[    0.172010]  [<c011c446>] vprintk+0x269/0x275
[    0.172010]  [<c012c1ef>] ktime_get+0xd/0x21
[    0.172010]  [<c0131619>] tick_nohz_stop_sched_tick+0x24f/0x259
[    0.172010]  [<c0105dcc>] do_IRQ+0x50/0x60
[    0.172010]  [<c0104763>] common_interrupt+0x23/0x30
[    0.172010]  [<c036b705>] alternative_instructions+0x23/0x3c
[    0.172010]  [<c036bf98>] check_bugs+0xd2/0xd4
[    0.172010]  [<c03649bc>] start_kernel+0x271/0x27e
[    0.172010]  =======================
[    0.172010] Code: 00 89 c2 fa 90 8d b4 26 00 00 00 00 90 89 c8 89 ef c1 e8 02 89 c1 f3 a5 89 d9 83 e1 03 74 02 f3 a4 89 d0 50 9d 90 8d b4 26 00 00 <00> 00 b8 01 00 00 00 0f a2 5a 89 e8 5b 5e 5f 5d c3 55 31 c9 57
[    0.172010] EIP: [<c010797d>] text_poke_early+0x41/0x52 SS:ESP 0068:c0363eb0
[    0.176011] ---[ end trace 4eaa2a86a8e2da22 ]---
[    0.180011] Kernel panic - not syncing: Attempted to kill the idle task!

The Soekris provides console emulation via the serial port but Grub hangs with this, until you attach a serial console. However Grub can write directly to the serial port bypassing this problem; add the following lines to /boot/grub/menu.lst to achieve this:

serial --unit=0 --speed=57600
terminal serial

Run update-grub and visually check that the generated kernel list at the bottom of the file is sensible.

Communications

I used picocom to get a serial console the 4501, with the following command:

picocom -f x -b 57600 /dev/ttyS0

Your favourite terminal program will doubtless work too.

Unit Configuration

> show

ConSpeed = 57600
ConLock = Enabled
ConMute = Disabled
BIOSentry = Enabled
PCIROMS = Enabled
PXEBoot = Disabled
FLASH = Primary
BootDelay = 5
FastBoot = Disabled
BootPartition = Disabled
BootDrive = 80 81 F0 FF
ShowPCI = Enabled
Reset = Hard
CpuSpeed = Default

Booting

You should now be able to transfer the CF card to the 4501 and boot off it. Have a serial terminal open on it before you start so you can see any problems.

You should edit /boot/grub/device.map again, to reflect that it'll henceforth run on the 4501.

(hd0)   /dev/hda

It should not be necessary to re-install Grub, however.

Links

RJK | Contents