Visit our website:
www.linutop.com


Distro/Debian etch install on Linutop

From LinutopWiki

Contents

Install the Debian system

This tutorial covers the whole process of installing a Debian etch system with minimum initial download (less than 10MB). After several failed attempts, all issues have been properly discovered and solutions for getting around have been established in all cases.

As most of the packages available in latest Debian release have been updated since the installation images available for download have been built, the most appropriate solution is to limit the initial download to bare minimum and let the installer download the rest of the files, automatically using latest versions. From the many possible install solutions there is one really interesting but not barely documented (references?) - just a minimalistic boot disk with everything else downloaded from the Internet, including most of the kernel modules.

Things to be done before install

As Linutop is able to boot only from USB stick/hard drive, an initial boot key is needed before anything else. Probably Debian could be installed directly onto it, but such approach hasn't been considered at this time.

For building the initial boot key, a FAT partition is required. Normally USB flash drives come partitioned with a single FAT or FAT32 partition. As the boot loader used in this example, SysLinux, supports both partition types no action is required in this case.

In order to prepare the boot USB flash drive, two files must be downloaded. One of the is the latest SysLinux version available here. The other one is an ISO image that contains all the other files needed for booting and for current stable Debian release it can be found here. Both files should be unpacked in some temporary directory for further use.

First step once the USB flash drive is connected to the PC is to establish how it can be accessed. For Windows users this means simply determining the drive letter corresponding to it. In my case this is H. From the unpacked SysLinux files, use the Win32 directory and run "SysLinux H:". This will insure the USB flash drive is capable of booting.

Second step requires to copy all files from the previously downloaded mini.iso file into the root of the USB flash drive and rename the isolinux.cfg file to syslinux.cfg. This insures the boot loader knows what to load and also provides some menus with various functionalities, one of them very important during the install process.

Installing Debian

The install process is generally simple, but special care must be paid to some steps. They will be properly emphasized in the following paragraphs.

Booting Debian installer

Plug the already prepared USB flash drive into your Linutop. For safety measures (less headache possible!) insure it's the only USB flash drive until later. Also plug a network cable, a keyboard and a display. After powering the Linutop, when the boot prompt is displayed, type expert before pressing the ENTER key. It is really important to do the install in expert mode to save some time later.

Go through the installer menus as you would normally do until asked for the Debian "flavor" that you would like to have installed.

Selecting the Debian "flavor"

This is actually a painful stage in the installer if anything else but stable is selected. So far I haven't been able to find a workaround to this situation, but with any other "flavor" the kernel won't be able to find it's modules on the Debian mirrors, no matter which one you actually choose. I've tried using mini.iso files from both testing and unstable "flavors", but in the end they proved to be identical to the one in the stable "flavor".

Selecting the disk to use for installation

Once the installer has downloaded all the required modules, the menu with the installation checklist is displayed and the selected item is "Detect disks". Now it's time to plug the target USB flash drive before going any further. Once you plug the USB flash drive and you hit the ENTER key you will be shown a list of suggested modules to load. Don't bother, just press ENTER and wait to get to the next step.

Partitioning the target media

Once going through this step, please take great care when selecting the target media. In my case it was simple as I used a 64MB flash drive as boot disk and the default 1GB flash drive that I have received with the Linutop as target. But if the flash drives are equal in size, it might be a little bit more difficult. So far I haven't tested the situation of having the same media both for booting the installer and for target.

As for partitions, I would suggest a 3-400MB swap partition and the rest as a single partition mounted as root. When partition type comes into discussion ext2 is the easy choice. The safest choice, considered as a combination of file system performance (speed), file system reliability in case of power failures and the amount of extra accesses to the media, xfs seems to be the best solution right now. After all we are talking of a flash device that has a limited number of write cycles for each memory page and too many unnecessary writes will just shorten its life. But this consideration shouldn't be considered by no means anything else than a simple suggestion. In my case it did the trick as I have a pair of Linutops, with 8GB flash drives, as servers for mail, web, DNS and several other small applications, running as smoothly (and cool!) as possible!

Note: Don't forget to activate the booting flag for the root partition! Some of us already did that mistake ...

Now it's time to let the installation flow as it should until you reach the init-ramfs/yaird selection page. Most of the install will be done by then, but the really critical part will start.

Deciding on boot initrd image type

The installer, only in expert mode, offers the possibility of choosing between init-ramfs and yaird for generating the boot initrd. While it suggest the default should be used, and that is init-ramfs, that is the wrong decision! During the first install trials init-ramfs images showed loading times in excess of 200s, even on computers significantly faster than Linutop, and crashed with no clue in all situations. After some digging it came out that yaird at least gives some error message and doesn't write the initrd image if something is really wrong. So I went for it and found the problem - Debian installer is adding two entries in /etc/fstab for each partition on the media device, one as swap and /media/usb2 and the other one as / and /media/usb1, thus completely messing up the kernel booting phase.

So now it's the time to use the Alt+F2 combination and chroot /target to gain complete access over the target flash drive. Then use vim /etc/fstab to edit the faulty file. Just remove all rows mentioning the /media/usb paths and replace all /dev/sdb occurrences with /dev/sda. Now you can save the file. This fixes the most important problem that I have encountered during the Debian installer. Type exit and ENTER to get out of the chrooted environment and Alt+F1 to get back to the installer. Select yaird and continue the installation.

Note: The second reason why I have dropped init-ramfs is more important. Probably it would have equally worked with the fixed fstab file, but yaird boots in just 90s when compared to over 220s. From my point of view this aspect is really important!

Installing the boot manager

This step is important because it hides another tricky problem. Fortunately this is the last one in the rather not long but so annoying list. The actually installed boot manager is not so important as it will have to start just the newly installed operating system. In case xfs was the partition type of choice, choosing is not an option... LILO is the usable boot manager as GRUB is poor with xfs partitions, at least the version installed by the Debian installer.

In case of LILO, once it is installed, repeat the above steps and go on and edit /etc/lilo.conf on the target USB flash drive. With a very high probability the target device is /dev/sdb and the root is mounted on /dev/sdb1. At this point the root must be manually modified to /dev/sda1 or booting with completely fail. Once the file is saved, don't forget to run lilo to actually apply the change.

Once this is done you can get back to the installer and finish the process.

Things to be done on the freshly installed system

Once you have booted in your newly installed system there is just one more step to be done to insure smooth updates of the packages.

The /etc/lilo.conf file is still mentioning /dev/sdb as the boot device and that will cause problems on the first kernel image update. It should be /dev/sda and once the file is update, just for a check, lilo should be run.

Conclusions

After going through all the above steps you should have a minimal Debian system installed and ready to use. Depending on the software packages sets selected during install, you may have anything from a naked desktop (console and just a few tools) to a full desktop environment or a full featured server. Considering the speed and memory limits of the Linutop the full desktop environment may be too much.

The install process is not the cleanest one possible, but it's also not the most difficult one if you have some Linux knowledge and if you have a guidance (I'm still recalling my first two days spent because of the /etc/fstab issue!). Using the resulting bootable system as a starting point practically anything could be done. After removing the already used package files from /var/cache/apt/archives you can have as few as 375MB of the root partition occupied with the installed system. It could get even less if unnecessary packages are also removed (like dictionaries), depending on the final use of the system. Available memory, also for the base system, should be in excess 128MB (on the two servers I usually see less than 75MB actually used), so reasonably large for many usages.

Possible problems

Duplicating Debian install for several Linutops

Considering the extra experience I had with the above mentioned twin Internet servers based on Linutop, there is another very special situation. With those I have installed completely one and decided to copy the USB flash drive ('dd if=/dev/sdb of=/dev/sdc) and just modify some minor settings for the second server. The move was correct but the instant success assumption was false. There is an interesting file, /etc/udev/rules.d/z25_persistent-net.rules, that maps MAC addresses to eth devices. It must be manually removed once the USB flash drive is used for booting on the Linutop on which it will be used. This was another "well spent" day!

NTPD and DHCP

An issue that hit me back several days after installing one of the Debian systems is the lack of battery backup for date and time keeping. Of course the solution exists in the form of the ntpd but it has a major problem if DHCP is used for network address. Sometimes the DHCP server returns the IP quickly enough, but when that doesn't happen (and once it started happening in my case it kept happening for a whole day), ntpd can't listen on eth0 and no date and time information is available. The side effect is that you can no longer use sudo, so you can't even go on and modify the /etc/network/interfaces. Luckily for me I had another Linutop running as server and I could mount the USB flash from the problem unit and edit /etc/network/interfaces. But, once again, I spent countless hours before understanding the problem!

Other resources

A full Debian/Ubuntu install guide is found on the Tutorials/Debootstrap page.