Install Debian on the LS-XL
- 1 Abstract
- 2 Usual warning
- 3 Prerequisites
- 4 Preliminary notes
- 5 Debugging
- 6 Kernel building
- 7 Configure the initramfs
- 8 Starting the installer
- 9 Kernel rebuild
- 10 Empty initramfs creation
- 11 Installation
- 12 Further setup
This page shows how to install Debian, using the official Debian installer, on the Linkstation Live LS-XL.
Do this at your own risk! There is a non-zero probability that you will lose everything stored on your device. (You may connect a different hard disk to test these instructions, though)
- A computer running Linux, with root access
- A working DHCP server on the network
- You can retrieve the IP assigned to your NAS box when it does a DHCP request (or assign it a permanent DHCP bind).
- You may need to take apart your device to remove its hard drive
I have noticed that the Debian-provided kernels for similar Buffalo devices (LS-CHL…) do not seem to successfully boot on the LS-XL. Moreover, the 3.3.4 kernel provided by Buffalo only starts up when compiled with the CodeSourcery arm-2007q3 4.2.1 gcc cross-compiler.
I am unsure why other configuration do not work, and the lack of debugging features on the LS-XL do not help.
If someone can shed some light on this, feel free to update this page.
The LS-XL has a UART serial port, but requires:
- Three wires to be soldered on the board
- A UART serial device (search on google for USB uart board, can be found for around 2-3€)
The soldering points are not the hardest of points, but if you never have soldered before, you might want to practice elsewhere.
Once you've soldered the wires, connect the wires to the serial board.
Using PuTTY (or the like) select "Serial", the port of your USB device (on Windows it's something like COM13, on linux it's /dev/ttyUSB0). Set the speed to 115200 like this:
Hit enter, and power on the LS-XL. You should now be able to see bootloader/kernel messages and even change bootloader arguments.
Thanks to Ingmar Klein for the initial pictures and help.
You first need to rebuild the Buffalo-provided 3.3.4 kernel, with some added configuration options.
Create a work directory, download the toolchain and kernel, and unpack them:
mkdir nasbuild cd nasbuild wget http://buffalo.jp/php/los.php?to=gpl/storage/ls-x/165/linux-3.3.4.tar.gz -O linux-3.3.4.tar.gz tar xzf linux-3.3.4.tar.gz wget http://downloads.buffalo.nas-central.org/LSPro_ARM9/DevelopmentTools/CrossToolchains/CodeSourcery/arm-2007q3-53-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 tar xjf arm-2007q3-53-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
Put the toolchain in your
PATH and check if it’s working:
arm-none-eabi-gcc --version should output:
arm-none-eabi-gcc (CodeSourcery Sourcery G++ Lite 2007q3-53) 4.2.1 Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(If you use a x86_64 system, and you get an error when running this command, check that the x86_32 supporting libraries are installed)
Go in the
Download this kernel config file and put it in the current directory, under the name
This configuration file is mostly identical to the Buffalo-provided configuration, with some differences to be able to start the Debian installer (hard-coded command line, mostly -- compare this file with
buffalo/configs/buffalo_nas_fw_88f6281.config to find the changed options).
Makefile. At line 196, change
CROSS_COMPILE ?= arm-none-linux-gnueabi-
CROSS_COMPILE ?= arm-none-eabi-
make oldconfig. If you want to change some kernel configuration options, run
make menuconfig (but note that the kernel we are building here will just be used for running the Debian installer; the final kernel will be built later)
make uImage modules
to build the kernel. (If you have a multiprocessor machine, you can speed up the compilation by adding the
-jN option to
N by the number of processor/cores in your machine).
Configure the initramfs
Download the Debian installer initramfs and put in in a new directory of your work directory:
cd .. mkdir initramfs cd initramfs wget http://http.debian.net/debian/dists/unstable/main/installer-armel/current/images/orion5x/network-console/buffalo/ls-chl/initrd.buffalo -O orig_uImage
Extract the gzipped initramfs from the uImage, and extract it on a newly created 20M ext2 filesystem:
dd if=orig_uImage ibs=64 skip=1 | zcat > orig_initramfs.cpio dd if=/dev/zero of=initrd bs=1M count=20 /sbin/mkfs.ext2 initrd mkdir rootfs sudo mount initrd rootfs cd rootfs sudo cpio -idv < ../orig_initramfs.cpio
(Note: The Debian-provided
initrd.buffalo is an initramfs, but it does not seem to boot correctly on the device, so we convert it to a classic initrd)
Remove the modules from the rootfs and copy the ones which were built with the kernel:
sudo rm -r lib/modules/3.13-1-orion5x/ cd ../../linux-3.3.4/ sudo make INSTALL_MOD_PATH=../initramfs/rootfs/ modules_install cd ../initramfs/rootfs/
Create (as root) a file named
preseed.cfg in the
rootfs directory with the following contents:
d-i lowmem/low note d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i network-console/password password rootme d-i network-console/password-again password rootme
This file is necessary to enable the remote install feature (via SSH).
You can change
rootme to another password; you will be prompted for this password when connecting to the Debian installer.
Now unmount the filesystem and pack the initrd:
cd .. sudo umount rootfs gzip initrd mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n initrd -d initrd.gz initrd.buffalo cd ..
Starting the installer
Install TFTPy (on Debian, you can install the
Add the static IP
255.255.255.0) to your machine’s network interface.
Create a tftp root folder, copy the kernel and initrd into it, and start the TFTP server:
mkdir tftpboot cp linux-3.3.4/arch/arm/boot/uImage tftpboot/uImage.buffalo cp initramfs/initrd.buffalo tftpboot/initrd.buffalo sudo /usr/share/doc/python-tftpy/examples/tftpy_server.py -r tftpboot/
Remove the hard drive from your device (to force it to start from TFTP), and plug it in.
The TFTP server should start displaying messages indicating that the kernel and the initrd are being loaded 10 seconds after power-up. Plug the disk as soon as the messages start to appear or else the disk will not be seen by the installer. 30 seconds later, the device should require an IP address from the DHCP server, and start using it.
You can now connect to the device and access the Debian installer with:
ssh -o "UserKnownHostsFile /dev/null" firstname.lastname@example.org
(If you get a “Connection refused” error, wait a little bit)
Use the password you provided earlier (
rootme by default).
You should, finally, get the Debian Installer network console.
While Debian is installing, you can prepare the kernel you will use on the device.
Go back to the
nasbuild folder, put the toolchain path back in your PATH if you switched shells, go inside the
linux-3.3.4 directory, and run
You need at least to change the
Boot options => Default kernel command string and change
console=ttyS0,115200 root=/dev/ram0 panic=5 lowmem=1
console=ttyS0,115200 root=/dev/sda2 panic=5 lowmem=1
(this assumes that you will install Debian on the second partition of your drive). Save the new configuration and type
make uImage to rebuild the kernel.
Empty initramfs creation
The LS-XL’s bootloader insists on having an initrd to load along with the kernel, so we need to provide an empty one. You can generate it by using:
dd if=/dev/zero of=initrd bs=1M count=1 /sbin/mkfs.ext2 initrd gzip initrd mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n initrd -d initrd.gz initrd.buffalo
The installer prompt should let you specify if you want to start the installer normally, or in expert mode. You should choose expert mode to get the extra installer questions (which are useful in our case).
Some installation steps (where special action is needed) are detailed below. For the others, refer to the official Debian documentation.
Despite the kernel modules being copied in the installer image in the previous steps, the installer complains that no kernel modules are found. This is harmless; just allow the installer to continue.
On the “Download installer components” page, select “openssh-client-udeb” and “partman-ext3” and continue.
In order to boot the system from the hard drive, the following condition should be met:
- The drive should be partitioned using the GUID Partition Table format (GPT)
- Partition 1 should be formatted using the ext3 format (ext4 does not work)
- Partition 1 should contain the kernel and initramfs at its root.
It is clear that the first partition on the drive should be the /boot partition.
GPT partition format
This step is optional if you use the original drive for your device (and it was not damaged or altered), or if you know that the drive you use is using GPT (which is rarely the case).
In the partition tool, select the full drive (
SCSI1 (0,0,0) (sda)). Select Yes when asked if a new partition table should be created. Select “gpt” in the list.
You should probably delete and recreate every partition, except the big XFS partition at the end of the drive if you use your device’s original hard disk (it’s the partition which contains the files you stored on your NAS)..
- As said before, you should create a small (around 256MB) ext3 partition at the start of the drive, which will be mounted on /boot. You can probably set the
roflags on this file system.
- For the root partition (mounted on /), it is probably better to use ext3 or ext4. The partition should be at least 10-20GB.
- Since the LS-XL has only around 50MB of usable memory, you should probably create a 1 or 2GB swap partition.
The installer will complain that there is no kernel to install. This is also expected.
Ensure that the “SSH server” entry is selected, or you will not be able to access the device after the installation!
The installer will tell you that it can not install a boot loader. This is expected.
Do not finish the installation at this point! You still need to copy the kernel you have recompiled in your system, and add a fake inited. To do this:
- Select the “Execute a shell” option
/target/boot(the /boot partition you created earlier)
sftp user@hostto connect to your computer (which needs to be running a SSH server)
- Navigate (using
cd) to the
get uImage uImage.buffaloto copy the kernel image you’ve compiled to your device’s
/bootpartition, renaming it
uImage.buffaloin the process (this is necessary for the bootloader to find it).
- Navigate to the folder where you generated the empty
get initrd.buffaloto copy it to the boot partition
- Type Control-D to exit
- Type Control-D to exit the installer shell
You can now finish the installation. Your newly-installed Debian should start up automatically, and request an adress by DHCP. You can now access it by SSH.
Your hostname may have not been set during the installation. You can set it by following this procedure: https://wiki.debian.org/HowTo/ChangeHostname
In case the locales were not configured correctly on the system, you can reconfigure them by running:
bootlogd can be used to log the console output during the boot process, which may be useful for troubleshooting boot issues.
To activate it, install the
bootlogd package and reboot.
In the event of a boot process failure, you will be able to debug the issue by restarting the Debian installer, starting a shell, mounting the root device and examining the
To make the LED stop blinking after the boot process, you can add the line
echo off > /proc/buffalo/gpio/led/power_blink
exit 0 line in the
The LS-XL loses the time when it is unplugged. To set it when a network connection becomes available, install
When the LS-XL is halted, it automatically reboots. The solution to this is to put it in a low power state (HDD stopped, LED off) instead of trying to shut it down
Change the /etc/init.d/halt script: Before
halt -d -f $netdown $poweroff $hddown
add the lines
echo off > /proc/buffalo/gpio/led/power echo off > /proc/buffalo/gpio/power_control/hdd0 sleep 300