Installing Debian as an upgrade: Difference between revisions
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
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.) |
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.) |
||
Although more detail is on this page, these other instructions might be more appropriate for newer systems: [[Debian Jessie on XO]] |
|||
Note that you require a [[Developer key]] to run unsigned operating systems. |
Note that you require a [[Developer key]] to run unsigned operating systems. |
||
Line 82: | Line 84: | ||
Log in as root when debian prompts; no password. |
Log in as root when debian prompts; no password. |
||
:If for some reason this doesn't work for you (it didn't for one anonymous user, on version 650), you can do this manually from |
:If for some reason this doesn't work for you (it didn't for one anonymous user, on version 650), you can do this manually from [[Open Firmware]] (of course you'll need a devkey for this, to get one go to file:///home/.devkey.html). Once you have a devkey, hit "esc" (upper left) when it says to, to get into OF. |
||
:As of 28 May, user:olpc, pass:olpc works, and root,<blank> does not |
:As of 28 May, user:olpc, pass:olpc works, and root,<blank> does not |
||
Line 98: | Line 100: | ||
(however "setenv" needs to be "set env ..." in build 766) |
(however "setenv" needs to be "set env ..." in build 766) |
||
:To boot to the default os with this method, just don't enter |
:To boot to the default os with this method, just don't enter Open Firmware, or just type boot at the OF prompt. |
||
==Step 4: Start networking== |
==Step 4: Start networking== |
Latest revision as of 14:19, 20 August 2020
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.)
Although more detail is on this page, these other instructions might be more appropriate for newer systems: Debian Jessie on XO
Note that you require a Developer key to run unsigned operating systems.
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.)
- Note that in recent builds, you can magically get to the results of step 3 below by typing:
# /usr/sbin/olpc-update debian
- To get the results of step 5, you can type:
# /usr/sbin/olpc-update debian-big
- or
# olpc-update debian/debian-big (note: this does not seem to work anymore, dustinlw1987 2009-01-28)
Shell script alternative
I have created a shell script which automates all steps 1 and 2. All you have to do is put it on the OLPC and run it. However, it is totally unsafe to run software downloaded from a wiki in this way. I could have put all manner of evil in it. So read it first. --65.75.18.227 00:59, 16 December 2007 (EST)
The script: Installing Debian as an upgrade/script
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. But you need to clean up udev's "persistent network" a bit, since the XO doesn't have the same devices as the debian machine you used to bootstrap:
# rm mnt/etc/udev/rules.d/z25_persistent-net.rules # touch mnt/etc/udev/rules.d/z25_persistent-net.rules
Now package up your work:
# 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 flash drive.
Step 2: Install debian bootstrap
From the XO, log in as root on console. Insert USB flash drive.
# 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/{ofw,versions,security,var/cache/apt/cache} # rm -rf /versions/pristine/debian/boot # cp -r /boot /versions/pristine/debian
Add a new file /versions/pristine/debian/etc/rcS.d/S00unfreeze.sh:
#! /bin/sh mount -t sysfs /sys /sys echo 0 > /sys/devices/platform/dcon/freeze umount /sys
and ensure that it is executable
# chmod a+rx /versions/pristine/debian/etc/rcS.d/S00unfreeze.sh
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 # cp -rl /versions/pristine/debian /versions/run/debian # /usr/sbin/setattr -R --iunlink /versions/run/debian
Step 3: Boot into Debian!
Shutdown your XO, then remove your USB flash drive from the XO. As documented at Cheat codes, reboot while holding down the 'O' game pad key to switch to the alternate OS (debian!). (Use "triangle" instead if you've got a B3 or older machine.) Reboot again with the 'O' game pad key pressed down to switch back later.
Log in as root when debian prompts; no password.
- If for some reason this doesn't work for you (it didn't for one anonymous user, on version 650), you can do this manually from Open Firmware (of course you'll need a devkey for this, to get one go to file:///home/.devkey.html). Once you have a devkey, hit "esc" (upper left) when it says to, to get into OF.
- As of 28 May, user:olpc, pass:olpc works, and root,<blank> does not
- In build 766, Login: root (no password option is given and you are in after typing "root"
- The last OS you booted (currently the OLPC one) will be in nand:\boot, and the "alternate" OS (currently Debian) will be in nand:\boot-alt
- To boot to the alternate os, type:
# setenv boot-file ro root=mtd0 rootfstype=jffs2 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22 # setenv boot-device nand:\boot-alt\vmlinuz # setenv ramdisk nand:\boot-alt\olpcrd.img
(however "setenv" needs to be "set env ..." in build 766)
- To boot to the default os with this method, just don't enter Open Firmware, or just type boot at the OF prompt.
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>
(if you use WEP encryption, it worked for me with the following:)
# iwconfig eth0 key "s:mykey"
(where mykey is your key. For hex leave the s: part out.) --Sebastian 12:17, 15 April 2008 (EDT)
# 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.)
One user says:
- You should also be able to use wifi, my WPA network works fine, once I installed a wpa_supplicant deb from my USB flash drive. iwconfig also sees the mesh device, but I have let to test if it works. One weirdness: my wifi interface is eth5!
Step 5: Install fun stuff
For example:
# apt-get update # apt-get install emacs
(aptitude will pull in "recommended" dependencies, which will bloat your system. use apt-get or go to "Options->Dependency Handling" and uncheck "Install Recommended packages automatically" instead. If you'd rather use aptitude from the command line, you can use the option -R or --without-recommends.)
- For Gnome
# apt-get install gnome-terminal gdm xserver-xorg-video-fbdev xorg metacity xterm gnome-core
- For XFCE (must install Step 5 above ("apt-get update" and emacs first):
# apt-get install xserver-xorg-video-fbdev xorg metacity xterm xfce4
(Don't worry too much about the xserver config -- just take the defaults, we'll fix it in a second.)
# apt-get remove --purge xfonts-75dpi xserver-xorg-input-wacom xserver-xorg-input-synaptics
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. The 'olpc' user will be handy:
# addgroup --gid 500 olpc # adduser --uid 500 --gid 500 olpc
Reboot and voila! Graphical goodness.
Some user say:
- I had some troubles getting this to work. In order to get X to work, I used these instructions.
- It worked fine for me, but GNOME is too big for a 1GB Nand.
XFCELXDE[3] is more suitable in my opinion. - before you reboot, add a password to root (passwd root), otherwise you will not get into the GUI. Markb 02:05, 15 June 2008 (EDT)
Trivia
The instructions above work ok on a 653 build XO, with the system booting successfully into Debian. In case it wasn't obvious, the system will continue to 'boot alternate' until you switch back to the XO os by once again hitting the 'o' game key while powering up.
Following these instructions one user had to add the write permission for others for /tmp. It was a upgrade from a standard 650 build the default sugar build umask is read+execute for others. Then I could login to the gui.
To preserve this alternate boot even when you olpc-update the main partition, you'll want to do something like:
# HASH=$(basename $(readlink /versions/running)) # touch /versions/sticky/$HASH
when you're booted into debian. olpc-update will also report the hash if you use the olpc-update method; otherwise following the instructions above the HASH is 'debian'.
If your network device is named something like eth5 and you prefer eth0, empty the file "/etc/udev/rules.d/z25_persistent-net.rules" and reboot. The network devices should be redetected.
# mv '/etc/udev/rules.d/z25_persistent-net.rules' '/etc/udev/rules.d/z25_persistent-net.rules.old' # touch '/etc/udev/rules.d/z25_persistent-net.rules' # reboot
See also
- The same basic process also works for Edubuntu
- DebXO
- Fedora on XO
- Sugar on Debian to run Sugar on top of a standard Linux desktop