Debian Installer for Buffalo Linkstation NAS
Install Debian to headless device
Roger Shimizu
Debian Maintainer

December 10th, 2016
Mini Debian Conference Japan 2016

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

1 / 19Outline
1

Background
History of Buffalo Linkstation NAS
What is Debian Installer
What is GNU/Screen

2

How to install Debian to Buffalo Linkstation
How to boot Linkstation by Debian Installer image
Detailed steps to boot Linkstation by Debian Installer images
Some tips during the installation
Settings after the installation

3

Buffalo Linkstation Support Status

4

Demo

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

2 / 19Outline
1Background
History of Buffalo Linkstation NAS
What is Debian Installer
What is GNU/Screen

2

How to install Debian to Buffalo Linkstation
How to boot Linkstation by Debian Installer image
Detailed steps to boot Linkstation by Debian Installer images
Some tips during the installation
Settings after the installation

3

Buffalo Linkstation Support Status

4

Demo

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

3 / 19

Background
History of Buffalo Linkstation NAS
0 Generation - Kuro-Box
1st Generation - Linkstation HG / Kuro-Box HG
Powerpc architecture
IDE interface only - there’s no native SATA support!!
I Life is hard for this kind of hardware nowadays
II

2nd Generation1 - Kuro-Box Pro / Linkstation
Live/LS-GL/LS-WTGL/LS-QLI

ARM architecture
FFI
I

Untel Etch: arm OABI (Old ABI)
Since Lenny: armel EABI (new Embedded ABI)

Marvell orion5x 5182 chipset
SATA interface

1
There’s ever MIPS model before 2nd generation, however it’s very rare and gotdiscontinued soon.
Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

4 / 19

Background (cont.)
History of Buffalo Linkstation NAS (cont.)
3rd Generation - Linkstation LS-XHL/LS-CHL/LS-WXL &LS-VL/LS-WVL/LS-QVL, etc
Marvell kirkwood 6281 / 6282 chipset
armel architecture
I kernel image is compatible with 2nd generation (linux-image-marvell) 1
I Jessie/Stretch supports very well
I After Stretch plan2 is still under discussion
II

4th Generation - LS-210/LS-220/LS-410/LS-420, etc
Marvell armada-370 chipsetarmhf architecture (hard-float)
I Sorry not supported yet. Problem probably in u-boot and Kernel DTS.
No serial console. Please help!
II

1

Before installing HDD to a device of different model, you need to use flash-kernel togenerate boot image (uImage.buffalo) by adding target device’s DTB.
2
https://lists.debian.org/debian-devel/2016/12/msg00135.html
Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

4 / 19What is Debian Installer

Debian Installer a.k.a. D-I
A bootabe Debian environment, which is minimized
Partitioner (or even RAID or/and dm-crypt)
Debootstrap
Install boot loader, e.g. Grub/EFI, flash-kernel
Supports various OS, including kFreeBSD and GNU/Hurd
Install media is not limited to CD/DVD, but also PXE netboot,u-boot, etc
For headless device, such as NAS, network-console image can be used
to install via SSH connection

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

5 / 19What is GNU/Screen

Terminal multiplexer - virtual terminals in one terminal
Switch virtual terminal by key shortcut
Screen uses: Ctrl-A [Number]
There’re a few alternatives, such as Tmux,
which uses Ctrl-B [Number]

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

6 / 19Outline
1

Background
History of Buffalo Linkstation NAS
What is Debian Installer
What is GNU/Screen

2

How to install Debian to Buffalo Linkstation
How to boot Linkstation by Debian Installer image
Detailed steps to boot Linkstation by Debian Installer images
Some tips during the installation
Settings after the installation

3

Buffalo Linkstation Support Status

4DemoRoger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

7 / 19Where to put boot images

Buffalo Linkstation u-boot, the bootloader, reads boot images on 1stpartitionboot images3
II

uImage.buffalo
initrd.buffalo

1st partition4 5
II/dev/sda1/dev/md0

3

The image files can be symbolic link.
Some models doesn’t support GPT partition.
5
It must be ext2 or ext3 format.
4

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

8 / 19Where to download boot imagesMost Linkstation support started from Stretch D-I alpha7, andGNU/Screen support was added in alpha8, but due to a bug alpha8
network-console image doesn’t work, so please try daily images if you want
to use GNU/Screen.
orion5x models
I

https://d-i.debian.org/daily-images/armel/daily/orion5x/network-console/buffalo

kirkwood models
I

https://d-i.debian.org/daily-images/armel/daily/kirkwood/network-console/buffalo

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

8 / 19Create partitions
Unplug HDD of your Linkstation, and connect it to your PC via
SATA-USB adapter. Suppose the connected device is /dev/sdc. If yourLinkstation is RAID type, models such as LS-WXL/WSXL/WVL/QVL,partition should be the same for all HDDs.
$ sudo parted /dev/sdc(parted) mklabel gpt(parted) mkpart boot 2048s 1024MiB(parted) mkpart root 1024MiB 6144MiB(parted) mkpart swap 6144MiB 6400MiB(parted) mkpart data 6400MiB -1### Below commands are necessary for RAID models only. ###(parted) set 1 raid on(parted) set 2 raid on(parted) set 3 raid on(parted) set 4 raid on
Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 2016

9 / 19

Confirm created partitions(parted) print
Model: SAMSUNG HM250HI (scsi)
Disk /dev/sdc: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Num Start End Size File sys Name Flags
1 1049kB 1074MB 1073MB boot raid
2 1074MB 6442MB 5369MB root raid
3 6442MB 6711MB 268MB swap raid
4 6711MB 250GB 243GB data raid### Exit parted at the end. ###(parted) quitRoger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201610 / 19

Copy boot images$ sudo mkfs.ext3 /dev/sdc1$ sudo mount /dev/sdc1 /mnt
$ wget https://d-i.debian.org/daily-images/armel/daily/kirkwood/network-console/buffalo/ls-wxl/uImage.buffalo$ wget https://d-i.debian.org/daily-images/armel/daily/kirkwood/network-console/buffalo/ls-wxl/initrd.buffalo$ sudo cp *.buffalo /mnt
$ sudo umount /mnt

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201611 / 19

Boot Linkstation and connect via SSH

Move the HDDs back to Linkstation, then boot the device.
Wait for a while (2 minutes?), then you can find IP address of yourdevice, allocated by DHCP, by port scanner.
I

Fing App in Andoird/iOS can scan port in local network

Use SSH client to connect to Linkstation
Port: 22
Username: installer
I Password: installII

SSH Command:$ ssh installer@<IP address of Linkstation>

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201612 / 19Some tips during the installation

Skip this 2 pages if you’re using non-RAID models such as
LS-GL/CHL/XHL/VL.
If you don’t find your RAID in Partman, you can <Go Back>, thenchoose ”Download installer components”, and then check”partman-md” and ”sata-modules”, etc.

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201613 / 19

Some tips during the installation (cont.)

If you need to create new array, you need to set /dev/md0 as
metadata=0 (version 0.90). Because u-boot cannot load boot imageson 1st partition in. partman-md cannot do this now, so you need to
do it yourself3 .
# mdadm --create /dev/md0 --level=1 --raid-devices=2--metadata=0 /dev/sda1 /dev/sdb1
or, you want to set up the 2nd HDD later:# mdadm --create /dev/md0 --level=1 --raid-devices=2--metadata=0 /dev/sda1 missing
partman-md can set up /dev/md1, /dev/md2, etc. with no problem.

3

https://bugs.debian.org/815569
Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201613 / 19Some tips during the installation (cont.)

RAID will start to resync after creation, which slow down theinstallation, so it’s better to limit the resync speed except for/dev/md0:# echo 100 >/sys/block/md{1,2,3}/md/sync speed max
RAID re-sync will be restarted after rebooting, so no much worry
about it.

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201613 / 19

Settings after the installation

Command fw printenv / fw setenv is needed to check/modify u-bootvariables. 3I

Should be effective to any Linkstation:$ sudo echo /dev/mtd2 0x00000 0x10000 0x10000>/etc/fw env.config
IThough Kuro-Box Pro is a bit different:$ sudo echo /dev/mtd5 0x00000 0x10000 0x10000>/etc/fw env.config

3
If you screw up u-boot variable and failed to boot, there’s no recovery method. Sobe careful!!
Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201614 / 19

Settings after the installation(cont.)
Boot log of Linkstation can be redirected to other device, which iscalled netconsole. It’s useful as a debug/rescue method.
I

Setting on Linkstation side:$ sudo cat <<EOT >>/etc/initramfs-tools/modules
marvell
mv643xx eth
netconsole netconsole=@192.168.11.5/,6666@192.168.11.1/mvmdio
EOT$ sudo update-initramfs -u
I

Other device on the same network can get the log by:$ sudo ip a add 192.168.11.1/24 dev eth0
$ nc -l -u -p 6666 |tee ~/netconsole.log
Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201614 / 19

Outline
1Background
History of Buffalo Linkstation NASWhat is Debian Installer
What is GNU/Screen

2

How to install Debian to Buffalo Linkstation
How to boot Linkstation by Debian Installer image
Detailed steps to boot Linkstation by Debian Installer images
Some tips during the installation
Settings after the installation

3

Buffalo Linkstation Support Status

4

DemoRoger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201615 / 19

Buffalo Linkstation Support Status

The supported Buffalo Linkstation list:
Kuro-Box Pro / Linkstation Pro/Live
Linkstation LS-GL / LS-WSGL / LS-WTGL
Linkstation LS-XHL / LS-CHLv2 / LS-WXL / LS-WSXL / LS-VL /LS-WVL / LS-QVL=>So almost all armel 2nd/3rd generation are supported!

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201616 / 19

Outline
1

Background
History of Buffalo Linkstation NAS
What is Debian Installer
What is GNU/Screen

2

How to install Debian to Buffalo Linkstation
How to boot Linkstation by Debian Installer image
Detailed steps to boot Linkstation by Debian Installer images
Some tips during the installation
Settings after the installation

3

Buffalo Linkstation Support Status

4DemoRoger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201617 / 19

Debian Install Demo for Buffalo Linkstation

Device: 2-Bay 2.5’ HDD model Linkstation LS-WSXL

Roger Shimizu

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201618 / 19

Thanks for coming!

Any question or comment would beappreciated.
Roger Shimizu
rogershimizu@gmail.com
https://wiki.debian.org/RogerShimizu

about the slides:
template from
copyright c 2014
licenseRoger Shimizu

http://git.upsilon.cc/?p=talks.git
Stefano Zacchiroli
CC BY-SA 4.0 — Creative Commons Attribution-ShareAlike 4.0

Debian Installer for Buffalo Linkstation NAS

Mini DebConf Tokyo 201619 / 19