Installing Debian as an upgrade/script

From OLPC

Jump to: navigation, search

The following script, which only follows the instructions on Installing Debian as an upgrade, should install Debian on your XO. Just copy/paste it into a file on the XO, chmod +x, and run. I just tested it, and it worked. YMMV. It will stop midway if there is any error, including in the wget image download.

So in steps:
1. Highlight script below that starts with "#!/bin/bash ex ......." and copy (Ctrl+C)
2. Enter Terminal and become root by typing "su" and return.
3. Make a script file by typing "nano install-script", nano should launch, then
4. Paste the script into nano by clicking on the tab at the top of the Terminal Activity titled "Edit" and click on the right hand icon that has an arrow pointing down (Paste).
5. Exit and Save from nano with Ctrl+X, then selecting "y"
6. Then change the script file into an executable script file by typing: "chmod +x install-script"
7. Execute the script by typing "./install-script" and enter, kick back for awhile and watch it go.(~15 minutes or so? until it finally displays "bash-3.2#" or something ending in "...#"
(However I just ran it and it stopped at line 28, just after "+ chmod a+rx ........unfreeze.sh" perhaps because of excess spaces in the next command line)
(I got same error!)

By the way, it's totally unsafe to run code from a wiki like this without reading it.


#!/bin/bash -ex

tgz_url="http://dev.laptop.org/~cscott/xo-debian.tgz"

cd /versions/pristine
mkdir debian
cd debian

# wget -O- "$tgz_url" | tar xz
wget -q -O- "$tgz_url" | tar xvz

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}
rm -rf /versions/pristine/debian/boot
cp -r /boot /versions/pristine/debian

cat <<END > /versions/pristine/debian/etc/rcS.d/S00unfreeze.sh
#! /bin/sh
mount -t sysfs /sys /sys
echo 0 > /sys/devices/platform/dcon/freeze
umount /sys
END

chmod a+rx /versions/pristine/debian/etc/rcS.d/S00unfreeze.sh

echo 'tmpfs /var/cache/apt/cache tmpfs defaults 0 0' >> /versions/pristine/debian/etc/fstab 

cat <<END > /versions/pristine/debian/etc/apt/apt.conf.d/00-tmpfs-cache
 Dir {
  Cache "var/cache/apt/" {
   srcpkgcache "cache/srcpkgcache.bin";
   pkgcache "cache/pkgcache.bin";
  };
 };
END

cd /versions/boot
rm -rf alt
ln -s /versions/pristine/debian alt
cp -rl /versions/pristine/debian /versions/run/debian
/usr/sbin/setattr -R --iunlink /versions/run/debian
echo 'Debian is installed!  Reboot and hold down the game key labelled "O"'


  • Note: After Rebooting you must do the networking part
modprobe usb8xxx
iwconfig eth0 essid <your-access-point>
Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
Projects
OLPC wiki
Toolbox
In other languages