Olpc-update

From OLPC
Revision as of 13:35, 7 December 2007 by LFaraone (talk | contribs) (→‎Update Targets: provided command does not work)
Jump to navigation Jump to search

Note: a newer version of olpc-update has been deployed since this page was last maintained, and some of this page does not apply. Updates welcome.

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.

As an example of the data efficiency gain,

  • An autoreinstallation from OS build 602 to 603 would normally take about 279Mb of download data, whereas olpc-update takes 16Mb of download data,
  • An autoreinstallation 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 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 current updates server is updates.laptop.org.

Usage

In summary:

  • 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.

Be Connected

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.

Be Root, with correct Environment Variables

From the Sugar Developer's Console:

 $ su -
 # whoami
 root

From SSH or the Virtual Terminal:

 # whoami
 root

Run olpc-update

Normally you only need to run olpc-update with a build number, like this:

# olpc-update 613

There are other options. For example:

# 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

Update Targets

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:

# rsync rsync://updates.laptop.org | sort

Latest Version

Q: What is the latest version of the updater?

A: the most-recent released version of the updater is at:

# wget http://dev.laptop.org/~mstone/olpccontents-latest.rpm
# wget http://dev.laptop.org/~mstone/rainbow-latest.rpm

Use this on build 602 for example before attempting an update to 625.

A: the most-recent unstable version of the updater is at:

# wget http://dev.laptop.org/~mstone/pyvserver.rpm
# wget http://dev.laptop.org/~mstone/rainbow.rpm

These packages can be installed with something like:

# rpm --upgrade --force *.rpm

You can do this on any build.

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, use olpc-update to upgrade or downgrade to that build:

SOURCE=10.0.0.1
BUILD=dd44...597f
olpc-update -u rsync://${SOURCE}/contents/${BUILD} rsync://${SOURCE}/pristine/${BUILD}/

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 Up A Local Updates Server

Q: How can I re-use the bits for multiple laptops, using a 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.

In any case, in very recent versions of the updater, one may specify something like

# olpc-update -s rsync://teach.laptop.org -l

to see a list of builds available from teach.laptop.org.

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

# 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

A: More recent work is being done on the master branch.

See also