Tuesday, 31 January 2012

Joggler: Trying debian-installer

This is part of my series on running an unmodified Debian on the Joggler. See here for other posts on the same topic.

Now that I've compiled a GRUB binary that works on the Joggler, I can try booting debian-installer. Being able to run this would be nice, since it means that instead of preparing the system on another machine using debootstrap, you can just install it the usual way. I'm going to be trying to install wheezy, the current testing release; it's too late to fix any issues that come up during a stable install. The development version of debian-installer also has several features that are helpful.

I usually use netboot images to install Debian, though I don't actually boot them from the network. You can boot the netboot kernel and initrd from any existing Linux bootloader, and as long as your network interface is supported by the drivers included, the rest of the install can proceed directly from a Debian mirror, with no need to download an ISO. To try this, you need four things:
  1. A USB stick with a small FAT16 partition.
  2. An EFI GRUB binary built with the patch from my previous post.
  3. The linux and initrd.gz from the d-i daily builds archive, and a grub.cfg which will load them (you don't need any command line arguments).
  4. The firmware for the Joggler's wireless interface: download the firmware archive here and extract the firmware-ralink udeb.

Boot it up and you should be able to proceed through the install normally up to the point of configuring network devices. You can proceed using wireless just fine; the installer will automatically find the firmware udeb on the USB stick, and the current debian-installer supports wifi and even WPA encryption. However, you won't be able to use the wired ethernet interface; it will detect it, but if you attempt to use it, it won't work. This is because the Joggler has an invalid MAC address; the manufacturers evidently were too lazy to program each one with a unique MAC, and the one that's configured is bogus (it's a broadcast address). The original distribution "fixes" this at boot time in userspace by copying the valid MAC from the wifi interface onto the wired interface; this only works because they are never both active at the same time, otherwise it would cause horrible network issues.

Some ethernet drivers have a fix for this in the kernel; if they detect that the programmed MAC is bad, they generate a random one instead. This is a workaround for hardware that's commonly known to be bad. I proposed adding this to the r8169 driver that the Joggler uses, but the folks on the netdev mailing list didn't like it; it's been previously concluded that these kinds of workarounds are bad as it lets manufacturers get away with not programming their cards properly. I can see their point, inconvenient though it is, so I'll be trying to apply a "proper" workaround for this in userspace in Debian later. For now, if you want to proceed with the install on wired, you will need to let it detect the network device, then switch to a shell and enter "ip link set eth0 addr xx:xx:xx:xx:xx:xx" (with a valid MAC - anything where the first byte doesn't have the 1 bit set should work). After that, you should be able to use it, but this won't apply to the installed system, only during the installer.

Anyway, once you have networking you'll reach the second problem: it doesn't detect the Joggler's internal storage. If you're planning on installing onto a USB device this is fine, but being able to install to the internal storage would be nice. The reason this doesn't work is the required kernel module is missing from the installer packages due to a minor packaging error; I've notified the maintainers and it's being fixed. The regular kernel does support the driver, so if you do install to a USB device you will be able to access the internal storage from the installed system.

Right at the end of the install, you'll hit the third and final problem: debian-installer doesn't know how to install a bootloader on EFI PCs. It knows how to install elilo, but it only offers this as a choice on Macs and IA-64 machines (which all require EFI), it doesn't yet offer this for regular PCs, since they normally boot using BIOS emulation even if they have EFI. If you try and install either GRUB or LILO from the installer, it won't work; it will install the regular boot-from-BIOS versions. Of course, the EFI GRUB package in Debian currently doesn't work on the Joggler either, as we already found, so right now this isn't urgent. You'll need to just choose not to install a bootloader, and arrange to boot the installed system using the working GRUB binary.

I'll come back to this once some of the fixes are in and work on the next steps, but for now, this post brings my progress up to date. Thanks for reading, and I hope to have some more info to share soon! I may also start posting about some of my other projects.