Installing Debian as an upgrade: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Build 561 doesn't actually have enough of the right bits for us.)
(Update debian install instructions for build 612.)
Line 1: Line 1:
These instructions assume you are starting from build 562 or later, which has support for booting from multiple images.
These instructions assume you are starting from build 612 or later, which has support for booting from multiple images. (This started working some time prior to build 612, but I can't be bothered to look up the exact build right now.)


Now, boot into sugar. You are currently running from the system in /versions/run/<build number>, which is a copy-on-write mirror of /versions/pristine/<build number>. We're going to install debian in /versions/pristine/debian. (See [[Early Boot]] for details on the OS versioning scheme.)
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==
==Step 1: Create debian bootstrap==
Line 22: Line 20:
==Step 2: Install debian bootstrap==
==Step 2: Install debian bootstrap==
From the XO, log in as root on console. Insert usb key.
From the XO, log in as root on console. Insert usb key.
# cd /versions/run
# cd /versions/pristine
# /bin/rm -rf b ; mkdir b ; cd b
# mkdir debian ; cd debian
# tar xzf /media/*/xo-debian.tgz
# tar xzf /media/*/xo-debian.tgz
# cp /etc/{hosts,fstab} /versions/run/b/etc/
# cp /etc/{hosts,fstab} /versions/pristine/debian/etc/
# cp -r /lib/modules/* /versions/run/b/lib/modules
# cp -r /lib/modules/* /versions/pristine/debian/lib/modules
# cp -r /lib/firmware /versions/run/b/lib
# cp -r /lib/firmware/* /versions/pristine/debian/lib/firmware
# mkdir -p /versions/run/b/{versions,security,var/cache/apt/cache}
# mkdir -p /versions/pristine/debian/{versions,security,var/cache/apt/cache}


You also need to use the fix at [http://osdir.com/ml/linux.debian.devel.handheld/2005-12/msg00003.html] to make apt work. Use vi or nano to edit files. The fix from the link is quoted below, with some edits and paths adjusted appropriately:
You also need to use the fix at [http://osdir.com/ml/linux.debian.devel.handheld/2005-12/msg00003.html] to make apt work. Use vi or nano to edit files. The fix from the link is quoted below, with some edits and paths adjusted appropriately:
:Note: to get around the apt-get jffs2/mmap [http://lists.debian.org/debian-handheld/2003/03/msg00000.html issue], I added the following line to /versions/run/b/etc/fstab:
:Note: to get around the apt-get jffs2/mmap [http://lists.debian.org/debian-handheld/2003/03/msg00000.html issue], I added the following line to /versions/pristine/debian/etc/fstab:
tmpfs /var/cache/apt/cache tmpfs defaults 0 0
tmpfs /var/cache/apt/cache tmpfs defaults 0 0
:and created /versions/run/b/etc/apt/apt.conf.d/00-tmpfs-cache with:
:and created /versions/pristine/debian/etc/apt/apt.conf.d/00-tmpfs-cache with:
Dir {
Dir {
Cache "var/cache/apt/" {
Cache "var/cache/apt/" {
Line 41: Line 39:
};
};
: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).
: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).

Make this the new alternate OS!
# cd /versions/boot
# rm -rf alt
# ln -s /versions/pristine/debian alt


==Step 3: Boot into Debian!==
==Step 3: Boot into Debian!==

Revision as of 20:02, 2 October 2007

These instructions assume you are starting from build 612 or later, which has support for booting from multiple images. (This started working some time prior to build 612, but I can't be bothered to look up the exact build right now.)

Now, boot into sugar. You are currently running from the system in /versions/run/<build number>, which is a copy-on-write mirror of /versions/pristine/<build number>. We're going to install debian in /versions/pristine/debian. (See Early Boot for details on the OS versioning scheme.)

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

If you don't have a debian system, download a prebuilt xo-debian.tgz here.

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 /versions/pristine
# mkdir debian ; cd debian
# tar xzf /media/*/xo-debian.tgz
# cp /etc/{hosts,fstab} /versions/pristine/debian/etc/
# cp -r /lib/modules/* /versions/pristine/debian/lib/modules
# cp -r /lib/firmware/* /versions/pristine/debian/lib/firmware
# mkdir -p /versions/pristine/debian/{versions,security,var/cache/apt/cache}

You also need to use the fix at [1] to make apt work. Use vi or nano to edit files. The fix from the link is 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/pristine/debian/etc/fstab:
 tmpfs   /var/cache/apt/cache  tmpfs defaults 0 0
and created /versions/pristine/debian/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).

Make this the new alternate OS!

# cd /versions/boot
# rm -rf alt
# ln -s /versions/pristine/debian alt

Step 3: Boot into Debian!

Shutdown your XO, then take out your usb key. 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

(The modprobe command is unnecessary if udev did it's job. You might look at the output to 'lsmod' to check that it's loaded.)

Step 5: Install fun stuff

For example:

# apt-get update
# apt-get install emacs

(aptitude will pull in 'suggests' dependencies, which will bloat your system. use apt-get instead.)

# apt-get install gnome-terminal gdm xserver-xorg-video-fbdev xorg metacity xterm gnome-core

(Don't worry too much about the xserver config -- just take the defaults, we'll fix it in a second.)

# apt-get remove xfonts-75dpi xserver-xorg-input-wacom

Now download [2] and copy it to /etc/X11/xorg.conf.

You'll probably want to use 'adduser' to add a user to the system, too. Reboot and voila! Graphical goodness.