Installing Debian as an upgrade

From OLPC
Revision as of 17:56, 30 August 2007 by CScott (talk | contribs) (→‎Step 2: Install debian bootstrap: Make additional empty directories.)
Jump to navigation Jump to search

These instructions assume you are starting from build 559 or later, which has support for booting from multiple images.

Secondly, you must have enabled the upgradable stuff; at the moment this is done by booting with 'upgrade' on the kernel command line. Deep magic here; it will become less magic in the future.

Now, boot into sugar. You are currently running from the system in /versions/run/a, and /versions/run/b contains a mirror image of this. We're going to replace /versions/run/b with debian.

Step 1: Create debian bootstrap

From an existing debian system, as root (fakeroot won't work, sadly):

# apt-get install debootstrap
# mkdir mnt
# debootstrap --include=udev,wireless-tools etch mnt http://http.us.debian.org/debian/

Wait awhile. Eventually, you'll have a complete debian bootstrap system in mnt.

# tar -C mnt -czf xo-debian.tgz .
# /bin/rm -rf mnt

Put xo-debian.tgz on a usb key.

Step 2: Install debian bootstrap

From the XO, log in as root on console. Insert usb key.

# cd /run
# /bin/rm -rf b ; mkdir b ; cd b
# tar xzf /media/*/xo-debian.tgz
# cp /etc/hosts /versions/run/b/etc/hosts
# cp /etc/fstab /versions/run/b/etc/fstab
# cp -r /lib/modules/* /versions/run/b/lib/modules
# cp -r /lib/firmware /versions/run/b/lib
# mkdir -p /versions/run/b/{versions,security,var/cache/apt/cache}

You also need to use the fix at [1] to make apt work. Quoted below, with some edits and paths adjusted appropriately:

Note: to get around the apt-get jffs2/mmap issue, I added the following line to /versions/run/b/etc/fstab:
 tmpfs   /var/cache/apt/cache  tmpfs defaults 0 0
and created /versions/run/b/etc/apt/apt.conf.d/00-tmpfs-cache with:
 Dir {
  Cache "var/cache/apt/" {
   srcpkgcache "cache/srcpkgcache.bin";
   pkgcache "cache/pkgcache.bin";
  };
 };
Not exactly ideal, but it works for me. It will take apt a little while to rebuild the cache after you reboot, of course. I think you could achieve persistence by copying the files to/from the tmpfs either in startup/shutdown scripts, or maybe pre-/post-invocation hooks in apt (which might have the added benefit of being able to mount/unmount the tmpfs on demand).

Step 3: Boot into Debian!

Shutdown your XO. As documented at Cheat codes, reboot while holding down the 'O' key to switch to the alternate OS (debian!). Reboot again with 'O' pressed down to switch back later.

Step 4: Start networking

Just use ifconfig if you've got a supported wired ethernet adapter. To connect to an access point:

# modprobe usb8xxx
# iwconfig eth0 essid <your-access-point>
# dhclient eth0

Step 5: Install fun stuff

For example:

# apt-get update
# aptitude install emacs