Debian Installation on Kindle Touch

From MobileRead
Jump to: navigation, search

Contents

[edit] Things to consider

While these instructions largely apply to other Kindles and Linux distributions, the Kindle Touch's kernel (2.6.31) is very old. The most recent version of Debian confirmed to work with this kernel is Squeeze (6). Later versions will error out with FATAL: KERNEL TOO OLD on startup. Similarly Alpine's busybox will throw a Segmentation fault if it is too new.

There have been reports of lock-ups when the image is mounted from /mnt/us, especially during installation of the image or later when using apt. Mount from /mnt/base-us instead (this seems to be safe as long as userstore is not used as USB drive - so don't connect your Kindle to a computer while the mount is active unless you know what you're doing. Another option would be to Repartition the Kindle).

[edit] Setting up Base Image

[edit] File system

Because the Kindle's default file system doesn't allow symlinks, we need to create a file system that does and later mount it. While the Kindle theoretically supports ext4, ext3 appears to be better supported.

count decides how many megabytes the image will be created with.

dd if=/dev/zero of=/tmp/debian.ext3 bs=1M count=1280
mkfs.ext3 /tmp/debian.ext3
tune2fs -i 0 -c 0 /tmp/debian.ext3
mount -o loop -t ext3 /tmp/debian.ext3 /mnt/debian

[edit] Bootstrapping Debian

debootstrap --verbose --arch=armel --variant=minbase --foreign squeeze /mnt/debian http://archive.debian.org/debian

Later, when you are on Kindle and when you have set up the chroot environment you have to start the second stage of the base installation:

debootstrap --second-stage

If your computer also runs on the armel architecture (unlikely), you can remove the --foreign flag from debootstrap and skip the --second-stage step.

The flag --variant=minbase significantly reduces the size of the debian installation. You can skip it to install more tools right away, but you can also install them later.

Transfer the image to your Kindle. If you have SSH access, this can be done using
scp /tmp/debian.ext3 ip_address_or_alias_of_kindle:/mnt/base-us/debian.ext3

[edit] Setup Chroot Environment

mount -o loop -t ext3 /mnt/base-us/debian.ext3 /mnt/debian
mount -o bind /dev /mnt/debian/dev
mount -o bind /dev/pts /mnt/debian/dev/pts
mount -o bind /proc /mnt/debian/proc
mount -o bind /sys /mnt/debian/sys
cp /etc/hosts /mnt/debian/etc/hosts
cp /etc/resolv.conf /mnt/debian/etc/resolv.conf

[edit] Finish Installation

Obtain shell and internet access on your Kindle, for example via Internet access for Kindle via USB.

Perform the second stage of debootstrap

debootstrap --second-stage

Congratulations, you now have a full Debian installation on your Kindle that you can chroot into!

[edit] Usage of Chroot Debian

[edit] Getting a Chroot Shell

chroot /mnt/debian /bin/bash

Once you added a user to the Debian system you can login with that user account:

chroot /mnt/debian /bin/login

[edit] Other options

In case you want to have access to userstore from debian execute before chrooting:

mount -o bind /mnt/us /mnt/debian/mnt/us

[edit] Tips

[edit] Resize image

count decides how many megabytes will be added to the image.

dd if=/dev/zero bs=1M count=1 >> debian.ext3
e2fsck -f debian.ext3
resize2fs debian.ext3

[edit] apt command

Squeeze is so old that it doesn't have the plain apt command. You can get it to feel a bit more at home by creating a symbolic link:

ln -s /usr/bin/apt-get /usr/bin/apt

[edit] mount: could not find any free loop device

The Kindle only has 8 available loop devices and they aren't automatically freed. Use losetup -d /dev/loop/7 to free a device (that isn't used for a currently mounted file system). This should be fine all the way down to 1. You can make sure it's not in use for anything important using mount.

[edit] Further reading

Personal tools
Namespaces

Variants
Actions
Navigation
MobileRead Networks
Toolbox