Debian Wheezy on LinkStation LS421DE

Disclaimer:
THE FOLLOWING PROCEDURE WILL CAUSE ALL OF YOUR DATA TO BE LOST. YOU HAVE BEEN WARNED!

Installing Debian on LinkStation LS421DE to replace the Buffalo stock firmware aimed to create a full customized operating system without unnecessary software as in stock firmware.

The configuration for the following scenario described as below:

  • Using LinkStation LS421DE with armhf (arm hard float) architecture.
  • Not using raid, but adding raid partition for data partition is fully supported.
  • Currently, no vanilla kernel available. So, we are using Buffalo kernel at the moment. Vanilla kernel can be cross compiled.

The main process of Debian installation summarized as follow:

  • Creating rootfs by debootstrapping Debian on running LS421DE system.
  • Using a Linux box (Ubuntu) to prepare suitable image for LinkStation.
  • Modifying partition and installing Debian.
  • Enable lsmonitor script and customize Debian system.

Creating rootfs on running LS421DE system

You must have already a root access to the LinkStation box, if not, follow the the procedure on https://tohenk.wordpress.com/2014/11/11/opening-stock-firmware-of-linkstation-ls421de/.

Install debootstrap:

$ cd ~
$ wget http://ftp.us.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.64~bpo70+1_all.deb
$ dpkg -i --force-all debootstrap_1.0.64~bpo70+1_all.deb

Prepare the tools by issuing commands:

$ mkdir ~/lsmod
$ cd ~/lsmod
$ wget https://github.com/tohenk/linkstation-mod/archive/master.zip
$ unzip master.zip
$ cd linkstation-mod-master

Edit scripts/debootstrap-rootfs.cfg and adjust as you need, choose closest mirror from your location. Extra packages can be specified using PACKAGES variable.

$ cat scripts/debootstrap-rootfs.cfg
ARCH=armhf
VERSION=wheezy
MIRROR=http://kartolo.sby.datautama.net.id/debian
PACKAGES=
$ vi scripts/debootstrap-rootfs.cfg

Run debootstrap:

$ ./scripts/debootstrap-rootfs.sh --clean

You can ommit --clean option if you don't want to debootstrap-ing again. After debootstrap process, the rootfs archive can be found on rootfs folder:
rootfs_wheezy_armhf_yymmdd.tar.gz => hddrootfs
initrd_wheezy_armhf_yymmdd.tar.gz => initrd

Preparing Debian image for LinkStation

On Linux (Ubuntu) box, prepare the tools:

$ mkdir ~/lsmod
$ cd ~/lsmod
$ wget https://github.com/tohenk/linkstation-mod/archive/master.zip
$ unzip master.zip
$ cd linkstation-mod-master

Transfer rootfs from LinkStation (replace lsbox with your real LinkStation hostname or IP address):

$ mkdir rootfs
$ scp root@lsbox:/root/lsmod/linkstation-mod-master/rootfs/* rootfs/

Prepare LinkStation stock firmware and place it in firmware folder:

$ mkdir firmware
$ cp path-to-buffalo-firmware/ls400-133en.zip firmware/
$ unzip firmware/ls400-133en.zip

Customize scripts/debootstrap-combine.cfg (adjust HOSTNAME, NETWORK_PROTO, etc), then create hddrootfs and initrd:

$ cat scripts/debootstrap-combine.cfg
HOSTNAME=LS421DE88B
NETWORK_INTERFACE=eth1
NETWORK_PROTO=static
NETWORK_IP=172.16.1.4
NETWORK_NETMASK=255.255.255.0
NETWORK_GATEWAY=172.16.1.1
NETWORK_DNS=172.16.1.1
NETWORK_DOMAIN=ntlab.net
#INITRD_TEMP_ROOT="0x811"
#INITRD_ROOT="0x901"
INITRD_ROOT="0x802"
$ vi scripts/debootstrap-combine.cfg
$ sudo ./scripts/debootstrap-combine.sh rootfs/rootfs_wheezy_armhf_141112.tar.gz rootfs/initrd_wheezy_armhf_141112.tar.gz firmware/ls400-133en

Unpack Buffalo kernel image:

$ sudo ./scripts/unpack-image.sh firmware/ls400-133en/uImage.img out/

Debian image for LinkStation now ready in the folder out with files hddrootfs.buffalo.updated, initrd.buffalo, and uImage.buffalo.

Modifying partition and installing Debian

Now, detach the hard disk from LinkStation and attach it to Linux box. Ensure the disk is detected and acquire the correct device node:

$ ls /dev/sd*

I'm assumed the disk detected as /dev/sda. Next install mdadm if it's not already installed:

$ sudo apt-get install --no-install-recommends mdadm

Assemble raid partition:

$ sudo mdadm --assemble --scan

Stop all raid partition:

$ sudo mdadm --stop /dev/md0
$ sudo mdadm --stop /dev/md1
$ sudo mdadm --stop /dev/md2
$ sudo mdadm --stop /dev/md101

Remove all raid partition:

$ sudo mdadm --remove /dev/md0
$ sudo mdadm --remove /dev/md1
$ sudo mdadm --remove /dev/md2
$ sudo mdadm --remove /dev/md101

Zero super block:

$ sudo mdadm --zero-superblock /dev/sda1
$ sudo mdadm --zero-superblock /dev/sda2
$ sudo mdadm --zero-superblock /dev/sda5
$ sudo mdadm --zero-superblock /dev/sda6

Create filesystems:

$ sudo mkfs.ext3 /dev/sda1
$ sudo mkfs.ext4 /dev/sda2
$ sudo mkswap /dev/sda5
$ sudo mkfs.ext4 /dev/sda6

Install Debian:

$ mkdir /tmp/sda1
$ sudo mount /dev/sda1 /tmp/sda1
$ sudo cp out/initrd.buffalo /tmp/sda1
$ sudo cp out/uImage.buffalo /tmp/sda1
$ mkdir /tmp/sda2
$ sudo mount /dev/sda2 /tmp/sda2
$ sudo ./scripts/unpack-rootfs.sh out/hddrootfs.updated.buffalo /tmp/sda2

Attach back the disk to LinkStation, try pinging to test if installation was successfull. You then can SSH-ing as usual.

Enable lsmonitor script and customize Debian system

Now, the final step to customize Debian system by enabling lsmonitor init script:

$ cd ~
$ wget https://github.com/tohenk/linkstation-mod/raw/master/lsmonitor/lsmonitor.tar.gz
$ cd / && tar -xvf ~/lsmonitor.tar.gz

Install dependencies:

$ apt-get install smartmontools hdparm

Enable init script:

$ update-rc.d lsmonitor defaults

Start lsmonitor service:

$ service lsmonitor start

Now, Debian system is complete. Next you can customize your Debian as you need.

49 Comments

  1. I’m going to try this out today.
    However is there a way of restoring the stock firmware once I’ve install debian?

    Thanks

    • Just take out the disk and delete all partitions, re-attach the disk to LinkStation, then it will go on Emergency Mode. Use LSUpdater to restore stock firmware.

  2. Pingback:Compiling Debian Wheezy Kernel for LinkStation LS421DE | Toha's Blog

  3. How would one go about recreating the Raid array after this? If I use mdadm to create an array is there a “grub” config of some kind that will allow me to pull the main drive, boot off the second, and then recreate the array? Thanks fot the writeups! Very helpful!

  4. Yet another question. I can easily just create Raid1 for the data partition, that works flawlessly. Does the above process of debootstrapping, etc. make *both disks bootable so, in the case of a disk failure, I can stop the LS421, pull the bad disk, and restart the LS421 degraded (assuming the bad disk is disk 1 in this case)? Or do I need to do the “Install Debian” step on each of the disks in the LS421? Thanks again.

  5. Hi friend… when running $ ./scripts/debootstrap-rootfs.sh –clean got some notices as follow:
    “Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg”
    “Found additional required dependencies: insserv libbz2-1.0 libdb5.1 libsemanage-common libsemanage1 libslang2 libustr-1.0-1 ”
    “Found additional base dependencies: libept1.4.12 libgcrypt11 libgnutls26 libgpg-error0 libidn11 libnfnetlink0 libp11-kit0 libsqlite3-0 libtasn1-3 libxapian22”

    But script kept running. Is it normal? Can I proceed modding?

    Thanks

  6. I followed your instructions but run into problems as below:

    [root@LS421DE392 scripts]# ./debootstrap-rootfs.sh –clean
    > Debootstrapping jessie on Sat Jan 30 00:02:42 JST 2016…
    W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyr ing.gpg
    I: Retrieving Release
    I: Retrieving Packages
    I: Validating Packages
    I: Resolving dependencies of required packages…
    I: Resolving dependencies of base packages…
    I: Found additional required dependencies: acl adduser dmsetup insserv libaudit-common libaudit1 libbz2-1.0 libcap2 libcap2-bin libctsetup4 libdb5.3 libdebconfclient0 libdevmapper1.02.1 libgcrypt20 libgpg-error0 libkmod2 libncursesw5 libprocps3 libsemanage-common semanage1 libslang2 libsystemd0 libudev1 libustr-1.0-1 procps systemd systemd-sysv udev
    I: Found additional base dependencies: libdns-export100 libffi6 libgmp10 libgnutls-deb0-28 libgnutls-openssl27 libhogweed2 libicu52 idn11 libirs-export91 libisc-export95 libisccfg-export90 libmnl0 libnetfilter-acct1 libnettle4 libnfnetlink0 libp11-kit0 libpsl0 libn1-6
    I: Checking component main on http://ftp.jp.debian.org/debian
    I: Retrieving acl 2.2.52-2
    I: Validating acl 2.2.52-2
    I: Retrieving libacl1 2.2.52-2
    I: Validating libacl1 2.2.52-2
    I: Retrieving adduser 3.113+nmu3
    I: Validating adduser 3.113+nmu3
    I: Retrieving apt 1.0.9.8.2
    I: Validating apt 1.0.9.8.2
    I: Retrieving apt-utils 1.0.9.8.2
    I: Validating apt-utils 1.0.9.8.2
    I: Retrieving libapt-inst1.5 1.0.9.8.2
    I: Validating libapt-inst1.5 1.0.9.8.2
    I: Retrieving libapt-pkg4.12 1.0.9.8.2
    I: Validating libapt-pkg4.12 1.0.9.8.2
    I: Retrieving libattr1 1:2.4.47-2
    I: Validating libattr1 1:2.4.47-2
    I: Retrieving libaudit-common 1:2.4-1
    I: Validating libaudit-common 1:2.4-1
    I: Retrieving libaudit1 1:2.4-1+b1
    I: Validating libaudit1 1:2.4-1+b1
    I: Retrieving base-files 8+deb8u3
    I: Validating base-files 8+deb8u3
    I: Retrieving base-passwd 3.5.37
    I: Validating base-passwd 3.5.37
    I: Retrieving bash 4.3-11+b1
    I: Validating bash 4.3-11+b1
    I: Retrieving libdns-export100 1:9.9.5.dfsg-9+deb8u4
    I: Validating libdns-export100 1:9.9.5.dfsg-9+deb8u4
    I: Retrieving libirs-export91 1:9.9.5.dfsg-9+deb8u4
    I: Validating libirs-export91 1:9.9.5.dfsg-9+deb8u4
    I: Retrieving libisc-export95 1:9.9.5.dfsg-9+deb8u4
    I: Validating libisc-export95 1:9.9.5.dfsg-9+deb8u4
    I: Retrieving libisccfg-export90 1:9.9.5.dfsg-9+deb8u4
    I: Validating libisccfg-export90 1:9.9.5.dfsg-9+deb8u4
    I: Retrieving libboost-iostreams1.55.0 1.55.0+dfsg-3
    I: Validating libboost-iostreams1.55.0 1.55.0+dfsg-3
    I: Retrieving bsdmainutils 9.0.6
    I: Validating bsdmainutils 9.0.6
    I: Retrieving libbz2-1.0 1.0.6-7+b3
    I: Validating libbz2-1.0 1.0.6-7+b3
    I: Retrieving libdebconfclient0 0.192
    I: Validating libdebconfclient0 0.192
    I: Retrieving coreutils 8.23-4
    I: Validating coreutils 8.23-4
    I: Retrieving cpio 2.11+dfsg-4.1
    I: Validating cpio 2.11+dfsg-4.1
    I: Retrieving cron 3.0pl1-127+deb8u1
    I: Validating cron 3.0pl1-127+deb8u1
    I: Retrieving libcryptsetup4 2:1.6.6-5
    I: Validating libcryptsetup4 2:1.6.6-5
    I: Retrieving dash 0.5.7-4+b1
    I: Validating dash 0.5.7-4+b1
    I: Retrieving libdb5.3 5.3.28-9
    I: Validating libdb5.3 5.3.28-9
    I: Retrieving debconf 1.5.56
    I: Validating debconf 1.5.56
    I: Retrieving debconf-i18n 1.5.56
    I: Validating debconf-i18n 1.5.56
    I: Retrieving debian-archive-keyring 2014.3
    I: Validating debian-archive-keyring 2014.3
    I: Retrieving debianutils 4.4+b1
    I: Validating debianutils 4.4+b1
    I: Retrieving diffutils 1:3.3-1+b1
    I: Validating diffutils 1:3.3-1+b1
    I: Retrieving dmidecode 2.12-3
    I: Validating dmidecode 2.12-3
    I: Retrieving dpkg 1.17.26
    I: Validating dpkg 1.17.26
    I: Retrieving e2fslibs 1.42.12-1.1
    I: Validating e2fslibs 1.42.12-1.1
    I: Retrieving e2fsprogs 1.42.12-1.1
    I: Validating e2fsprogs 1.42.12-1.1
    I: Retrieving libcomerr2 1.42.12-1.1
    I: Validating libcomerr2 1.42.12-1.1
    I: Retrieving libss2 1.42.12-1.1
    I: Validating libss2 1.42.12-1.1
    I: Retrieving findutils 4.4.2-9+b1
    I: Validating findutils 4.4.2-9+b1
    I: Retrieving gcc-4.8-base 4.8.4-1
    I: Validating gcc-4.8-base 4.8.4-1
    I: Retrieving gcc-4.9-base 4.9.2-10
    I: Validating gcc-4.9-base 4.9.2-10
    I: Retrieving libgcc1 1:4.9.2-10
    I: Validating libgcc1 1:4.9.2-10
    I: Retrieving libstdc++6 4.9.2-10
    I: Validating libstdc++6 4.9.2-10
    I: Retrieving libgdbm3 1.8.3-13.1
    I: Validating libgdbm3 1.8.3-13.1
    I: Retrieving libc-bin 2.19-18+deb8u2
    I: Validating libc-bin 2.19-18+deb8u2
    I: Retrieving libc6 2.19-18+deb8u2
    I: Validating libc6 2.19-18+deb8u2
    I: Retrieving multiarch-support 2.19-18+deb8u2
    I: Validating multiarch-support 2.19-18+deb8u2
    I: Retrieving libgmp10 2:6.0.0+dfsg-6
    I: Validating libgmp10 2:6.0.0+dfsg-6
    I: Retrieving gnupg 1.4.18-7
    I: Validating gnupg 1.4.18-7
    I: Retrieving gpgv 1.4.18-7
    I: Validating gpgv 1.4.18-7
    I: Retrieving libgnutls-deb0-28 3.3.8-6+deb8u3
    I: Validating libgnutls-deb0-28 3.3.8-6+deb8u3
    I: Retrieving libgnutls-openssl27 3.3.8-6+deb8u3
    I: Validating libgnutls-openssl27 3.3.8-6+deb8u3
    I: Retrieving grep 2.20-4.1
    I: Validating grep 2.20-4.1
    I: Retrieving groff-base 1.22.2-8
    I: Validating groff-base 1.22.2-8
    I: Retrieving gzip 1.6-4
    I: Validating gzip 1.6-4
    I: Retrieving hostname 3.15
    I: Validating hostname 3.15
    I: Retrieving libicu52 52.1-8+deb8u3
    I: Validating libicu52 52.1-8+deb8u3
    I: Retrieving ifupdown 0.7.53.1
    I: Validating ifupdown 0.7.53.1
    I: Retrieving init 1.22
    I: Validating init 1.22
    I: Retrieving init-system-helpers 1.22
    I: Validating init-system-helpers 1.22
    I: Retrieving insserv 1.14.0-5
    I: Validating insserv 1.14.0-5
    I: Retrieving iproute2 3.16.0-2
    I: Validating iproute2 3.16.0-2
    I: Retrieving iptables 1.4.21-2+b1
    I: Validating iptables 1.4.21-2+b1
    I: Retrieving libxtables10 1.4.21-2+b1
    I: Validating libxtables10 1.4.21-2+b1
    I: Retrieving iputils-ping 3:20121221-5+b2
    I: Validating iputils-ping 3:20121221-5+b2
    I: Retrieving isc-dhcp-client 4.3.1-6+deb8u2
    I: Validating isc-dhcp-client 4.3.1-6+deb8u2
    I: Retrieving isc-dhcp-common 4.3.1-6+deb8u2
    I: Validating isc-dhcp-common 4.3.1-6+deb8u2
    I: Retrieving libjson-c2 0.11-4
    I: Validating libjson-c2 0.11-4
    I: Retrieving kmod 18-3
    I: Validating kmod 18-3
    I: Retrieving libkmod2 18-3
    I: Validating libkmod2 18-3
    I: Retrieving less 458-3
    I: Validating less 458-3
    I: Retrieving libcap2 1:2.24-8
    I: Validating libcap2 1:2.24-8
    I: Retrieving libcap2-bin 1:2.24-8
    I: Validating libcap2-bin 1:2.24-8
    I: Retrieving libestr0 0.1.9-1.1
    I: Validating libestr0 0.1.9-1.1
    I: Retrieving libffi6 3.1-2+b2
    I: Validating libffi6 3.1-2+b2
    I: Retrieving libgcrypt20 1.6.3-2
    I: Validating libgcrypt20 1.6.3-2
    I: Retrieving libgpg-error0 1.17-3
    I: Validating libgpg-error0 1.17-3
    I: Retrieving libidn11 1.29-1+b2
    I: Validating libidn11 1.29-1+b2
    I: Retrieving liblocale-gettext-perl 1.05-8+b1
    I: Validating liblocale-gettext-perl 1.05-8+b1
    I: Retrieving liblogging-stdlog0 1.0.4-1
    I: Validating liblogging-stdlog0 1.0.4-1
    I: Retrieving liblognorm1 1.0.1-3
    I: Validating liblognorm1 1.0.1-3
    I: Retrieving libmnl0 1.0.3-5
    I: Validating libmnl0 1.0.3-5
    I: Retrieving libnetfilter-acct1 1.0.2-1.1
    I: Validating libnetfilter-acct1 1.0.2-1.1
    I: Retrieving libnfnetlink0 1.0.1-3
    I: Validating libnfnetlink0 1.0.1-3
    I: Retrieving libpipeline1 1.4.0-1
    I: Validating libpipeline1 1.4.0-1
    I: Retrieving libpsl0 0.5.1-1
    I: Validating libpsl0 0.5.1-1
    I: Retrieving libselinux1 2.3-2
    I: Validating libselinux1 2.3-2
    I: Retrieving libsemanage-common 2.3-1
    I: Validating libsemanage-common 2.3-1
    I: Retrieving libsemanage1 2.3-1+b1
    I: Validating libsemanage1 2.3-1+b1
    I: Retrieving libsepol1 2.3-2
    I: Validating libsepol1 2.3-2
    I: Retrieving libsigc++-2.0-0c2a 2.4.0-1
    I: Validating libsigc++-2.0-0c2a 2.4.0-1
    I: Retrieving libtasn1-6 4.2-3+deb8u1
    I: Validating libtasn1-6 4.2-3+deb8u1
    I: Retrieving libtext-charwidth-perl 0.04-7+b4
    I: Validating libtext-charwidth-perl 0.04-7+b4
    I: Retrieving libtext-iconv-perl 1.7-5+b2
    I: Validating libtext-iconv-perl 1.7-5+b2
    I: Retrieving libtext-wrapi18n-perl 0.06-7
    I: Validating libtext-wrapi18n-perl 0.06-7
    I: Retrieving libusb-0.1-4 2:0.1.12-25
    I: Validating libusb-0.1-4 2:0.1.12-25
    I: Retrieving logrotate 3.8.7-1+b1
    I: Validating logrotate 3.8.7-1+b1
    I: Retrieving lsb-base 4.1+Debian13+nmu1
    I: Validating lsb-base 4.1+Debian13+nmu1
    I: Retrieving dmsetup 2:1.02.90-2.2
    I: Validating dmsetup 2:1.02.90-2.2
    I: Retrieving libdevmapper1.02.1 2:1.02.90-2.2
    I: Validating libdevmapper1.02.1 2:1.02.90-2.2
    I: Retrieving man-db 2.7.0.2-5
    I: Validating man-db 2.7.0.2-5
    I: Retrieving manpages 3.74-1
    I: Validating manpages 3.74-1
    I: Retrieving mawk 1.3.3-17
    I: Validating mawk 1.3.3-17
    I: Retrieving nano 2.2.6-3
    I: Validating nano 2.2.6-3
    I: Retrieving libncurses5 5.9+20140913-1+b1
    I: Validating libncurses5 5.9+20140913-1+b1
    I: Retrieving libncursesw5 5.9+20140913-1+b1
    I: Validating libncursesw5 5.9+20140913-1+b1
    I: Retrieving libtinfo5 5.9+20140913-1+b1
    I: Validating libtinfo5 5.9+20140913-1+b1
    I: Retrieving ncurses-base 5.9+20140913-1
    I: Validating ncurses-base 5.9+20140913-1
    I: Retrieving ncurses-bin 5.9+20140913-1+b1
    I: Validating ncurses-bin 5.9+20140913-1+b1
    I: Retrieving net-tools 1.60-26+b1
    I: Validating net-tools 1.60-26+b1
    I: Retrieving netbase 5.3
    I: Validating netbase 5.3
    I: Retrieving netcat-traditional 1.10-41
    I: Validating netcat-traditional 1.10-41
    I: Retrieving libhogweed2 2.7.1-5
    I: Validating libhogweed2 2.7.1-5
    I: Retrieving libnettle4 2.7.1-5
    I: Validating libnettle4 2.7.1-5
    I: Retrieving libnewt0.52 0.52.17-1+b1
    I: Validating libnewt0.52 0.52.17-1+b1
    I: Retrieving whiptail 0.52.17-1+b1
    I: Validating whiptail 0.52.17-1+b1
    I: Retrieving nfacct 1.0.1-1.1
    I: Validating nfacct 1.0.1-1.1
    I: Retrieving libssl1.0.0 1.0.1k-3+deb8u2
    I: Validating libssl1.0.0 1.0.1k-3+deb8u2
    I: Retrieving libp11-kit0 0.20.7-1
    I: Validating libp11-kit0 0.20.7-1
    I: Retrieving libpam-modules 1.1.8-3.1+deb8u1
    I: Validating libpam-modules 1.1.8-3.1+deb8u1
    I: Retrieving libpam-modules-bin 1.1.8-3.1+deb8u1
    I: Validating libpam-modules-bin 1.1.8-3.1+deb8u1
    I: Retrieving libpam-runtime 1.1.8-3.1+deb8u1
    I: Validating libpam-runtime 1.1.8-3.1+deb8u1
    I: Retrieving libpam0g 1.1.8-3.1+deb8u1
    I: Validating libpam0g 1.1.8-3.1+deb8u1
    I: Retrieving libpcre3 2:8.35-3.3+deb8u2
    I: Validating libpcre3 2:8.35-3.3+deb8u2
    I: Retrieving perl-base 5.20.2-3+deb8u3
    I: Validating perl-base 5.20.2-3+deb8u3
    I: Retrieving libpopt0 1.16-10
    I: Validating libpopt0 1.16-10
    I: Retrieving libprocps3 2:3.3.9-9
    I: Validating libprocps3 2:3.3.9-9
    I: Retrieving procps 2:3.3.9-9
    I: Validating procps 2:3.3.9-9
    I: Retrieving libreadline6 6.3-8+b3
    I: Validating libreadline6 6.3-8+b3
    I: Retrieving readline-common 6.3-8
    I: Validating readline-common 6.3-8
    I: Retrieving rsyslog 8.4.2-1+deb8u2
    I: Validating rsyslog 8.4.2-1+deb8u2
    I: Retrieving sed 4.2.2-4+b1
    I: Validating sed 4.2.2-4+b1
    I: Retrieving sensible-utils 0.0.9
    I: Validating sensible-utils 0.0.9
    I: Retrieving login 1:4.2-3+deb8u1
    I: Validating login 1:4.2-3+deb8u1
    I: Retrieving passwd 1:4.2-3+deb8u1
    I: Validating passwd 1:4.2-3+deb8u1
    I: Retrieving libslang2 2.3.0-2
    I: Validating libslang2 2.3.0-2
    I: Retrieving startpar 0.59-3
    I: Validating startpar 0.59-3
    I: Retrieving libsystemd0 215-17+deb8u3
    I: Validating libsystemd0 215-17+deb8u3
    I: Retrieving libudev1 215-17+deb8u3
    I: Validating libudev1 215-17+deb8u3
    I: Retrieving systemd 215-17+deb8u3
    I: Validating systemd 215-17+deb8u3
    I: Retrieving systemd-sysv 215-17+deb8u3
    I: Validating systemd-sysv 215-17+deb8u3
    I: Retrieving udev 215-17+deb8u3
    I: Validating udev 215-17+deb8u3
    I: Retrieving initscripts 2.88dsf-59
    I: Validating initscripts 2.88dsf-59
    I: Retrieving sysv-rc 2.88dsf-59
    I: Validating sysv-rc 2.88dsf-59
    I: Retrieving sysvinit-utils 2.88dsf-59
    I: Validating sysvinit-utils 2.88dsf-59
    I: Retrieving tar 1.27.1-2+b1
    I: Validating tar 1.27.1-2+b1
    I: Retrieving tasksel 3.31+deb8u1
    I: Validating tasksel 3.31+deb8u1
    I: Retrieving tasksel-data 3.31+deb8u1
    I: Validating tasksel-data 3.31+deb8u1
    I: Retrieving traceroute 1:2.0.20-2+b1
    I: Validating traceroute 1:2.0.20-2+b1
    I: Retrieving tzdata 2015g-0+deb8u1
    I: Validating tzdata 2015g-0+deb8u1
    I: Retrieving libustr-1.0-1 1.0.4-3+b2
    I: Validating libustr-1.0-1 1.0.4-3+b2
    I: Retrieving bsdutils 1:2.25.2-6
    I: Validating bsdutils 1:2.25.2-6
    I: Retrieving libblkid1 2.25.2-6
    I: Validating libblkid1 2.25.2-6
    I: Retrieving libmount1 2.25.2-6
    I: Validating libmount1 2.25.2-6
    I: Retrieving libsmartcols1 2.25.2-6
    I: Validating libsmartcols1 2.25.2-6
    I: Retrieving libuuid1 2.25.2-6
    I: Validating libuuid1 2.25.2-6
    I: Retrieving mount 2.25.2-6
    I: Validating mount 2.25.2-6
    I: Retrieving util-linux 2.25.2-6
    I: Validating util-linux 2.25.2-6
    I: Retrieving vim-common 2:7.4.488-7
    I: Validating vim-common 2:7.4.488-7
    I: Retrieving vim-tiny 2:7.4.488-7
    I: Validating vim-tiny 2:7.4.488-7
    I: Retrieving wget 1.16-1
    I: Validating wget 1.16-1
    I: Retrieving liblzma5 5.1.1alpha+20120614-2+b3
    I: Validating liblzma5 5.1.1alpha+20120614-2+b3
    I: Retrieving zlib1g 1:1.2.8.dfsg-2+b1
    I: Validating zlib1g 1:1.2.8.dfsg-2+b1
    I: Chosen extractor for .deb packages: dpkg-deb
    I: Extracting acl…
    Aborted.

    when I check the debootstrap.log, it said:

    [root@LS421DE392 debootstrap]# cat debootstrap.log
    dpkg-deb: file `.//var/cache/apt/archives/acl_2.2.52-2_armhf.deb’ contains ununderstood data member data.tar.xz , giving up
    tar: This does not look like a tar archive
    tar: Exiting with failure status due to previous errors

    Do you possibly know what went wrong?

  7. Found the problem. For some reason the script came with “VERSION=jessie” and yours was “VERSION=wheezy”. After I change it to wheezy, then it works.

  8. Thank you so much for all the hard work!

    Just finished following your wonderful guide, works perfectly on LS220DE 🙂

  9. Is there any way we can boot from usb instead of sda?

  10. Will this work on LS421DE with 2 HDDs as RAID1?

    With RAID enabled, there are 4 md devices:

    # cat /proc/mdstat
    Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
    md10 : active raid1 sda6[2]
    473337664 blocks super 1.2 [2/1] [_U]
    bitmap: 4/4 pages [16KB], 65536KB chunk

    md124 : active raid1 sda1[1]
    999872 blocks [2/1] [_U]
    bitmap: 1/1 pages [4KB], 65536KB chunk

    md1 : active raid1 sda2[2]
    4995008 blocks super 1.2 [2/1] [_U]
    bitmap: 1/1 pages [4KB], 65536KB chunk

    md2 : active raid1 sda5[2]
    999424 blocks super 1.2 [2/1] [_U]
    bitmap: 1/1 pages [4KB], 65536KB chunk

    # ls -la /dev/md*
    brw-rw—- 1 root disk 9, 1 Mar 18 16:38 /dev/md1
    brw-rw—- 1 root disk 9, 10 Mar 18 16:38 /dev/md10
    brw-rw—- 1 root disk 9, 124 Mar 18 16:38 /dev/md124
    brw-rw—- 1 root disk 9, 2 Mar 18 16:38 /dev/md2

    # mount | grep md
    /dev/md1 on / type ext3 (rw,relatime,errors=continue,barrier=1,data=writeback)
    /dev/md10 on /mnt/array1 type xfs (rw,noatime,attr2,usrquota,grpquota)

    2 md devices are not mounted, out of the 4.

    So, this is the mapping layout of LS421DE with RAID1

    md1=/ (root)
    md2=swap
    md10=data
    md124 is the boot device

    But setting INITRD_ROOT=”0x90a” seams not to work.

    Any ideas?

  11. Hello, Guys.

    I know this thread is a bit too old, but is there out anyone who tried this with the 4-bay version?
    Buffalo LinkStation LS441DE is the full product ID which I’m trying to upgrade this one.
    debootstrap was fine, images were generated. Unpacking RootFS is also fine, however I can’t ssh into the final software. Ping works fine.
    At the moment I don’t have any serial console access but I’m trying to find it on the web.

    I would really appreciate your help!

    Thanks,
    Cheers

    • Try attach first HDD into PC, mount sdX2 partition and grab var/log/syslog to know what was going on.

      • Yepp that was my idea as well but all the logfiles were empty.
        It seems the boot process was unsuccessful and was not able to mount the right rootfs device.

      • And one more thing: on the LS441, the rootfs is on /dev/md126 I believe. There are /dev/md124, /dev/md125 as well. (boot and share).
        So I don’t really know what should I write into INITRD_ROOT?
        I tried 0x97e but this was unsuccessful.

      • Hello, Guys.

        Could you light me up about the INITRD_ROOT in the case above?
        I think you are my last resort. This device seems too unsupported by now.

      • Try with single disk setup. Use sda2 for rootfs (the default):

        INITRD_ROOT="0x802"

      • Thank you. I’ll try later today, and post my results.
        After booting with single disk setup, is it still possible to create the RAID for the system and boot from that?

      • Toha, you linkstationmod need install on 1 disk, but second disk(with buffalo firmware) must installed in linkstation?

      • Hello, I’ve tried with INITRD_ROOT=”0x802″ but it is not working.
        It can’t boot I assume. (Not responding to ping, and ofc no SSH either).

        What I have done:
        -installed the stock firmware on 2 disks. (this created a raid-1)
        -I did the debootstrap and I attached the 1st disk to my ubuntu for unpacking the rootfs onto that
        -I detached the 2nd disk from the nas before attaching back the first one.
        -then I started the nas -> there is no ping, no ssh. brick until I completely clean all the partitions and reflash with the original firmware. I assume LS441 has a different bootup process.

        Can you help me investigating it, Toha?
        I’d really appreciate your help.
        (it would be awesome to have a serial console, but I couldnt find it anywhere)

        Thanks,
        Cheers.

      • Can you start over again? And before debootstraping, edit
        scripts/debootstrap-rootfs.cfg and use wheezy (currently script on github using jessie).
        As far as i remember, only wheezy is compatible with Buffalo kernel.

      • Serial Console http://forum.buffalo.nas-central.org/viewtopic.php?f=81&t=44367

        “Ground” line – metal case or any fixing screw motherboard

      • in last command error

        ~/lsmod/linkstation-mod-master$ sudo ./scripts/unpack-rootfs.sh out/hddrootfs.buffalo.updated /tmp/sda2
        rm: cannot remove ‘/tmp/sda2’: Device or resource busy
        ~/lsmod/linkstation-mod-master$

      • boot (via serial console)
        Root-NFS: no NFS server address
        VFS: Unable to mount root fs via NFS, trying floppy.
        VFS: Cannot open root device “nfs” or unknown-block(2,0)
        Please append a correct “root=” boot option; here are the available partitions:
        1f00 1024 mtdblock0 (driver?)
        1f01 32768 mtdblock1 (driver?)
        1f02 491520 mtdblock2 (driver?)

      • next:
        0800 2930266584 sda driver: sd
        0801 999983 sda1 55188a1c-24dc-4b57-b4af-487c0147csda1
        0802 4999168 sda2 0d03f03b-1248-4d97-a4d9-f198315d4sda2
        0803 384 sda3 68480174-80c3-4a70-a8c5-989415bf8sda3
        0804 0 sda4 08f182ce-65f2-480d-bfb5-48ec9e9ffsda4
        0805 999999 sda5 77718efd-25e9-46e0-a2ce-28917d577sda5
        0806 2914875392 sda6 4a803350-2a63-4fd6-9f9d-4e22707bbsda6
        0810 976762584 sdb driver: sd
        0811 999983 sdb1 2d5a525e-c346-4bd5-a3e5-f59c65491sdb1
        0812 4999168 sdb2 3e33c19b-a200-4c56-b55b-6550618e9sdb2
        0813 384 sdb3 225e0775-47bc-449a-b0d1-ff9fb85b5sdb3
        0814 0 sdb4 0c0565a2-eaa9-4cd5-8d7b-9d9381806sdb4
        0815 999999 sdb5 52b3250d-06a5-4428-88af-a17bf5c39sdb5
        0816 961750016 sdb6 b7eeabfa-9f6d-47ad-9522-307742564sdb6

      • next:
        Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

      • I replaced the Kernel on 4-11-12 in sda1 and copy /lib/modules/4.11.12-ls421de in sda2
        again boot error rootfs
        md: Waiting for all devices to be available before autodetect
        md: If you don’t use raid, use raid=noautodetect
        md: Autodetecting RAID arrays.
        md: autorun …
        md: … autorun DONE.
        VFS: Cannot open root device “nfs” or unknown-block(0,255): error -6
        Please append a correct “root=” boot option; here are the available partitions:
        0100 4096 ram0
        (driver?)
        0101 4096 ram1
        (driver?)
        0102 4096 ram2
        (driver?)
        0103 4096 ram3
        (driver?)
        0104 4096 ram4
        (driver?)
        0105 4096 ram5
        (driver?)
        0106 4096 ram6
        (driver?)
        0107 4096 ram7
        (driver?)
        0108 4096 ram8
        (driver?)
        0109 4096 ram9
        (driver?)
        010a 4096 ram10
        (driver?)
        010b 4096 ram11
        (driver?)
        010c 4096 ram12
        (driver?)
        010d 4096 ram13
        (driver?)
        010e 4096 ram14
        (driver?)
        010f 4096 ram15
        (driver?)
        0800 2930266584 sda
        driver: sd
        0801 999983 sda1 55188a1c-24dc-4b57-b4af-487c0147c1df

        0802 4999168 sda2 0d03f03b-1248-4d97-a4d9-f198315d41c2

        0803 384 sda3 68480174-80c3-4a70-a8c5-989415bf8e48

        0804 0 sda4 08f182ce-65f2-480d-bfb5-48ec9e9ff329

        0805 999999 sda5 77718efd-25e9-46e0-a2ce-28917d5770df

        0806 2914875392 sda6 4a803350-2a63-4fd6-9f9d-4e22707bb579

        0810 976762584 sdb
        driver: sd
        0811 999983 sdb1 2d5a525e-c346-4bd5-a3e5-f59c654910f7

        0812 4999168 sdb2 3e33c19b-a200-4c56-b55b-6550618e989e

        0813 384 sdb3 225e0775-47bc-449a-b0d1-ff9fb85b5997

        0814 0 sdb4 0c0565a2-eaa9-4cd5-8d7b-9d9381806cdf

        0815 999999 sdb5 52b3250d-06a5-4428-88af-a17bf5c39ca0

        0816 961750016 sdb6 b7eeabfa-9f6d-47ad-9522-307742564bc0

        Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
        —[ end Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,255)

      • My boot:
        Kernel command line: earlyprintk console=ttyUSB0,115200 console=ttyS0,115200 root=/dev/nfs rw BOOTVER=0.16 UBOOT_DATE=2015/01/15 mtdparts=armada-nand:0x2000000(boot),0x1e000000(rootfs)
        Your boot:
        Kernel command line: console=ttyS0,115200 root=/dev/sda2 rw initrd=0x2600040 panic=5 BOOTVER=0.13 UBOOT_DATE=2013/08/28 mtdparts=armada-nand:0x2000000(boot),0x1e000000(rootfs)

      • in U-Boot
        BUFFALO>> setenv bootargs_root ‘root=/dev/sda2 rw’
        BUFFALO>> boot
        ***********
        LS421DEXXX login: root
        Password:
        Linux LS421DE34C 4.11.12-ls421de #1 SMP Wed Aug 30 15:42:21 +05 2017 armv7l

        The programs included with the Debian GNU/Linux system are free software;
        the exact distribution terms for each program are described in the
        individual files in /usr/share/doc/*/copyright.

        Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
        permitted by applicable law.
        root@LS421DE34C:~#

        )))) Thanks!

  12. After the drive is returned to the NAS how long does it load the first time?

  13. Installed everything on the instructions (without errors) – no ping.
    Tried to use in a script debootstrap-combine.cfg – NETWORK_INTERFACE=eth0
    blinking white LED.
    I uses firmware v1.83….

  14. I followed the instructions (without errors) – no ping.

    VERSION=wheezy
    NETWORK_PROTO=dhcp

  15. Check out this post about installing Debian on LS421DE: https://www.znbs.space/wordpress/?p=536

    But also does not work for me.

  16. Pingback:在buffalo ls410上安装debian – Fire0594 – Log@X.X.B

  17. Pingback:Debian Wheezy on LinkStation LS421DE | Toha’s Blog – Log@X.X.B

  18. Pingback:Unified LSMONITOR for Debian System in LinkStation LS421DE – Toha's Blog

  19. [root@LS441D750 linkstation-mod-master]# ./scripts/debootstrap-rootfs.sh –clean
    -sh: ./scripts/debootstrap-rootfs.sh: Permission denied

  20. [root@LS441D750 linkstation-mod-master]# ./scripts/debootstrap-rootfs.sh –clean
    > Debootstrapping wheezy on Thu Sep 23 19:16:48 JST 2021…
    ./scripts/debootstrap-rootfs.sh: line 45: debootstrap: command not found
    Aborted.

  21. dpkg -i –force-all debootstrap_1.0.100~bpo9+1_all.deb
    Selecting previously deselected package debootstrap.
    (Reading database … 0 files and directories currently installed.)
    Unpacking debootstrap (from debootstrap_1.0.100~bpo9+1_all.deb) …
    dpkg: debootstrap: dependency problems, but configuring anyway as you request:
    debootstrap depends on wget; however:
    Package wget is not installed.
    Setting up debootstrap (1.0.100~bpo9+1) …

Leave a Reply to TohaCancel reply