Difference between revisions of "LS Pro Debootstrap Howto"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m
(Checksums for Lenny_REQ.tar don't match the linked file; edited other entries to make clear what checksums were generated for, plus additional checksums added. Other minor amendments.)
 
(19 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
{{Articles|LSPro|Debian}}
 
{{Articles|LSPro|Debian}}
== Debootstrap Procedure for the LS Pro ==
+
This article describes the procedure to install Debian on a Linkstation Pro or Kurobox Pro by creating a minimal installation on a Linux workstation and transferring it to a Linkstation.  Access via serial cable is not required.
  
This method of installing debian on your LS Pro requires another linux computer on your network.
+
==Prerequisites==
 +
To run this procedure you will need a computer with some form of Linux installed on it, preferably Debian or a variant of it such as Ubuntu.  The CPU architecture isn't relevant, so if you have another Linkstation with Debian on it that will work fine.  Before you start, you need to install two packages: <tt>debootstrap</tt> and some form of HTTP or FTP server.  If you don't have a server installed, I recommend <tt>vsftpd</tt>.
  
=== Debootstrap ===
+
For these instructions to work your Pro you must be running at least a '''2.6.16''' kernel, or else the <tt>chroot</tt> command will not work. I recommend using the latest upstream Linux kernel instead of a Buffalo or Marvell modified one; you can follow [[Buffalo ARM9 Kernel Port#Compilation&Installation Instructions|these instructions]] to install a recent one.  It is a good idea to [[Custom Partitions on the LS Pro|adjust the size of your partitions]] before following this procedure, as the /dev/sda2 partition is very small by default.  I suggest making it at least 5 GB. You also need to be using a [[LS PRO modified initrd|modified initrd]] in order to boot the custom distribution.
# On your linux workstation, install debootstrap.
+
# Run debootstrap --foreign --arch arm etch <Target> <Mirror>
+
  * <Target> represents the destination directory for the debootstrap. I'm assuming you picked /target.
+
  * <Mirror> must be a debian mirror that has etch arm packages. http://mirrors.kernel.org/debian works.
+
# Now edit /target/etc/fstab to contain the following:
+
  proc /proc proc defaults 0 0
+
none /dev/pts devpts gid=5,mode=20 0 0
+
  tmpfs /tmp tmpfs mode=1777 0 0
+
/dev/sda5 swap swap defaults 0 0
+
/dev/sda1 /boot ext3 noatime,errors=remount-ro 0 1
+
/dev/sda6 /mnt/disk1 xfs noatime,nodiratime 0 0
+
  
# Edit /target/etc/network/interfaces and add:
+
==Create the Stage 1 image==
 +
On your Linux workstation, pick a directory that you will stage the Debian install in.  For my example I will use <tt>/tmp/debian</tt>.  Become root and use <tt>debootstrap</tt> to create a minimal Debian installation in this directory:
 +
su
 +
mkdir /tmp/debian
 +
debootstrap --foreign --arch armel lenny /tmp/debian
 +
Now make a tarball from the installed files:
 +
cd /tmp/debian
 +
tar cvzf ../debian.tar.gz *
 +
Move the tarball to wherever your FTP server serves files from, for example <tt>/home/ftp</tt>.
  
/target/etc/network/interfaces. install
+
==Unpack the image and complete the debootstrap process==
                      miconapl and micro_evtd. send a tarball of /target to LS Pro. on LS Pro in EM mode: unpack tarball to /mnt/disk1/deb. chroot /mnt/disk1/deb. /debootstrap/debootstrap --second-stage. format
+
Now boot your Pro in EM mode and telnet to it. I'm assuming that you want to overwrite the installed system on /dev/sda2. If that's not what you want, '''don't''' run the <tt>mkfs</tt> command.  Instead, choose another directory to install to.
                      /dev/sda2. mount /dev/sda2 to /mnt/target. cp -a /mnt/disk1/deb/* /mnt/target. rm /boot/rootfs_*; date >/boot/rootfs_ok. reboot
+
  
 +
I use the ext3 filesystem for this example because it's very likely that your kernel has support for it.  If you'd like to use a different filesystem, it's up to you to determine whether the kernel you're using supports it.
  
=== Prepare the Linkstation ===
+
Make a new filesystem on /dev/sda2 and mount it.  Download the tarball from your FTP server, and unpack the minimal Debian image.  Then <tt>chroot</tt> into it and complete the bootstrap process:
# First, you need to perform the initrd-only installation that comes with FreeLink_arm9-1.0rev2.zip with LSUpdater.exe.
+
mke2fs -j /dev/sda2
# Now, boot the  
+
mount -t ext3 /dev/sda2 /mnt/disk1
# Chroot install openssh-server
+
cd /mnt/disk1
 +
wget ftp://ip.of.ftp.server/debian.tar.gz
 +
tar xvzf debian.tar.gz
 +
chroot /mnt/disk1 /debootstrap/debootstrap --second-stage
 +
 
 +
The last step may take a while, but you now have a full Debian system installed on your Linkstation.  Don't reboot yet, though... we don't have a working system!
 +
 
 +
==Configure the system and install additional software==
 +
There are two files that need to be configured before the system will run correctly, <tt>/etc/fstab</tt> and <tt>/etc/network/interfaces</tt>.  The first describes the layout of filesystems on your disk; the second, as the name implies, configures network interfaces.
 +
 
 +
After mounting the <tt>proc</tt> filesystem, you can use <tt>chroot</tt> to enter the system and modify the configuration files:
 +
mount -t proc proc /mnt/disk1/proc
 +
chroot /mnt/disk1 /bin/bash
 +
vi /etc/fstab
 +
vi /etc/network/interfaces
 +
 
 +
My suggested <tt>/etc/fstab</tt> file contains the layout you wound up with if you followed [[Custom Partitions on the LS Pro#Partitions after firmware update|the instructions above]].
 +
/dev/sda1    /boot    ext3    noatime    1 2
 +
/dev/sda2    /        ext3    noatime    0 1
 +
/dev/sda5    none    swap    sw        0 0
 +
/dev/sda6    /srv    ext3    noatime    0 0
 +
 
 +
<tt>/srv</tt> is the location recommended by [http://www.pathname.com/fhs/pub/fhs-2.3.html the FHS] for data stored on the system by and for services such as FTP and Samba.  Your partition may be formatted as XFS; if this is the case I recommend changing it to ext3, as XFS has known bugs on the ARM9 platform.
 +
 
 +
This <tt>/etc/network/interfaces</tt> will bring up the network device using DHCP.
 +
auto lo eth0
 +
iface lo inet loopback
 +
iface eth0 inet dhcp
 +
 
 +
You also need to install <tt>micro_evtd</tt>, which keeps the watchdog timer in the LS Pro happy, adjusts the fan speed for you, and such.  The binaries and configuration files for <tt>micro_evtd</tt> are provided by lb_worm and stored in [http://buffalo.nas-central.org/downloads the downloads area].
 +
cd /
 +
wget http://buffalo.nas-central.org/download/Users/goat/micro_evtd-20080531.tar.gz
 +
tar xvzpf micro_evtd-20080531.tar.gz
 +
rm micro_evtd-20080531.tar.gz
 +
 
 +
Next, update the package lists and install <tt>sshd</tt> so that you can access the Pro over the network after the install is done, and <tt>udev</tt>, the dynamic <tt>/dev</tt> manager:
 +
apt-get update
 +
apt-get install ssh udev
 +
invoke-rc.d ssh stop
 +
 
 +
If you have a serial cable attached and wish to login via that, open /etc/inittab and ensure it has a line that looks like:
 +
T0:23:respawn:/sbin/getty -L ttyS0 115200
 +
 
 +
Finally, change the root password, set the hostname for the next boot, exit the chroot, unmount the disk, and reboot.  Your new system is ready!
 +
passwd
 +
echo 'LS-GL' > /etc/hostname
 +
exit
 +
umount /mnt/disk1/proc /mnt/disk1
 +
reboot
 +
 
 +
On reboot, it probably is a good idea to turn recommends off.
 +
as root do --
 +
echo "APT::Install-Recommends 0;" >/etc/apt/apt.conf.d/99recommends
 +
 
 +
 
 +
 
 +
--------------------------------
 +
==Then you will need the following. ==
 +
 +
#A BACKUP OF THE DATA PARTITION - No one but you can be blamed if your data is destroyed and there isn't a backup.
 +
#BACKUP OF the WORKING /boot partition (files).
 +
#The debootstrapped debian armel lenny tar file you made (or other method of storing it).
 +
#Enough free disk space to place the new rootfs on.
 +
#micro_evtd-20080531.tar.gz There is a debian package of this, but it needs to be configured from the last time i looked at it.
 +
#be able to get into and out of safe mode.
 +
#The files listed, [[#Files required | below ]].
 +
#I suggest you give the root filesystem 2GB or the larger 5GB as stated above. For a linkstation 2gb should be fine. However, it is probably safer to give it 5GB.
 +
 +
 
 +
 
 +
My hard is paritioned  disk looks like this. I am using ext3 for my data and rootfs file systems.
 +
 
 +
  Device Boot      Start        End      Blocks  Id  System
 +
/dev/sda1              1          37      297171  83  Linux
 +
/dev/sda2              38        281    1959930  83  Linux
 +
/dev/sda4            282      38913  310311540    f  W95 Ext'd (LBA)
 +
/dev/sda5            282        318      297171  82  Linux swap / Solaris
 +
/dev/sda6            319      38913  310014306  83  Linux
 +
 
 +
See the custom partitions page for how to get this kind of a setup; it's referenced in the [[#Prerequisites|Prerequisites]] section above.)
 +
 
 +
My Fstab looks like
 +
# /etc/fstab: static file system information.
 +
# <file system> <mount point>  <type>  <options>              <dump>  <pass>
 +
proc            /proc      proc    defaults                            0 0
 +
#none            /dev/pts  devpts  gid=5,mode=20                      0 0
 +
tmpfs          /tmp      tmpfs  size=10M,mode=1777                  0 0
 +
/dev/sda1      /boot      ext3    defaults,noatime                    1 2
 +
/dev/sda2      /          ext3    defaults,noatime,errors=remount-ro  0 1
 +
/dev/sda5      none      swap    sw                                  0 0
 +
/dev/sda6      /mnt/disk1 ext3,acl defaults,noatime,nodiratime        0 0
 +
 +
(you may not want nodiratime)
 +
 +
 +
==Files required==
 +
 
 +
Use the following links to collect the files separately:
 +
 
 +
* [http://buffalo.nas-central.org/download/ALL_ARM9/ARMel%20Lenny/ lb_worm's new initrd / image. ]
 +
md5sum 885b1b61f0f00a9459c434dd47ef32f5 
 +
sha1sum ac844bd0c7bdab225b846b57a407a53cc74437ea
 +
sha256sum 9281ab4ade3139d4dbc7e1b2c87f226f000641092f5c4bd047b5534959161ca2
 +
* A new kernel and modules.
 +
lb_worm's image does not require to change the bootloader, but there is no kernel with that 
 +
image. Take a kernel from one of davy_gravy's packages, [http://buffalo.nas-central.org/download/Users/davy_gravy/kernelpackages/2.6.26-update_full_debian.tgz  such as the 2.6.26 kernel in this package].
 +
2.6.26-update_full_debian.tar
 +
md5sum a0baf324b0f42a29e43600c585d8432e
 +
sha1sum 235a51ef316f716332016f1cb050ee4f56024c6c
 +
sha256sum dd6a3c20fc01dca452e553fb54bb48a2bbd654c60f1afd1d28c7684d1faac0df
 +
 +
Check sums for uImage-2.6.26 contained in the above tar, should you wish to check that alone.
 +
md5sum a2ec665585d248ba63fb043f6d59ae37
 +
sha1sum 2ffc50231d4141bcbb1d82d6b1504fe1411acb2b
 +
sha256sum 9c86038c3cf48d2667d62bdaabe3b745ea050eb86710c732cd15c91af80610da
 +
 +
 
 +
-----------------
 +
 
 +
 
 +
OR
 +
 
 +
Download everything the lenny_REQ.tar archive:
 +
 
 +
'''Note''': This file should be treated with caution as the checksums below don't match either the archive, or any of the files contained in it.  Unless the original poster fixes the file or the checksums it would be prudent to source the required files from the other links.  However, the file ''uImage-2.6.26'' within the tar archive does match the one linked above, so it may just be an cut & past error.
 +
 
 +
--[[User:Chilledrat|Chilledrat]] 17:33, 20 March 2012 (UTC)
 +
 
 +
[https://freepository.com/cgi-bin/download.pl?file=lenny_REQ.tar&rev=1.1&cvsroot=/fp1/85VSgDwerUxeILS_PRO&where=none/lenny_REQ.tar lenny_REQ.tar]
 +
*lenny_REQ.tar
 +
md5sum c3bfb83fdeeb7020d6644af11245a1cf
 +
sha1sum 5cb463e7ee6861d4d862546fc3f34e02fc60b0b4
 +
sha256sum lenny_REQ.tar f6044746e9dec3c42fc9fb013193aabaa8fe320504a9714b0077f9713a981420
 +
 
 +
== Once you have all of this. ==
 +
Reboot / get into EM mode. I suggest you copy the files to another computer (so you can pick up the  pieces). Rename the boot_options to the correct name, rename initrd.buff... to the correct name  remove the link from the current kernel to the uImage2.6.26 (2.6.26 kernel).
 +
mount /dev/sda2 untar the lenny armel tar / other file / files to it. extract the modules.tar / modules to /lib/modules (move to the appropriate place).
 +
 
 +
Reboot. And hope it works !
 +
Oh and if you find that the linkstation is rebooting and beeping you can disable the watchdog microapl -a system_set_watchdog 255 . Others have reported that decreasing or turning off the polling will also fix the problem.

Latest revision as of 17:33, 20 March 2012

This article describes the procedure to install Debian on a Linkstation Pro or Kurobox Pro by creating a minimal installation on a Linux workstation and transferring it to a Linkstation. Access via serial cable is not required.

Contents

Prerequisites

To run this procedure you will need a computer with some form of Linux installed on it, preferably Debian or a variant of it such as Ubuntu. The CPU architecture isn't relevant, so if you have another Linkstation with Debian on it that will work fine. Before you start, you need to install two packages: debootstrap and some form of HTTP or FTP server. If you don't have a server installed, I recommend vsftpd.

For these instructions to work your Pro you must be running at least a 2.6.16 kernel, or else the chroot command will not work. I recommend using the latest upstream Linux kernel instead of a Buffalo or Marvell modified one; you can follow these instructions to install a recent one. It is a good idea to adjust the size of your partitions before following this procedure, as the /dev/sda2 partition is very small by default. I suggest making it at least 5 GB. You also need to be using a modified initrd in order to boot the custom distribution.

Create the Stage 1 image

On your Linux workstation, pick a directory that you will stage the Debian install in. For my example I will use /tmp/debian. Become root and use debootstrap to create a minimal Debian installation in this directory:

su
mkdir /tmp/debian
debootstrap --foreign --arch armel lenny /tmp/debian

Now make a tarball from the installed files:

cd /tmp/debian
tar cvzf ../debian.tar.gz *

Move the tarball to wherever your FTP server serves files from, for example /home/ftp.

Unpack the image and complete the debootstrap process

Now boot your Pro in EM mode and telnet to it. I'm assuming that you want to overwrite the installed system on /dev/sda2. If that's not what you want, don't run the mkfs command. Instead, choose another directory to install to.

I use the ext3 filesystem for this example because it's very likely that your kernel has support for it. If you'd like to use a different filesystem, it's up to you to determine whether the kernel you're using supports it.

Make a new filesystem on /dev/sda2 and mount it. Download the tarball from your FTP server, and unpack the minimal Debian image. Then chroot into it and complete the bootstrap process:

mke2fs -j /dev/sda2
mount -t ext3 /dev/sda2 /mnt/disk1
cd /mnt/disk1
wget ftp://ip.of.ftp.server/debian.tar.gz
tar xvzf debian.tar.gz
chroot /mnt/disk1 /debootstrap/debootstrap --second-stage

The last step may take a while, but you now have a full Debian system installed on your Linkstation. Don't reboot yet, though... we don't have a working system!

Configure the system and install additional software

There are two files that need to be configured before the system will run correctly, /etc/fstab and /etc/network/interfaces. The first describes the layout of filesystems on your disk; the second, as the name implies, configures network interfaces.

After mounting the proc filesystem, you can use chroot to enter the system and modify the configuration files:

mount -t proc proc /mnt/disk1/proc
chroot /mnt/disk1 /bin/bash
vi /etc/fstab
vi /etc/network/interfaces

My suggested /etc/fstab file contains the layout you wound up with if you followed the instructions above.

/dev/sda1    /boot    ext3    noatime    1 2
/dev/sda2    /        ext3    noatime    0 1
/dev/sda5    none     swap    sw         0 0
/dev/sda6    /srv     ext3    noatime    0 0

/srv is the location recommended by the FHS for data stored on the system by and for services such as FTP and Samba. Your partition may be formatted as XFS; if this is the case I recommend changing it to ext3, as XFS has known bugs on the ARM9 platform.

This /etc/network/interfaces will bring up the network device using DHCP.

auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp

You also need to install micro_evtd, which keeps the watchdog timer in the LS Pro happy, adjusts the fan speed for you, and such. The binaries and configuration files for micro_evtd are provided by lb_worm and stored in the downloads area.

cd /
wget http://buffalo.nas-central.org/download/Users/goat/micro_evtd-20080531.tar.gz
tar xvzpf micro_evtd-20080531.tar.gz
rm micro_evtd-20080531.tar.gz

Next, update the package lists and install sshd so that you can access the Pro over the network after the install is done, and udev, the dynamic /dev manager:

apt-get update
apt-get install ssh udev
invoke-rc.d ssh stop

If you have a serial cable attached and wish to login via that, open /etc/inittab and ensure it has a line that looks like:

T0:23:respawn:/sbin/getty -L ttyS0 115200

Finally, change the root password, set the hostname for the next boot, exit the chroot, unmount the disk, and reboot. Your new system is ready!

passwd
echo 'LS-GL' > /etc/hostname
exit
umount /mnt/disk1/proc /mnt/disk1
reboot

On reboot, it probably is a good idea to turn recommends off.

as root do -- 
echo "APT::Install-Recommends 0;" >/etc/apt/apt.conf.d/99recommends



Then you will need the following.

  1. A BACKUP OF THE DATA PARTITION - No one but you can be blamed if your data is destroyed and there isn't a backup.
  2. BACKUP OF the WORKING /boot partition (files).
  3. The debootstrapped debian armel lenny tar file you made (or other method of storing it).
  4. Enough free disk space to place the new rootfs on.
  5. micro_evtd-20080531.tar.gz There is a debian package of this, but it needs to be configured from the last time i looked at it.
  6. be able to get into and out of safe mode.
  7. The files listed, below .
  8. I suggest you give the root filesystem 2GB or the larger 5GB as stated above. For a linkstation 2gb should be fine. However, it is probably safer to give it 5GB.


My hard is paritioned disk looks like this. I am using ext3 for my data and rootfs file systems.

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          37      297171   83  Linux
/dev/sda2              38         281     1959930   83  Linux
/dev/sda4             282       38913   310311540    f  W95 Ext'd (LBA)
/dev/sda5             282         318      297171   82  Linux swap / Solaris
/dev/sda6             319       38913   310014306   83  Linux

See the custom partitions page for how to get this kind of a setup; it's referenced in the Prerequisites section above.)

My Fstab looks like 
# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>               <dump>  <pass>
proc            /proc      proc    defaults                            0 0
#none            /dev/pts   devpts  gid=5,mode=20                      0 0
tmpfs           /tmp       tmpfs   size=10M,mode=1777                  0 0
/dev/sda1       /boot      ext3    defaults,noatime                    1 2
/dev/sda2       /          ext3    defaults,noatime,errors=remount-ro  0 1
/dev/sda5       none       swap    sw                                  0 0
/dev/sda6       /mnt/disk1 ext3,acl defaults,noatime,nodiratime        0 0

(you may not want nodiratime)


Files required

Use the following links to collect the files separately:

md5sum 885b1b61f0f00a9459c434dd47ef32f5  
sha1sum ac844bd0c7bdab225b846b57a407a53cc74437ea 
sha256sum 9281ab4ade3139d4dbc7e1b2c87f226f000641092f5c4bd047b5534959161ca2 
  • A new kernel and modules.

lb_worm's image does not require to change the bootloader, but there is no kernel with that image. Take a kernel from one of davy_gravy's packages, such as the 2.6.26 kernel in this package.

2.6.26-update_full_debian.tar
md5sum a0baf324b0f42a29e43600c585d8432e
sha1sum 235a51ef316f716332016f1cb050ee4f56024c6c
sha256sum dd6a3c20fc01dca452e553fb54bb48a2bbd654c60f1afd1d28c7684d1faac0df

Check sums for uImage-2.6.26 contained in the above tar, should you wish to check that alone. 
md5sum a2ec665585d248ba63fb043f6d59ae37
sha1sum 2ffc50231d4141bcbb1d82d6b1504fe1411acb2b
sha256sum 9c86038c3cf48d2667d62bdaabe3b745ea050eb86710c732cd15c91af80610da



OR

Download everything the lenny_REQ.tar archive:

Note: This file should be treated with caution as the checksums below don't match either the archive, or any of the files contained in it. Unless the original poster fixes the file or the checksums it would be prudent to source the required files from the other links. However, the file uImage-2.6.26 within the tar archive does match the one linked above, so it may just be an cut & past error.

--Chilledrat 17:33, 20 March 2012 (UTC)

lenny_REQ.tar 
*lenny_REQ.tar 
md5sum c3bfb83fdeeb7020d6644af11245a1cf
sha1sum 5cb463e7ee6861d4d862546fc3f34e02fc60b0b4
sha256sum lenny_REQ.tar f6044746e9dec3c42fc9fb013193aabaa8fe320504a9714b0077f9713a981420

Once you have all of this.

Reboot / get into EM mode. I suggest you copy the files to another computer (so you can pick up the pieces). Rename the boot_options to the correct name, rename initrd.buff... to the correct name remove the link from the current kernel to the uImage2.6.26 (2.6.26 kernel). mount /dev/sda2 untar the lenny armel tar / other file / files to it. extract the modules.tar / modules to /lib/modules (move to the appropriate place).

Reboot. And hope it works ! Oh and if you find that the linkstation is rebooting and beeping you can disable the watchdog microapl -a system_set_watchdog 255 . Others have reported that decreasing or turning off the polling will also fix the problem.