Olpc-update: Difference between revisions
(Add 'before you begin' warnings.) |
m (tweak grammar of summary sentence) |
||
(287 intermediate revisions by 81 users not shown) | |||
Line 1: | Line 1: | ||
{{Translations}} |
|||
{{TOCright}} |
{{TOCright}} |
||
{{Developers}} |
|||
[[olpc-update]] is a command-line program to update your system software. It preserves your [[Journal|files (journal)]] and [[activities]] you have installed. |
|||
==Before you begin== |
|||
This page describes how to update the software image on your laptop. You can either update over the network, or from a USB flash key or disk. <font color=red>You must be using a B3 machine or better, and an update.1 build or better.</font>. If you've got an older machine, use the old [[Autoreinstallation image]] instructions. If you're running build 650 or better, you can use these instructions to upgrade over the network, but not from a USB key. |
|||
olpc-update can download the new version from the internet, or from a file on a [[USB drive]]. See [[Updating the XO]] for other update scenarios. |
|||
If you want to wipe out your journal and all content you've generated and restore your machine to a pristine state, please use the [[Activated Upgrade]] instructions. |
|||
The old software version is erased the first time the new version is booted, but this can be prevented. |
|||
== Quick Start == |
|||
(Certain really old builds, like 656, can't olpc-update to recent builds. Check the release notes of a recent build to find out if olpc-update can be used from a really old build. If not, then you must install the recent build afresh.) |
|||
{{Latest Releases | devel = inline}} |
|||
== What version do I have now? == |
|||
First, identify which build to which you want to update your system. |
|||
To tell what version of the system software you have, follow [[How to check the OS and firmware versions]]. |
|||
To use the olpc-update script to upgrade (or to downgrade!),: |
|||
== Disk space requirements == |
|||
First, run |
|||
Due to its fail-safe design, olpc-update must store all of the changed files in the release that you are updating to, alongside the existing release that you are running, for a short time. olpc-update cannot complete if there is not enough disk space available. |
|||
* rsync rsync://updates.laptop.org | sort |
|||
If upgrading between minor releases within the same release series or between development releases in the same development stream, the space required will be low. However, if upgrading from one major release to another (e.g. [[10.1.3]] to [[11.2.0]]), you will probably need more than 300mb of disk space available (even though the upgrade process will finish with approximately the same amount of disk space available). |
|||
<pre> |
|||
# rsync rsync://updates.laptop.org | sort |
|||
build-612 |
|||
build-616 |
|||
build-617 |
|||
build-debian |
|||
build-debian-big |
|||
build-frs |
|||
build-joyride-53 |
|||
build-joyride-56 |
|||
build-joyride-58 |
|||
build-joyride-59 |
|||
build-joyride-66 |
|||
build-joyride-67 |
|||
build-joyride-68 |
|||
build-joyride-76 |
|||
build-meshtest |
|||
build-meshtest-47 |
|||
build-meshtest-56 |
|||
build-meshtest-73 |
|||
build-meshtest-74 |
|||
</pre> |
|||
== How to upgrade == |
|||
To find the builds available, and make sure that you are connected to the server. Then, run |
|||
See the [[Releases]] page for the releases that are available. The release notes for each recent release will explain exactly how to use olpc-update to update to that particular version. Be sure to read the release notes before starting the update. |
|||
: olpc-update <build-no> |
|||
The instructions below are generic. |
|||
where <build-no> is the number of the build (e.g. 610, 588) to which you would like to move, e.g., |
|||
=== Simple online update === |
|||
Note: You should always back up important files; e.g., to a USB drive or to a school server before updating, just in case. |
|||
</noinclude><includeonly>:''Main article: [[olpc-update]]''<p></includeonly>'''olpc-update''' is designed to work with even the worst internet connections, and will do no harm if it is interrupted during download. It will resume from where it left off, without having to download what it has already downloaded. |
|||
or |
|||
To manually upgrade your machine when a new version is released: |
|||
olpc-update joyride-74 |
|||
# Plug the XO into an electrical outlet |
|||
or |
|||
# [http://www.laptop.org/en/laptop/start/connecting.shtml Connect to the internet]. If you are upgrading because you have a WPA [[hotspot]] at home, you might want to go to a [[hotspot#Public Hotpots|Public Hotspot]] to connect to the internet for an online upgrade, such as a [[T-Mobile]] hotspot or a local libary. <br>Firewall note: olpc-upgrade requires outgoing TCP PORT:873 to be unfiltered by the hotspot's firewall. In otherwords if the laptop has functional-access to the internet but olpc-upgrade returns the message "I don't think you're connected to the internet." check the hotspot's firewall is not blocking the outgoing TCP Port 873. |
|||
# Start the '''[[Terminal Activity]]''' [[Image:Activity-terminal.svg|35px]] (or if you cannot do so, open a [[console]]) and type the following (press the Enter key after it): |
|||
olpc-update |
sudo olpc-update ''build-identifier'' |
||
The ''build-identifier'' is normally identified on the [[Releases|release notes]] of the release you are upgrading to. Historically, build identifiers were simple numbers (e.g. 802), for newer builds prefixes are used to separate between the different laptop models (e.g. 10.1.3_xo1.5-860). |
|||
Finally, the update mechanism preserves the build from which you ran the updater as an "alternate" image from which you can boot. To swap the "primary" and "alternate" images, hold the 'O' gamepad key during bootup. |
|||
If you get an error saying "command not found", type "su -", press enter and then "olpc-update ''build-identifier''" and press enter. For example: |
|||
su - |
|||
/usr/sbin/olpc-update 802 |
|||
If olpc-update successfully connects to the update server, some messages should display |
|||
== More information == |
|||
This method of updating from one operating system (OS) build to another is experimental. It works by transferring only the differences across the internet link from an updates server. This makes updating easier, mostly quicker, and almost always with less data transfer. |
|||
Downloading contents of build ''build-identifier'' |
|||
As an example of the data efficiency gain, |
|||
Updating to version hash ''xxxx'' |
|||
*An autoreinstallation from OS build 602 to 603 would normally take about 279Mb of download data, whereas ''olpc-update'' takes 16Mb of download data, |
|||
Making clean /versions/updates/... |
|||
*An autoreinstallation from OS build 603 to 608 would normally take 262Mb of download data, whereas ''olpc-update'' takes 6.5Mb of download data, |
|||
Trying irsync_pristine update from rsync://updates.laptop.org/build-''build-number'' |
|||
*An ''olpc-update'' from OS build 602 to 625 takes 33Mb of download data. |
|||
- Cleaning tree. |
|||
- Fetching contents. |
|||
- Performing incremental rsync. |
|||
Verifying update. |
|||
Installing update in /versions/{pristine,run}/''xxxx'' |
|||
Where ''xxxx'' is a version-specific number. |
|||
The time efficiency gain is less easy to characterise. It depends on the speed of the internet link, the speed of the updates server, and whether the autoreinstallation image needs to be downloaded. An ''olpc-update'' from 602 to 603 cost under 17 minutes. |
|||
The olpc-update program uses several methods to update. If "irsync_pristine" fails, it will try "irsync dirty update", and then try "Performing full rsync". As long as the last method completes without errors, you're fine. |
|||
The current updates server is updates.laptop.org. |
|||
This process may take more than thirty minutes. |
|||
When the process is complete, you need to [[reboot]], unless you supplied the <code>-r</code> option to <code>olpc-update</code>. |
|||
== Usage == |
|||
If the new build includes newer [[firmware]], then your XO will reboot twice. |
|||
When the XO restarts the update will be complete. |
|||
After updating, you should run the Sugar activity updater from the control panel. If not, you may find that various activities are not working. |
|||
In summary: |
|||
===Simple offline update=== |
|||
*Be connected to the internet, |
|||
*Log in as root, |
|||
*Type ''olpc-update NNN'' where NNN is the build number, |
|||
*Wait for the update to complete, |
|||
*Reboot. |
|||
Unless you are running a very old release, you can also download the new release data onto a USB disk from an internet-connected computer, and then use olpc-update on an XO to perform the update, without requiring any internet connection. |
|||
=== Be Connected === |
|||
==== Prepare a USB drive ==== |
|||
Ensure the laptop or the emulator is able to access the internet, by being connected an an access point, or via the mesh, or using an ethernet connection. |
|||
Your USB drive needs to be writable from the computer on which you'll download the files, and readable from a running XO (as <tt>/media/''YourDriveName</tt>). |
|||
=== Be Root, with correct Environment Variables === |
|||
*(Note that ''/media'' changes to ''/run/media/olpc'' for Fedora 17 based builds used in 12.1.0 and later). |
|||
From the Sugar Developer's Console: |
|||
==== Download .usb and .toc files onto USB ==== |
|||
Insert a USB drive into a computer connected to the Internet. |
|||
Go to the download.laptop.org site to fetch the [http://download.laptop.org/xo-1/os/official/ latest XO-1 release] or the [http://download.laptop.org/xo-1.5/os/official/ latest XO-1.5 release]. You need to download two files from the build's directory to the top directory of your USB drive: '''<code>os''NNN''.usb</code>''' and '''<code>os''NNN''.toc</code>''', where ''NNN'' is the numeric part of the build you are updating to. For example, if you are updating to build 711, the files would be named <code>os711.usb</code> and <code>os711.toc</code>; if you are updating to build joyride-1452, the files would be named <code>os1452.usb</code> and <code>os1452.toc</code>. |
|||
$ su - |
|||
Right-click (Ctrl-click for Mac) on each of the two names and choose "Save Target As" ("Save Link As" for Firefox). Save both files to the USB drive. Do not open the files. |
|||
# whoami |
|||
root |
|||
==== USB update ==== |
|||
From SSH or the Virtual Terminal: |
|||
# Plug the XO into an electrical outlet |
|||
# whoami |
|||
# Insert your USB drive with the <tt>.toc</tt> and <tt>.usb</tt> files on it into your XO. |
|||
root |
|||
# Start the [[Terminal activity]] (or if you cannot do so, open the [[console]]), and enter: |
|||
sudo /usr/sbin/olpc-update --usb |
|||
If you get "command not found" errors, enter: |
|||
=== Run olpc-update === |
|||
su - |
|||
/usr/sbin/olpc-update --usb |
|||
When olpc-update is finished, [[reboot]] to start using your new build. |
|||
Normally you only need to run ''olpc-update'' with a build number, like this: |
|||
== Retention of previous versions == |
|||
# olpc-update 613 |
|||
As of release [[11.2.0]], olpc-update only keeps 1 software version available by default (i.e. the old version is deleted after booting into the new version for the first time). |
|||
There are other options. For example: |
|||
Older releases maintained two versions ("primary" and "alternate"), so that you could switch between the two (accepting any strange side effects caused by a software downgrade, not really supported by OLPC or the software that it ships). |
|||
# olpc-update --help |
|||
Usage: |
|||
Update to build-<id>: olpc-update [-r] [-s SERVER] <id> |
|||
Update to <url>: olpc-update [-r] -u <toc url> <tree url> |
|||
Find a target: olpc-update [-s SERVER] -l |
|||
Get a changelog: olpc-update [-s SERVER] -c <id> |
|||
Options: |
|||
--version show program's version number and exit |
|||
-h, --help show this help message and exit |
|||
-l, --list-targets show available update targets |
|||
-c, --changelog show changelog for build NUM |
|||
-s SERVER, --server=SERVER |
|||
override the rsync base url (e.g. rsync://my.server) |
|||
-u, --urls give raw contents-file and tree urls(e.g. |
|||
rsync://my.server) |
|||
-r, --reboot reboot after update |
|||
== Avoiding purge of previous versions == |
|||
== Update Targets == |
|||
You can avoid olpc-update from deleting old versions in any situation by marking them as sticky, e.g. for build 802: |
|||
There are several update targets available. There is usually one for each operating system build, and there are others for test builds and for Debian. To get a list of the available builds, use the command: |
|||
touch /versions/sticky/802 |
|||
# rsync rsync://updates.laptop.org | sort |
|||
== |
== Restoring a previous OS == |
||
If you are using an old release where 2 versions are maintained, or if you are running a modern release and have requested olpc-update to not purge one of the versions, you can switch between the 2 versions as follows: |
|||
Q: What is the latest version of the updater? |
|||
# shutdown the XO |
|||
A: the most-recent released version of the updater is at: |
|||
# power-on ''while holding down the'' ' '''O''' ' ''gamepad key''. |
|||
# release the key when you're instructed to do so |
|||
# [[How_to_check_the_OS_and_firmware_versions|check the OS version]] |
|||
== Purging a previous OS == |
|||
# wget http://dev.laptop.org/~mstone/olpccontents-latest.rpm |
|||
# wget http://dev.laptop.org/~mstone/rainbow-latest.rpm |
|||
If you have marked a version as sticky and now wish to remove it, or if you are running an old release where the old version is maintained and you wish to free up the disk space occupied by it, you can follow the example Terminal session log shown below. |
|||
Use this on build 602 for example before attempting an update to 625. |
|||
=== Identify what is present === |
|||
A: the most-recent unstable version of the updater is at: |
|||
List the available builds on the system. |
|||
# wget http://dev.laptop.org/~mstone/pyvserver.rpm |
|||
# wget http://dev.laptop.org/~mstone/rainbow.rpm |
|||
These packages can be installed with something like: |
|||
# '''ls /versions/pristine/*/boot/olpc_build''' |
|||
# rpm --upgrade --force *.rpm |
|||
/versions/pristine/802/boot/olpc_build |
|||
/versions/pristine/ed3fcf7128610f1f6fe07890f2315742/boot/olpc_build |
|||
# '''cat /versions/pristine/*/boot/olpc_build''' |
|||
802 |
|||
851 |
|||
This shows there are builds 802 and 851 available on the system. |
|||
You can do this on any build. |
|||
=== Identify what is running === |
|||
# '''cat /boot/olpc_build''' |
|||
851 |
|||
This shows that the build currently running is build 851. |
|||
Do not purge a build if it is the one running now — things break badly. |
|||
=== Measure free space before purge === |
|||
# '''df /''' |
|||
Filesystem 1K-blocks Used Available Use% Mounted on |
|||
/dev/mtdblock0 1048576 708572 340004 68% / |
|||
This shows roughly 340004 KB available. |
|||
=== Purge the unused build === |
|||
# '''rm -rf /versions/pristine/''802'' /versions/contents/''802'' /versions/run/''802''''' |
|||
Removes all the files of the unused build. Takes a few seconds. |
|||
=== Measure free space after purge === |
|||
# '''df /''' |
|||
Filesystem 1K-blocks Used Available Use% Mounted on |
|||
/dev/mtdblock0 1048576 495944 552632 48% / |
|||
This shows roughly 552632 KB is available, a significant increase. |
|||
=== Verify builds present === |
|||
# '''ls /versions/pristine/*/boot/olpc_build''' |
|||
/versions/pristine/ed3fcf7128610f1f6fe07890f2315742/boot/olpc_build |
|||
# '''cat /versions/pristine/*/boot/olpc_build''' |
|||
851 |
|||
This shows only the one build is now present. |
|||
There is no need to reboot or restart after purging the alternate build. |
|||
== More information == |
|||
The olpc-update script works by transferring only the differences between builds from a USB drive or across the internet link from an updates server. This makes updating easier, mostly quicker, and almost always with less data transfer. |
|||
As an example of the data efficiency gain, |
|||
*A full reinstallation from OS build 602 to 603 would normally take about 279Mb of download data, whereas ''olpc-update'' takes 16Mb of download data, |
|||
*A full reinstallation from OS build 603 to 608 would normally take 262Mb of download data, whereas ''olpc-update'' takes 6.5Mb of download data, |
|||
*An ''olpc-update'' from OS build 602 to 625 takes 33Mb of download data. |
|||
The time efficiency gain is less easy to characterize. It depends on the speed of the internet link, the speed of the updates server, and whether the update was able to use its server-friendly efficiency mode. An ''olpc-update'' from 602 to 603 took under 17 minutes. |
|||
The current updates server is updates.laptop.org. |
|||
=== Advanced usage === |
|||
== Update Using Another Laptop == |
|||
==== Update using another laptop ==== |
|||
Q: How can I re-use the bits for multiple laptops, using a laptop? |
Q: How can I re-use the bits for multiple laptops, using a laptop? |
||
Line 185: | Line 215: | ||
Take note of the build identifier. It will be a hexadecimal hash, 64 characters long. |
Take note of the build identifier. It will be a hexadecimal hash, 64 characters long. |
||
On the TARGET laptop, |
On the TARGET laptop, create an appropriate 'hints' file: |
||
export SOURCE=10.0.0.1 |
|||
export BUILD=dd44...597f |
|||
python2.5 |
|||
>>> import os, bitfrost.util.json as json |
|||
>>> hints = ('%(BUILD)s' % os.environ, 'normal', [('rsync','rsync://%(SOURCE)s/pristine/%(BUILD)s' % os.environ)]) |
|||
>>> open('hints.json','w').write(json.write(hints)) |
|||
>>> exit() |
|||
Now on the TARGET laptop, use ''olpc-update'' to upgrade or downgrade to that build: |
|||
sudo olpc-update --hints hints.json |
|||
SOURCE=10.0.0.1 |
|||
BUILD=dd44...597f |
|||
olpc-update -u rsync://${SOURCE}/contents/${BUILD} rsync://${SOURCE}/pristine/${BUILD}/ |
|||
Several laptops can all be updated in the same way from one source with the same 'hints.json' file. |
|||
Note that the extra slash on the end of the second argument is needed. |
|||
Several laptops can all be updated in the same way from one source. |
|||
== Setting |
==== Setting up a local updates server ==== |
||
The school server integrates with olpc-update. The [[XS-rsync]] component accepts software images and makes them available to olpc-update clients. |
|||
Q: How can I re-use the bits for multiple laptops, using a server? |
|||
A dated, alternative solution is described at [[Upgrade Server]]. |
|||
A: This feature is available for testing but is not yet released. Also, no one that I know of is yet publishing their own builds. |
|||
== For Developers == |
|||
In any case, in very recent versions of the updater, one may specify something like |
|||
Original specification: [[XO updater]] |
|||
# olpc-update -s rsync://teach.laptop.org -l |
|||
Source: |
|||
to see a list of builds available from teach.laptop.org. |
|||
* git://dev.laptop.org/projects/olpc-update |
|||
* http://dev.laptop.org/git/projects/olpc-update |
|||
Note: In the future, it may be possible to use this feature to perform incremental updates from a USB stick or SD card, e.g. by giving something like |
|||
* http://dev.laptop.org/pub/source/olpc-update/ |
|||
# olpc-update -s /mnt/mmcblk0p1 613 |
|||
Please give feedback on whether you would use such an update target. |
|||
*''manifest'' was an old name for ''contents'', and was present for builds 602 603 605 607 608 and omitted from builds 609 610 611 612, |
|||
*''updates.laptop.org'' generates an AUTH request, so an ident server on the system running rsync may be helpful, Debian package ''oidentd'' is sufficient, |
|||
== Source Repository == |
|||
Q: Where is the source? |
|||
A: The source repo is http://dev.laptop.org/git/users/mstone/security |
|||
The branch you want is currently called ''updater'', though this will likely change in the future. |
|||
There are five important files in the repository. They are: |
|||
rainbow/sbin/olpc-update |
|||
rainbow/sbin/olpc-update-rsync |
|||
rainbow/rainbow/update.py |
|||
rainbow/rainbow/launch/targets/update.py |
|||
rainbow/rainbow/launch/stages/update.py |
|||
Maintainer: [[User:DanielDrake]] |
|||
A: More recent work is being done on the ''master'' branch. |
|||
olpc-update uses [[olpc-contents]] for most of the heavy lifting. |
|||
=== See also === |
|||
*[[Test_Config_Notes#OLPC_Update|Test Config Notes: OLPC Update]] |
|||
[[category:software]] |
[[category:software]] |
||
[[Category:Package management]] |
|||
[[Category:Update paths]] |
Latest revision as of 23:53, 17 December 2013
olpc-update is a command-line program to update your system software. It preserves your files (journal) and activities you have installed.
olpc-update can download the new version from the internet, or from a file on a USB drive. See Updating the XO for other update scenarios.
The old software version is erased the first time the new version is booted, but this can be prevented.
(Certain really old builds, like 656, can't olpc-update to recent builds. Check the release notes of a recent build to find out if olpc-update can be used from a really old build. If not, then you must install the recent build afresh.)
What version do I have now?
To tell what version of the system software you have, follow How to check the OS and firmware versions.
Disk space requirements
Due to its fail-safe design, olpc-update must store all of the changed files in the release that you are updating to, alongside the existing release that you are running, for a short time. olpc-update cannot complete if there is not enough disk space available.
If upgrading between minor releases within the same release series or between development releases in the same development stream, the space required will be low. However, if upgrading from one major release to another (e.g. 10.1.3 to 11.2.0), you will probably need more than 300mb of disk space available (even though the upgrade process will finish with approximately the same amount of disk space available).
How to upgrade
See the Releases page for the releases that are available. The release notes for each recent release will explain exactly how to use olpc-update to update to that particular version. Be sure to read the release notes before starting the update.
The instructions below are generic.
Simple online update
Note: You should always back up important files; e.g., to a USB drive or to a school server before updating, just in case.
olpc-update is designed to work with even the worst internet connections, and will do no harm if it is interrupted during download. It will resume from where it left off, without having to download what it has already downloaded.
To manually upgrade your machine when a new version is released:
- Plug the XO into an electrical outlet
- Connect to the internet. If you are upgrading because you have a WPA hotspot at home, you might want to go to a Public Hotspot to connect to the internet for an online upgrade, such as a T-Mobile hotspot or a local libary.
Firewall note: olpc-upgrade requires outgoing TCP PORT:873 to be unfiltered by the hotspot's firewall. In otherwords if the laptop has functional-access to the internet but olpc-upgrade returns the message "I don't think you're connected to the internet." check the hotspot's firewall is not blocking the outgoing TCP Port 873. - Start the Terminal Activity (or if you cannot do so, open a console) and type the following (press the Enter key after it):
sudo olpc-update build-identifier
The build-identifier is normally identified on the release notes of the release you are upgrading to. Historically, build identifiers were simple numbers (e.g. 802), for newer builds prefixes are used to separate between the different laptop models (e.g. 10.1.3_xo1.5-860).
If you get an error saying "command not found", type "su -", press enter and then "olpc-update build-identifier" and press enter. For example:
su - /usr/sbin/olpc-update 802
If olpc-update successfully connects to the update server, some messages should display
Downloading contents of build build-identifier Updating to version hash xxxx Making clean /versions/updates/... Trying irsync_pristine update from rsync://updates.laptop.org/build-build-number - Cleaning tree. - Fetching contents. - Performing incremental rsync. Verifying update. Installing update in /versions/{pristine,run}/xxxx
Where xxxx is a version-specific number.
The olpc-update program uses several methods to update. If "irsync_pristine" fails, it will try "irsync dirty update", and then try "Performing full rsync". As long as the last method completes without errors, you're fine. This process may take more than thirty minutes.
When the process is complete, you need to reboot, unless you supplied the -r
option to olpc-update
.
If the new build includes newer firmware, then your XO will reboot twice.
When the XO restarts the update will be complete.
After updating, you should run the Sugar activity updater from the control panel. If not, you may find that various activities are not working.
Simple offline update
Unless you are running a very old release, you can also download the new release data onto a USB disk from an internet-connected computer, and then use olpc-update on an XO to perform the update, without requiring any internet connection.
Prepare a USB drive
Your USB drive needs to be writable from the computer on which you'll download the files, and readable from a running XO (as /media/YourDriveName).
- (Note that /media changes to /run/media/olpc for Fedora 17 based builds used in 12.1.0 and later).
Download .usb and .toc files onto USB
Insert a USB drive into a computer connected to the Internet.
Go to the download.laptop.org site to fetch the latest XO-1 release or the latest XO-1.5 release. You need to download two files from the build's directory to the top directory of your USB drive: osNNN.usb
and osNNN.toc
, where NNN is the numeric part of the build you are updating to. For example, if you are updating to build 711, the files would be named os711.usb
and os711.toc
; if you are updating to build joyride-1452, the files would be named os1452.usb
and os1452.toc
.
Right-click (Ctrl-click for Mac) on each of the two names and choose "Save Target As" ("Save Link As" for Firefox). Save both files to the USB drive. Do not open the files.
USB update
- Plug the XO into an electrical outlet
- Insert your USB drive with the .toc and .usb files on it into your XO.
- Start the Terminal activity (or if you cannot do so, open the console), and enter:
sudo /usr/sbin/olpc-update --usb
If you get "command not found" errors, enter:
su - /usr/sbin/olpc-update --usb
When olpc-update is finished, reboot to start using your new build.
Retention of previous versions
As of release 11.2.0, olpc-update only keeps 1 software version available by default (i.e. the old version is deleted after booting into the new version for the first time).
Older releases maintained two versions ("primary" and "alternate"), so that you could switch between the two (accepting any strange side effects caused by a software downgrade, not really supported by OLPC or the software that it ships).
Avoiding purge of previous versions
You can avoid olpc-update from deleting old versions in any situation by marking them as sticky, e.g. for build 802:
touch /versions/sticky/802
Restoring a previous OS
If you are using an old release where 2 versions are maintained, or if you are running a modern release and have requested olpc-update to not purge one of the versions, you can switch between the 2 versions as follows:
- shutdown the XO
- power-on while holding down the ' O ' gamepad key.
- release the key when you're instructed to do so
- check the OS version
Purging a previous OS
If you have marked a version as sticky and now wish to remove it, or if you are running an old release where the old version is maintained and you wish to free up the disk space occupied by it, you can follow the example Terminal session log shown below.
Identify what is present
List the available builds on the system.
# ls /versions/pristine/*/boot/olpc_build /versions/pristine/802/boot/olpc_build /versions/pristine/ed3fcf7128610f1f6fe07890f2315742/boot/olpc_build # cat /versions/pristine/*/boot/olpc_build 802 851
This shows there are builds 802 and 851 available on the system.
Identify what is running
# cat /boot/olpc_build 851
This shows that the build currently running is build 851. Do not purge a build if it is the one running now — things break badly.
Measure free space before purge
# df / Filesystem 1K-blocks Used Available Use% Mounted on /dev/mtdblock0 1048576 708572 340004 68% /
This shows roughly 340004 KB available.
Purge the unused build
# rm -rf /versions/pristine/802 /versions/contents/802 /versions/run/802
Removes all the files of the unused build. Takes a few seconds.
Measure free space after purge
# df / Filesystem 1K-blocks Used Available Use% Mounted on /dev/mtdblock0 1048576 495944 552632 48% /
This shows roughly 552632 KB is available, a significant increase.
Verify builds present
# ls /versions/pristine/*/boot/olpc_build /versions/pristine/ed3fcf7128610f1f6fe07890f2315742/boot/olpc_build # cat /versions/pristine/*/boot/olpc_build 851
This shows only the one build is now present.
There is no need to reboot or restart after purging the alternate build.
More information
The olpc-update script works by transferring only the differences between builds from a USB drive or across the internet link from an updates server. This makes updating easier, mostly quicker, and almost always with less data transfer.
As an example of the data efficiency gain,
- A full reinstallation from OS build 602 to 603 would normally take about 279Mb of download data, whereas olpc-update takes 16Mb of download data,
- A full reinstallation from OS build 603 to 608 would normally take 262Mb of download data, whereas olpc-update takes 6.5Mb of download data,
- An olpc-update from OS build 602 to 625 takes 33Mb of download data.
The time efficiency gain is less easy to characterize. It depends on the speed of the internet link, the speed of the updates server, and whether the update was able to use its server-friendly efficiency mode. An olpc-update from 602 to 603 took under 17 minutes.
The current updates server is updates.laptop.org.
Advanced usage
Update using another laptop
Q: How can I re-use the bits for multiple laptops, using a laptop?
A: Imagine that you have two laptops, one is called SOURCE and the other TARGET.
On the SOURCE laptop, add an rsyncd.conf file to /etc:
[contents] path = /versions/contents uid = root gid = root [pristine] path = /versions/pristine uid = root gid = root
Then start rsync --daemon there.
On the TARGET laptop, use rsync to check access and identify the build that is available:
SOURCE=10.0.0.1 rsync rsync://${SOURCE}/contents
Where 10.0.0.1 is the IP address or domain name of the SOURCE laptop.
Take note of the build identifier. It will be a hexadecimal hash, 64 characters long.
On the TARGET laptop, create an appropriate 'hints' file:
export SOURCE=10.0.0.1 export BUILD=dd44...597f python2.5 >>> import os, bitfrost.util.json as json >>> hints = ('%(BUILD)s' % os.environ, 'normal', [('rsync','rsync://%(SOURCE)s/pristine/%(BUILD)s' % os.environ)]) >>> open('hints.json','w').write(json.write(hints)) >>> exit()
Now on the TARGET laptop, use olpc-update to upgrade or downgrade to that build:
sudo olpc-update --hints hints.json
Several laptops can all be updated in the same way from one source with the same 'hints.json' file.
Setting up a local updates server
The school server integrates with olpc-update. The XS-rsync component accepts software images and makes them available to olpc-update clients.
A dated, alternative solution is described at Upgrade Server.
For Developers
Original specification: XO updater
Source:
- git://dev.laptop.org/projects/olpc-update
- http://dev.laptop.org/git/projects/olpc-update
- http://dev.laptop.org/pub/source/olpc-update/
Maintainer: User:DanielDrake
olpc-update uses olpc-contents for most of the heavy lifting.