Scratchbox on Ubuntu

Posted on 2010/03/14


Scratchbox is a framework to help developers with cross-compilation of Linux software. Cross-compilation is the process of compiling a program that will run on a machine with an architecture different from that of the compiling machine; Scratchbox eases this task using a combination of chroot environment, cross-compiling toolchains (like CodeSourcery) and emulation (like QEMU). Ubuntu repositories contain the Scratchbox2 package, but Scratchbox2 is not really the new version of Scratchbox as much as a derivation. The two products are now being developed in parallel and are taking two different routes. It is still possible to install the Scratchbox 1.X packages by adding to “/etc/apt/sources.list“:

deb apophis main

During the installation of the Scratchbox package the operating system will probably complain that the packages are not authenticated. After a repository update (sudo apt-get update), the new “scratchbox-*” packages will be available to install.

In addition it will be necessary to disable the “VDSO” option of the Linux kernel (from

To disable VDSO with Grub2

  1. Edit “/etc/default/grub” and change GRUB_CMDLINE_LINUX=”” to read GRUB_CMDLINE_LINUX=”vdso=0″.
  2. Run sudo /usr/sbin/update-grub in terminal.
  3. Reboot.

To disable VDSO with Grub 1.x

  1. Edit “/boot/grub/menu.lst” and find your default kernel. Typically this line looks something like this …

kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/hda1 ro quiet

  1. Change this line to include vdso=0 at the end. It should look like this …

kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/hda1 ro quiet vdso=0

  1. Save and close the file.
  2. Reboot.

In my Ubuntu box, to develop for ARM architectures,  I installed:

sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-cputransp scratchbox-devkit-qemu scratchbox-toolchain-arm-linux-cs2009q3-67

After this setup, to enable your user to use Scratchbox, run:

sudo /scratchbox/sbin/sbox_adduser youruser

This adds youruser to the sbox group; it creates also a home directory in “/scratchbox/users/youruser/home/youruser“. Logout, login and run:


This will bring on the ScratchBox prompt. In the prompt, run sb-menu and setup a new target. Choose the ARM toolchain, the qemu target and the qemu-arm-sb CPU transparency option. Ignore the rootstrap functionality and install the default libraries to the target system. Now you can compile and run ARM programs from the ScratchBox prompt as thought you were on the real target architecture.

Posted in: Embedded