Difference between revisions of "LS Pro Debootstrap Howto"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
(added info to get it working)
(adding / chopping to make it clearer and easier)
Line 81: Line 81:
  
  
Follow @evo's instructions but use your rootfs instead of davy's. I have followed this guide and it works ^^
+
--------------------------------
 +
==Then you will need the following. ==
 +
 +
*DATA BACKUP - NO ONE BUT YOU CAN BE BLAMED IF YOU FORMAT, MOVE, LOOSE OR DESTROY DATA AND DO NOT 
 +
HAVE A BACKUP.  
  
"@evo
+
* The debootstrapped debian armel lenny tar file you made (or other method of storing it).
I installed lenny and the new kernel directly on a new harddisk without any changes to Uboot.
+
* Enough free disk space to place the new rootfs on.
I would reccomend not to play around with the bootloader.
+
* 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 below.
 +
* I suggest you give the root filesystem 2GB.  
  
lb_worm's image does not require to change the bootloader, but there comes no kernel with that image. So take a kernel from one of davy_gravy's packages.
+
My hard is paritioned  disk looks like this. I am using ext3 for my data and rootfs file systems.
  
What i did to install lenny and a new kernel on my linkstation live:
+
  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
  
- install the new HD to your desktop PC (disconnect all the other drives)
+
See the custom partitions page for how to get this kind of a setup.
- start Linux from Live CD (e.g. Knoppix or Parted Magic Live CD: http://buffalo.nas-central.org/index.ph ... ic_live_cd)
+
 
- open GParted (with knoppix you have to change the blank root password before)
+
My Fstab looks like
- delete all existing partitions on the drive
+
# /etc/fstab: static file system information.
- make new partitions:
+
# <file system> <mount point>  <type>  <options>              <dump>  <pass>
- sda1: about 100MB format to ext3
+
proc            /proc      proc    defaults                            0 0
- sda2: about 8 GB format to ext3
+
#none            /dev/pts  devpts  gid=5,mode=20                      0 0
- sda4: extended
+
tmpfs          /tmp      tmpfs  size=10M,mode=1777                  0 0
- sda5 (below sda4): 500MB Linux swap
+
/dev/sda1       /boot      ext3   defaults,noatime                    1 2
- sda6 (below sda4): all the rest size format to JFS
+
/dev/sda2       /          ext3   defaults,noatime,errors=remount-ro  0 1
- do not use any XFS-Filesystem, the newer kernels have problems with that on ARM, my Linkstation didn't boot with xfs
+
/dev/sda5       none      swap   sw                                  0 0
- download: http://buffalo.nas-central.org/download ... _24.tar.gz
+
/dev/sda6       /mnt/disk1 ext3,acl defaults,noatime,nodiratime        0 0
- unzip the archive to the sda2 partition
+
- copy the file boot_options and initrd.buffalo from here http://buffalo.nas-central.org/download ... l%20Lenny/ to the sda 1 partition
+
(you may not want nodiratime)
- create blank files linkstation_release, hddrootmode and rootfs_ok at sda1 (i copied the old files from the former linkstation hdd)
+
- download davy_gravy's image (i used version 0.3, the newer kernel should work as well, but i haven't tested)
+
- go to directory /boot in davy gravy's tgz file
+
 
- there is a file called uImage-<kernelversion>
+
 
- copy this file to sda1 and rename it to uImage.buffalo
+
 
- go to the /lib/modules directory in the tgz file
+
 
- there is a directory named like the kernelversion (for example 2.6.25.6)
+
 
- copy this directory (with all subdirectorys) to /lib/modules on sda2, so that it looks like /lib/modules/2.6.25.6
+
 
- on sda2 have a look at /etc/network/interfaces to configure it to your needs
+
Files required
- install the new drive to your linkstation
+
 
- it should boot up
+
Either get them this way or download them from ---
- make a ssh connection and run depmod -a
+
*1 [http://buffalo.nas-central.org/download/ALL_ARM9/ARMel%20Lenny/ lb_worm's new initrd / image. ]
- Have fun with it!"
+
md5sum 885b1b61f0f00a9459c434dd47ef32f5 
 +
sha1sum ac844bd0c7bdab225b846b57a407a53cc74437ea
 +
sha256sum 9281ab4ade3139d4dbc7e1b2c87f226f000641092f5c4bd047b5534959161ca2
 +
 
 +
 
 +
*2 [http://buffalo.nas-central.org/download/Users/davy_gravy/kernelpackages/2.6.26-
 +
update_full_debian.tgz You should use a  a new kernel (2.6.26)]
 +
 
 +
uImage-2.6.26
 +
md5sum a2ec665585d248ba63fb043f6d59ae37
 +
sha1sum 2ffc50231d4141bcbb1d82d6b1504fe1411acb2b
 +
sha256sum 9c86038c3cf48d2667d62bdaabe3b745ea050eb86710c732cd15c91af80610da
 +
 
 +
 
 +
 
 +
*3 modules from the kernel. (get from either the bundle i have made or from davey's lenny distribution).
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
lb_worm's image does not require to change the bootloader, but there comes no kernel with that
 +
image. So take a kernel from one of davy_gravy's packages.
 +
 
 +
-------------------------------

Revision as of 06:05, 24 October 2008

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. ==

*DATA BACKUP - NO ONE BUT YOU CAN BE BLAMED IF YOU FORMAT, MOVE, LOOSE OR DESTROY DATA AND DO NOT  
HAVE A BACKUP. 
* 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 below.
* I suggest you give the root filesystem 2GB. 
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.
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 
Either get them this way or download them from ---
*1 lb_worm's new initrd / image.  
md5sum 885b1b61f0f00a9459c434dd47ef32f5  
sha1sum ac844bd0c7bdab225b846b57a407a53cc74437ea 
sha256sum 9281ab4ade3139d4dbc7e1b2c87f226f000641092f5c4bd047b5534959161ca2 


*2 [http://buffalo.nas-central.org/download/Users/davy_gravy/kernelpackages/2.6.26-
update_full_debian.tgz You should use a   a new kernel (2.6.26)]
uImage-2.6.26 
md5sum a2ec665585d248ba63fb043f6d59ae37
sha1sum 2ffc50231d4141bcbb1d82d6b1504fe1411acb2b
sha256sum 9c86038c3cf48d2667d62bdaabe3b745ea050eb86710c732cd15c91af80610da


*3 modules from the kernel. (get from either the bundle i have made or from davey's lenny distribution). 




lb_worm's image does not require to change the bootloader, but there comes no kernel with that  
image. So take a kernel from one of davy_gravy's packages.