Difference between revisions of "Debian Lenny on LS-CHLv2"
(usb-fix-link) |
(→Editing /etc/fstab) |
||
(22 intermediate revisions by 6 users not shown) | |||
Line 7: | Line 7: | ||
This guide will ask to open up the device case, reformat partitions, delete existing data, etc. All of these actions may void your warranty, destroy your data, etc. In general you can receive help from the community of from the Buffalo forums but bear in mind that every problem you may encounter is ultimately up to you to solve. You do it at your own risk. | This guide will ask to open up the device case, reformat partitions, delete existing data, etc. All of these actions may void your warranty, destroy your data, etc. In general you can receive help from the community of from the Buffalo forums but bear in mind that every problem you may encounter is ultimately up to you to solve. You do it at your own risk. | ||
− | + | This guide worked on LS-CHLv2 and LS-XHL. | |
− | + | This guide suggests to install the [http://sourceforge.net/projects/blstools/ blstools] instead, a small set of utilities developed for this hardware and enable some operations which would not be possible from a plain Debian install: | |
− | * | + | * turn the unit off from the on-off-auto switch |
− | * | + | * turn unit blinking LEDs to still blue when boot is complete |
− | * | + | * resume blinking when the unit is shutting down |
+ | * use the USB port | ||
− | + | Please note that the Armel Debian "micro_evtd" package will NOT work on LS-CHLv2 and LS-XHL because of different hardware. | |
Line 28: | Line 29: | ||
You are supposed to start from an "open" Stock Firmware, that is stock software that you can telnet to, | You are supposed to start from an "open" Stock Firmware, that is stock software that you can telnet to, | ||
− | Follow [[ | + | Follow [[Open_Stock_Firmware_LS-XHL|this guide]] to get telnet root console access to the LS. |
+ | |||
+ | Note for firmware 1.33 (and possibly others) Busybox isn't linked to ar so the debootstrap step below will fail - fix this by executing | ||
+ | |||
+ | ln -s /bin/busybox /usr/bin/ar | ||
+ | |||
+ | as root. | ||
==Backup the LS== | ==Backup the LS== | ||
Line 44: | Line 51: | ||
From the linkstation console download the Debian debootstrap utility and install it with dpkg: | From the linkstation console download the Debian debootstrap utility and install it with dpkg: | ||
− | + | wget http://launchpadlibrarian.net/26071255/debootstrap_1.0.13%7Ejaunty1_all.deb | |
− | + | dpkg -i debootstrap_1.0.13~jaunty1_all.deb | |
− | dpkg will complain of missing dependencies. Ignore it. | + | dpkg will complain of missing dependencies. Ignore it. |
− | + | mkdir debian-armel-rootfs | |
− | + | debootstrap --verbose --arch armel lenny debian-armel-rootfs http://ftp.de.debian.org/debian | |
− | + | ||
This step WILL take time. At the end you should get the following message: | This step WILL take time. At the end you should get the following message: | ||
− | + | I: Base system installed successfully. | |
==Completing the debootstrap and preparing the rootfs== | ==Completing the debootstrap and preparing the rootfs== | ||
− | Most commands will be run in the chrooted environment of the newly created Debian Lenny install. In order to enter the chroot type LANG=C chroot debian-armel-rootfs/ /bin/bash to leave type exit. | + | Most commands will be run in the chrooted environment of the newly created Debian Lenny install. In order to enter the chroot type |
+ | LANG=C chroot debian-armel-rootfs/ /bin/bash | ||
+ | to leave type exit. | ||
===Copy kernel modules from stock kernel=== | ===Copy kernel modules from stock kernel=== | ||
Line 65: | Line 73: | ||
Kernel modules reside in /lib/modules/<kernel version>. Here we are using the stock kernel so we must copy them from the stock initrd to the new rootfs. This must be done from within a chrooted environment in the new system - won't work with stock software. | Kernel modules reside in /lib/modules/<kernel version>. Here we are using the stock kernel so we must copy them from the stock initrd to the new rootfs. This must be done from within a chrooted environment in the new system - won't work with stock software. | ||
− | + | cp /boot/initrd.buffalo debian-armel-rootfs/tmp/ | |
− | + | LANG=C chroot debian-armel-rootfs/ /bin/bash | |
− | + | cd /tmp | |
− | + | dd if=initrd.buffalo of=initrd.gz ibs=64 skip=1 | |
− | + | gunzip initrd.gz | |
− | + | mkdir INITRD | |
− | + | mount -t ext2 -o loop initrd INITRD | |
− | + | cp -R INITRD/lib/modules/2.6.22.18 /lib/modules/ | |
− | + | umount INITRD | |
− | + | rmdir INITRD | |
− | + | rm initrd* | |
− | + | ||
− | + | ||
===Adding missing devices=== | ===Adding missing devices=== | ||
Line 85: | Line 91: | ||
Mount the proc filesystem - it can be mounted a number of times - and run the command to create device nodes in /dev (TODO: investigate dynamic devices with udev?): | Mount the proc filesystem - it can be mounted a number of times - and run the command to create device nodes in /dev (TODO: investigate dynamic devices with udev?): | ||
− | + | mount -t proc proc /proc | |
− | + | cd /dev | |
− | + | MAKEDEV generic | |
− | + | umount /proc | |
This will also take some time while all device nodes are created. | This will also take some time while all device nodes are created. | ||
Line 94: | Line 100: | ||
===Configuring locale=== | ===Configuring locale=== | ||
− | Install and configure the locales. Suggestion is to install at least the en_US.UTF-8 and your native language locale (e.g. it_IT.UTF-8, de_DE.UTF-8, etc). | + | Install and configure the locales. Suggestion is to install at least the ''en_US.UTF-8'' and your native language locale (e.g. ''it_IT.UTF-8'', ''de_DE.UTF-8'', etc). |
− | + | apt-get install locales | |
− | + | dpkg-reconfigure locales | |
===Editing /etc/fstab=== | ===Editing /etc/fstab=== | ||
− | Edit the static filesystem table file /etc/fstab (e.g. with nano) and make it look like this | + | Edit the static filesystem table file /etc/fstab (e.g. with nano) and make it look like this: |
− | + | # /etc/fstab: static file system information. | |
− | + | # | |
− | + | # file system mount point type options dump pass | |
− | + | /dev/sda2 / xfs defaults,noatime 0 1 | |
− | + | /dev/sda1 /boot ext3 ro,nosuid,nodev 0 2 | |
− | + | /dev/sda5 none swap sw 0 0 | |
− | proc /proc proc defaults 0 0 | + | /dev/sda6 /home xfs defaults,noatime 0 3 |
− | + | proc /proc proc defaults 0 0 | |
+ | devpts /dev/pts devpts gid=4,mode=620 0 0 | ||
+ | tmpfs /tmp tmpfs defaults 0 0 | ||
+ | sysfs /sys sysfs defaults 0 0 | ||
− | + | #/dev/ram1 on /mnt/ram type tmpfs (rw) | |
===Network=== | ===Network=== | ||
Line 118: | Line 127: | ||
Edit /etc/network/interfaces to match your LAN configuration. My LS gets all information from DHCP: | Edit /etc/network/interfaces to match your LAN configuration. My LS gets all information from DHCP: | ||
− | + | # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or | |
− | + | # /usr/share/doc/ifupdown/examples for more information. | |
− | + | ||
− | + | # We always want the loopback interface. | |
− | + | auto lo | |
− | + | iface lo inet loopback | |
− | + | ||
− | + | # DHCP for Ethernet connection | |
− | + | auto eth1 | |
− | + | iface eth1 inet dhcp | |
− | + | ||
− | + | # Example static IP setup: (broadcast and gateway are optional) | |
− | + | # auto eth1 | |
− | + | # iface eth1 inet static | |
− | + | # address 192.168.0.42 | |
− | + | # network 192.168.0.0 | |
− | + | # netmask 255.255.255.0 | |
− | + | # broadcast 192.168.0.255 | |
− | + | # gateway 192.168.0.1 | |
Choose a hostname and write it /etc/hostname (must be created). | Choose a hostname and write it /etc/hostname (must be created). | ||
Line 142: | Line 151: | ||
Edit /etc/hosts as follows: | Edit /etc/hosts as follows: | ||
− | + | 127.0.0.1 localhost.localdomain localhost | |
===Install SSHD=== | ===Install SSHD=== | ||
− | + | apt-get install openssh-server | |
− | + | passwd root | |
Edit /etc/ssh/sshd_config and make sure that the following line is present and uncommented: | Edit /etc/ssh/sshd_config and make sure that the following line is present and uncommented: | ||
− | + | PermitRootLogin yes | |
===Prepare the rootfs archive=== | ===Prepare the rootfs archive=== | ||
Line 157: | Line 166: | ||
Clean up the installation, leave the chrooted environment and tar it up: | Clean up the installation, leave the chrooted environment and tar it up: | ||
− | + | aptitude clean | |
− | + | exit | |
− | + | cd debian-armel-rootfs | |
− | + | tar zcvf ../lenny-armel-rootfs.tgz * | |
Now you have a complete rootfs for Debian Lenny armel. | Now you have a complete rootfs for Debian Lenny armel. | ||
Line 168: | Line 177: | ||
==Removing the HDD== | ==Removing the HDD== | ||
− | Turn the LS off and open the LS case. Will require patience and carefulness in order not to break the plastic notches. Remove the HDD from the Linkstation. Connect it to a Linux Desktop PC e.g with a SATA-to-USB adapter. | + | Turn the LS off and open the LS case. Will require patience and carefulness in order not to break the plastic notches. Take [http://www.yamasita.jp/linkstation/2008/11/081112__disassemble.html this page] as a reference on how to open the case. |
+ | |||
+ | Remove the HDD from the Linkstation. Connect it to a Linux Desktop PC e.g with a SATA-to-USB adapter. | ||
==Installing the Debian rootfs== | ==Installing the Debian rootfs== | ||
Line 176: | Line 187: | ||
The following instructions will copy the lenny-rootfs.tgz file created on the LS on the local system, will FORMAT the second HDD partition and will create the Lenny rootfs there: | The following instructions will copy the lenny-rootfs.tgz file created on the LS on the local system, will FORMAT the second HDD partition and will create the Lenny rootfs there: | ||
− | + | sudo -i | |
− | + | mkdir /mnt/sdg1 | |
− | + | mkdir /mnt/sdg2 | |
− | + | mount /dev/sdg1 /mnt/sdg1 | |
− | + | mount /dev/sdg2 /mnt/sdg2 | |
− | + | cp /mnt/sdg2/root/lenny-rootfs.tgz . | |
− | + | umount /mnt/sdg2 | |
− | + | mkfs.xfs -f /dev/sdg2 | |
− | + | mount /dev/sdg2 /mnt/sdg2 | |
− | + | cp lenny-rootfs.tgz /mnt/sdg2/ | |
− | + | cd /mnt/sdg2/ | |
− | + | tar zxvf lenny-rootfs.tgz | |
− | + | rm lenny-rootfs.tgz | |
==Installing an empty initrd== | ==Installing an empty initrd== | ||
Line 196: | Line 207: | ||
"empty initrd" means an initrd with no filesystem. It is not an empty file. | "empty initrd" means an initrd with no filesystem. It is not an empty file. | ||
− | + | For this you need the ''mkimage'' command. (in Debian/Ubuntu just install the package ''uboot-mkimage''). | |
− | + | ||
− | + | mkdir x ; cd x | |
− | + | find . | cpio --quiet -o -H newc > ../x2 | |
− | + | cd .. | |
− | + | mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -d x2 initrd.buffalo | |
− | + | rmdir x ; rm -f x2 | |
+ | mv /mnt/sdg1/initrd.buffalo /mnt/sdg1/initrd.original | ||
+ | cp initrd.buffalo /mnt/sdg1/ | ||
Unmount all partitions: | Unmount all partitions: | ||
− | + | cd / | |
− | + | umount /mnt/sdg* | |
Turn the HDD off and put it back into the LS. | Turn the HDD off and put it back into the LS. | ||
Line 215: | Line 228: | ||
===Configuring timezone=== | ===Configuring timezone=== | ||
− | + | dpkg-reconfigure tzdata | |
===Useful packages=== | ===Useful packages=== | ||
Line 221: | Line 234: | ||
Anyone would need these: | Anyone would need these: | ||
− | + | apt-get install sudo less usbutils bzip2 mc linuxlogo psmisc | |
===NTP=== | ===NTP=== | ||
Line 227: | Line 240: | ||
Ntpd ensures that your Linkstation clock stays in sync with global time servers. | Ntpd ensures that your Linkstation clock stays in sync with global time servers. | ||
− | + | apt-get install ntp | |
+ | |||
+ | |||
+ | =blstools= | ||
+ | |||
+ | As told above, blstools are a set of utilities which enable LS-CHL/XHL hardware-specific features otherwise unavailable from a plain Debian Lenny installation. | ||
+ | |||
+ | In order to install blstools you have to download the package from [http://sourceforge.net/projects/blstools/ the blstools project page], put it on the LS and run, from the command line: | ||
+ | |||
+ | tar zxf blstools-0.1.0.tar.gz | ||
+ | cd blstools-0.1.0 | ||
+ | sudo ./install.sh | ||
+ | sudo reboot | ||
+ | |||
+ | The following features are installed: | ||
+ | |||
+ | ==lsmonitor (/etc/init.d/lsmonitor)== | ||
+ | |||
+ | This is a daemon that is automatically started when the system boots. You don't need | ||
+ | to call it directly. | ||
+ | |||
+ | lsmonitor stops the blue led from flashing and provides a reassuring, still blue | ||
+ | light. Also, when you move the switch in "off" position lsmonitor initiates system | ||
+ | shutdown (which is nice isn't it?) | ||
+ | |||
+ | ==usb (/etc/init.d/usb)== | ||
+ | |||
+ | Powers on and off the USB interface. | ||
+ | |||
+ | When you want to connect a USB disk to the Linkstation you should first call: | ||
+ | |||
+ | sudo /etc/init.d/usb start | ||
+ | |||
+ | and then you will be able to mount the USB drive to the desired location (generally, | ||
+ | the device will be /dev/sdb1). Once done, in order to save power you can unmount | ||
+ | the mounted volume and issue: | ||
+ | |||
+ | sudo /etc/init.d/usb stop | ||
+ | |||
+ | to disable the USB device. | ||
+ | |||
=References= | =References= | ||
Line 235: | Line 288: | ||
* http://buffalo.nas-central.org/wiki/FreeLink_for_the_Kurobox_Pro_-_Automatic_Install | * http://buffalo.nas-central.org/wiki/FreeLink_for_the_Kurobox_Pro_-_Automatic_Install | ||
* http://forum.buffalo.nas-central.org/viewtopic.php?f=39&t=13551 | * http://forum.buffalo.nas-central.org/viewtopic.php?f=39&t=13551 | ||
+ | |||
+ | [[Category:LS-CHLv2]][[Category:Debian]] |
Revision as of 02:27, 18 July 2010
This guide will explain how to install Debian GNU/Linux "Lenny" on the Linkstation Live LS-CHL (=LS) using the Debian "debootstrap" procedure. The original kernel will be preserved, as well as the original bootloader (U-Boot).
Basic idea:
- create a Debian system with debootstrap
- replace the old filesystem with the new one
This guide will ask to open up the device case, reformat partitions, delete existing data, etc. All of these actions may void your warranty, destroy your data, etc. In general you can receive help from the community of from the Buffalo forums but bear in mind that every problem you may encounter is ultimately up to you to solve. You do it at your own risk.
This guide worked on LS-CHLv2 and LS-XHL.
This guide suggests to install the blstools instead, a small set of utilities developed for this hardware and enable some operations which would not be possible from a plain Debian install:
- turn the unit off from the on-off-auto switch
- turn unit blinking LEDs to still blue when boot is complete
- resume blinking when the unit is shutting down
- use the USB port
Please note that the Armel Debian "micro_evtd" package will NOT work on LS-CHLv2 and LS-XHL because of different hardware.
Contents
Preliminary steps
Don't update the firmware
If possible don't upgrade firmware to version 1.21 as you will not be able to easily get console access to the LS. Kernel
Obtain root access to the linkstation
You are supposed to start from an "open" Stock Firmware, that is stock software that you can telnet to,
Follow this guide to get telnet root console access to the LS.
Note for firmware 1.33 (and possibly others) Busybox isn't linked to ar so the debootstrap step below will fail - fix this by executing
ln -s /bin/busybox /usr/bin/ar
as root.
Backup the LS
If you have any important data on the LS you definitely need to make a backup.
Even if you don't, you'd better take a snapshot of the vital disk partitions (first and second partition). So you will be able to easily revert to the original stock distribution. [forum post] explains how to do it.
Prepare a Debian Lenny root filesystem
Debootstrap
This is derived from original debootstrap docs.
From the linkstation console download the Debian debootstrap utility and install it with dpkg:
wget http://launchpadlibrarian.net/26071255/debootstrap_1.0.13%7Ejaunty1_all.deb dpkg -i debootstrap_1.0.13~jaunty1_all.deb
dpkg will complain of missing dependencies. Ignore it.
mkdir debian-armel-rootfs debootstrap --verbose --arch armel lenny debian-armel-rootfs http://ftp.de.debian.org/debian
This step WILL take time. At the end you should get the following message:
I: Base system installed successfully.
Completing the debootstrap and preparing the rootfs
Most commands will be run in the chrooted environment of the newly created Debian Lenny install. In order to enter the chroot type
LANG=C chroot debian-armel-rootfs/ /bin/bash
to leave type exit.
Copy kernel modules from stock kernel
Kernel modules reside in /lib/modules/<kernel version>. Here we are using the stock kernel so we must copy them from the stock initrd to the new rootfs. This must be done from within a chrooted environment in the new system - won't work with stock software.
cp /boot/initrd.buffalo debian-armel-rootfs/tmp/ LANG=C chroot debian-armel-rootfs/ /bin/bash cd /tmp dd if=initrd.buffalo of=initrd.gz ibs=64 skip=1 gunzip initrd.gz mkdir INITRD mount -t ext2 -o loop initrd INITRD cp -R INITRD/lib/modules/2.6.22.18 /lib/modules/ umount INITRD rmdir INITRD rm initrd*
Adding missing devices
Still in the chrooted environment.
Mount the proc filesystem - it can be mounted a number of times - and run the command to create device nodes in /dev (TODO: investigate dynamic devices with udev?):
mount -t proc proc /proc cd /dev MAKEDEV generic umount /proc
This will also take some time while all device nodes are created.
Configuring locale
Install and configure the locales. Suggestion is to install at least the en_US.UTF-8 and your native language locale (e.g. it_IT.UTF-8, de_DE.UTF-8, etc).
apt-get install locales dpkg-reconfigure locales
Editing /etc/fstab
Edit the static filesystem table file /etc/fstab (e.g. with nano) and make it look like this:
# /etc/fstab: static file system information. # # file system mount point type options dump pass /dev/sda2 / xfs defaults,noatime 0 1 /dev/sda1 /boot ext3 ro,nosuid,nodev 0 2 /dev/sda5 none swap sw 0 0 /dev/sda6 /home xfs defaults,noatime 0 3 proc /proc proc defaults 0 0 devpts /dev/pts devpts gid=4,mode=620 0 0 tmpfs /tmp tmpfs defaults 0 0 sysfs /sys sysfs defaults 0 0
- /dev/ram1 on /mnt/ram type tmpfs (rw)
Network
Edit /etc/network/interfaces to match your LAN configuration. My LS gets all information from DHCP:
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. # We always want the loopback interface. auto lo iface lo inet loopback
# DHCP for Ethernet connection auto eth1 iface eth1 inet dhcp
# Example static IP setup: (broadcast and gateway are optional) # auto eth1 # iface eth1 inet static # address 192.168.0.42 # network 192.168.0.0 # netmask 255.255.255.0 # broadcast 192.168.0.255 # gateway 192.168.0.1
Choose a hostname and write it /etc/hostname (must be created).
Edit /etc/hosts as follows:
127.0.0.1 localhost.localdomain localhost
Install SSHD
apt-get install openssh-server passwd root
Edit /etc/ssh/sshd_config and make sure that the following line is present and uncommented:
PermitRootLogin yes
Prepare the rootfs archive
Clean up the installation, leave the chrooted environment and tar it up:
aptitude clean exit cd debian-armel-rootfs tar zcvf ../lenny-armel-rootfs.tgz *
Now you have a complete rootfs for Debian Lenny armel.
Installation
Removing the HDD
Turn the LS off and open the LS case. Will require patience and carefulness in order not to break the plastic notches. Take this page as a reference on how to open the case.
Remove the HDD from the Linkstation. Connect it to a Linux Desktop PC e.g with a SATA-to-USB adapter.
Installing the Debian rootfs
Let's say that the LS' HDD device will be /dev/sdg and the partitions will be /dev/sdg1, /dev/sdg2 etc. Change sdg to match your environment.
The following instructions will copy the lenny-rootfs.tgz file created on the LS on the local system, will FORMAT the second HDD partition and will create the Lenny rootfs there:
sudo -i mkdir /mnt/sdg1 mkdir /mnt/sdg2 mount /dev/sdg1 /mnt/sdg1 mount /dev/sdg2 /mnt/sdg2 cp /mnt/sdg2/root/lenny-rootfs.tgz . umount /mnt/sdg2 mkfs.xfs -f /dev/sdg2 mount /dev/sdg2 /mnt/sdg2 cp lenny-rootfs.tgz /mnt/sdg2/ cd /mnt/sdg2/ tar zxvf lenny-rootfs.tgz rm lenny-rootfs.tgz
Installing an empty initrd
Must make an empty initrd in LS' boot partition. Otherwise the stock initrd will start and runs scripts to check for a stock setup. Indeed an initrd is not needed in this Lenny installation as everything can be found on the root filesystem.
"empty initrd" means an initrd with no filesystem. It is not an empty file.
For this you need the mkimage command. (in Debian/Ubuntu just install the package uboot-mkimage).
mkdir x ; cd x find . | cpio --quiet -o -H newc > ../x2 cd .. mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -d x2 initrd.buffalo rmdir x ; rm -f x2 mv /mnt/sdg1/initrd.buffalo /mnt/sdg1/initrd.original cp initrd.buffalo /mnt/sdg1/
Unmount all partitions:
cd / umount /mnt/sdg*
Turn the HDD off and put it back into the LS.
Post-installation setup
Configuring timezone
dpkg-reconfigure tzdata
Useful packages
Anyone would need these:
apt-get install sudo less usbutils bzip2 mc linuxlogo psmisc
NTP
Ntpd ensures that your Linkstation clock stays in sync with global time servers.
apt-get install ntp
blstools
As told above, blstools are a set of utilities which enable LS-CHL/XHL hardware-specific features otherwise unavailable from a plain Debian Lenny installation.
In order to install blstools you have to download the package from the blstools project page, put it on the LS and run, from the command line:
tar zxf blstools-0.1.0.tar.gz cd blstools-0.1.0 sudo ./install.sh sudo reboot
The following features are installed:
lsmonitor (/etc/init.d/lsmonitor)
This is a daemon that is automatically started when the system boots. You don't need to call it directly.
lsmonitor stops the blue led from flashing and provides a reassuring, still blue light. Also, when you move the switch in "off" position lsmonitor initiates system shutdown (which is nice isn't it?)
usb (/etc/init.d/usb)
Powers on and off the USB interface.
When you want to connect a USB disk to the Linkstation you should first call:
sudo /etc/init.d/usb start
and then you will be able to mount the USB drive to the desired location (generally, the device will be /dev/sdb1). Once done, in order to save power you can unmount the mounted volume and issue:
sudo /etc/init.d/usb stop
to disable the USB device.