NSLU2-Linux
view · edit · print · history

If you have a DS101g+, you have a PowerPC architecture which is supported in mainstream Debian. You can either replace the entire distribution with Debian or as the instructions here show you, run it all in a chroot jail and therefore not need to modify anything else.

Crossbuilding chroot

The standard way to install a Debian system on a non-Debian platform is to use debootstrap. Since it is most likely that you are not using a PowerPC platform, building the chroot-environment requires cross compilation.

Debootstrap is designed to be cross-platform'able but in my experience, you must run debootstrap on the target. Running debootstrap wants to chroot into the target and execute stuff even in cross-build mode which obviously won't work!

Aims of chroot

  • No flashing of the firmware required
  • No modification of stock system files required.
  • Sandbox-like environment on the DS101g+ with real production functionality!
  • Full access to over 16,000 debian packages within minutes

You need to have console access to the DS101g+ (with attached /volume1), which means one of the following:

The rest of this howto will refer to all types of access as using the console.

Lines beginning with ds# need to be executed on target DS101g+ console, while lines with leading pc$ are to be executed on your local PC.

Now we create folders for the Debian project and roots under project home.

pc$ mkdir -p ~/ds101g/debian/chroottarget
ds# mkdir -p /volume1/public/debian/chroottarget

From now on, all commands need to be executed in this directory!

pc$ cd ~/ds101g/debian
ds# cd /volume1/public/debian

Get debootstrap. Even if you intend to install sarge and stable, it is recommended that you use the newest version of the debootstrap script due to updates. For debian users:

pc$ wget http://ftp.de.debian.org/debian/pool/main/d/debootstrap/debootstrap_0.3.3.1_all.deb
pc$ dpkg --install debootstrap_0.3.3.1_all.deb

Execute debootstraps first stage to fetch all packages for the target platform:

pc$ debootstrap --foreign --arch powerpc sarge chroottarget "http://ftp.de.debian.org/debian"

Now we move this folder root to target...

pc$ tar -czf chroottarget.tar.gz chroottarget

Copy the tar file using your preferred method (SMB, NFS, SFTP etc...) to the target in /volume1/public/debian and untar.

ds# tar -xzf chroottarget.tar.gz

tar should not display any errors or warning like "convert sym links to ...". The best to transfert archive is to do it from the local PC under linux, not from windows.

Finish debootstrap second stage on target platform.

ds# chroot chroottarget /debootstrap/debootstrap --second-stage

Some things to configure before running chroot debian:

Make name resolving available

ds# cp /etc/resolv.conf chroottarget/etc/

Setup the hostname

ds# cp /etc/hostname chroottarget/etc/

Copy passwd, group shadow files

ds# cp /etc/passwd chroottarget/etc/
ds# cp /etc/shadow chroottarget/etc/
ds# cp /etc/group chroottarget/etc/

The minimal system setup is there and debootstrap can setup debian tools:

ds# chroot chroottarget /bin/bash
chroot-ds# mount -t proc proc /proc

Now configure debian completely (show dialogs) as you like. The base-system is already fully functional. E.g.

chroot-ds# base-config
chroot-ds# dpkg-reconfigure --priority low --all

And finally update and upgrade the apt repository

chroot-ds# apt-get update && apt-get upgrade

Now you have access to any debian package you want!

If you start any services now, they will be running within the jail. If you want certain services to autostart without requiring you to login then you must use chroot. Remember, any services running in the chroot jail is not able to access anything outside of the jail in the filesystem.

Example of how to run a service which starts within the jail:

ds# chroot /volume1/public/debian/chroottarget /bin/bash -c "mount -t proc proc /proc"
ds# chroot /volume1/public/debian/chroottarget /bin/bash -c "/etc/init.d/ssh start"

Already this is it! Chroot into the debian and work with it or just play around!

Have Fun! Miro Dietiker

view · edit · print · history · Last edited by czh.
Based on work by czh, tman, and Miro Dietiker.
Originally by Miro Dietiker.
Page last modified on December 20, 2006, at 07:19 PM