Changes

5,335 bytes removed ,  14:01, 23 January 2010
no edit summary
Line 1: Line 1:  
=== Status ===
 
=== Status ===
   −
* Debian chroot construction has been automated: see [http://dev.laptop.org/git/users/mstone/puritan/snapshot/puritan-sugar.tar.bz2 puritan-sugar.tar.bz2] and its [http://dev.laptop.org/git/users/mstone/puritan/tree/README?h=sugar README] -- [[User:Mstone|Michael Stone]] 20:33, 1 August 2009 (UTC)
+
* sugar-chroot-0.1 released: see [http://dev.laptop.org/git/users/mstone/sugar-chroot sugar-chroot]
* Sugar continues to run happily in Squeeze chroots. --[[User:Mstone|Michael Stone]] 16:30, 3 July 2009 (UTC)
  −
* Sugar is now somewhat runnable from chroots. Jaunty and Squeeze have been tested recently; Fedora has not. --[[User:Mstone|Michael Stone]] 22:21, 23 May 2009 (UTC)
     −
=== Chroot Construction ===
+
=== Purpose ===
   −
There are lots of ways to create appropriate chroots; e.g. by hand, with debootstrap, with mock, etc.
+
You want to test sugar, sugar patches, sugar packages, or sugar hacks. You want clean, reproducible environments. You want sugar-chroot.
   −
Here are some ideas to help you get started:
+
=== Usage ===
   −
==== Ubuntu jaunty chroot ====
+
As excerpted from the '''[http://dev.laptop.org/git/users/mstone/sugar-chroot/plain/README README]''':
With ''recent'' versions of debootstrap, in order to get a working chroot, you want something like:  
     −
export CHROOT=`pwd`/jaunty-root
+
sugar-chroot consists of simple scripts. Download and unpack them like so:
sudo debootstrap --arch i386 jaunty $CHROOT http://ubuntu.media.mit.edu/ubuntu/
  −
sudo chroot $CHROOT /bin/bash -l
  −
mount -t proc proc /proc
  −
mount -t devpts devpts /dev/pts
     −
==== Debian squeeze chroot ====
+
NV=sugar-chroot-0.1
With debootstrap, in order to get a working chroot, you want something like:  
+
curl http://dev.laptop.org/~mstone/releases/SOURCES/$NV.tar.xz | tar Zxf $NV.tar.xz
 +
cd $NV
   −
export CHROOT=`pwd`/sid-root
+
To use them, pick a supported distro:
sudo debootstrap --arch i386 squeeze $CHROOT http://debian.lcs.mit.edu/debian
     −
  # and some of the following:
+
  DISTRO=debian
  mount -t tmpfs tmpfs $CHROOT/tmp
+
  DISTRO=fedora
mount -t proc proc $CHROOT/proc
  −
mount -t devpts devpts $CHROOT/dev/pts
  −
mount -t selinuxfs selinux $CHROOT/selinux
     −
# and to enter the chroot
+
To configure:
sudo chroot $CHROOT /bin/bash -l
     −
''Reference: http://www.debian.org/doc/manuals/reference/ch-tips.en.html ''
+
echo $DISTRO > conf/distro
 +
$EDITOR conf/$DISTRO.mk
   −
''Note'': you can use approx to cache packages across multiple runs for faster testing:
+
Then run
   −
apt-get install approx
+
  sudo make r/distro
echo 'debian http://debian.lcs.mit.edu/debian' >> /etc/approx/approx.conf
  −
/etc/init.d/approx restart
  −
  sudo debootstrap --arch i386 squeeze $CHROOT http://localhost:9999/debian
     −
==== Fedora rawhide chroot ====
+
to install your chroot.
   −
We will use <tt>febootstrap</tt> to construct our Fedora chroot. Install it with:
+
=== History ===
   −
yum install febootstrap            # or
+
See http://wiki.sugarlabs.org/index.php?title=Development_Team/Chroot&oldid=36911 for the manual instructions which sugar-chroot automates.
apt-get install febootstrap
  −
 
  −
: ''(Note for Debian users -- Fedora 11 and up require versions of <tt>rpm</tt> built with fancy features. I have successfully run these instructions with rpm_4.7.1-4_i386, which, at the time, I built from sources in Debian Experimental.)''
  −
 
  −
Then run it like so:
  −
 
  −
export CHROOT=`pwd`/f11
  −
sudo febootstrap fedora-11 $CHROOT    # sugar-0.84
  −
 
  −
or
  −
 
  −
export CHROOT=`pwd`/f12
  −
sudo febootstrap fedora-12 $CHROOT    # sugar-0.85.5, at the time of writing
  −
 
  −
Finally, as with Debian:
  −
 
  −
# and some of the following:
  −
mount -t tmpfs tmpfs $CHROOT/tmp
  −
mount -t proc proc $CHROOT/proc
  −
mount -t devpts devpts $CHROOT/dev/pts
  −
mount -t selinuxfs selinux $CHROOT/selinux
  −
 
  −
# and to enter the chroot
  −
sudo chroot $CHROOT /bin/bash -l
  −
 
  −
==== Gentoo chroot ====
  −
 
  −
Well, if you are familiar with regular Gentoo installation process(by using [http://www.gentoo.org/doc/en/handbook/ Handbook] instead of GUI stuff) you should know how to setup Gentoo chtoot :). Otherwise use these instructions.
  −
 
  −
* Firstly, you need Gentoo stage tarball. You can borrow it from any [http://www.gentoo.org/main/en/mirrolrs2.xml mirror] (use releases/<platform>/current sub directory).
  −
 
  −
* Lets think you are using stage3-i686-20090623.tar.bz2, then:
  −
 
  −
mkdir chroot-gentoo
  −
tar xjpf stage3-i686-20090623.tar.bz2 -C chroot-gentoo
  −
mount -o bind /dev chroot-gentoo/dev
  −
mount -o bind /proc chroot-gentoo/proc
  −
chroot chroot-gentoo /bin/bash
  −
 
  −
* To install sugar, use [[Community/Distributions/Gentoo|sugar-overlay]] or setup [[Development_Team/Jhbuild|sugar-jhbuild]] environment(with [[Community/Distributions/Gentoo#Packages|sugar-overlay]] you can install git packages as well).
  −
 
  −
=== Sugar Installation ===
  −
 
  −
==== jaunty chroot ====
  −
 
  −
sed -ie "s/main/main universe/" /etc/apt/sources.list
  −
apt-get update
  −
  −
apt-get install locales
  −
locale-gen "$LANG"
  −
dpkg-reconfigure tzdata
  −
  −
apt-get install sugar sugar-activities
  −
  −
# install your development tools here
  −
 
  −
# patch (hopefully temporary) bugs
  −
sed -ie '114i\\        if not favorites_settings.layout: favorites_settings.layout = favoriteslayout.RingLayout.key' /usr/lib/python2.6/dist-packages/jarabe/desktop/favoritesview.py
  −
 
  −
==== squeeze chroot ====
  −
 
  −
apt-get update
  −
apt-get install locales
  −
dpkg-reconfigure locales
  −
  −
# edit /etc/hosts
  −
 
  −
apt-get install education-desktop-sugar sugar-0.84
  −
  −
# install your development tools here
  −
 
  −
==== f12 chroot ====
  −
 
  −
yum groupinstall sugar-desktop
  −
 
  −
 
  −
==== f11 chroot ====
  −
 
  −
yum groupinstall sugar-desktop
  −
 
  −
=== User Accounts ===
  −
 
  −
For stupid reasons, it's necessary that Sugar run under a uid inside the chroot which exists as a real account outside the chroot. (Talk to the DBus people.)
  −
 
  −
Consequently, ''as root'', run something like this ''both'' inside and outside the chroot:
  −
 
  −
groupadd -g 64002 sugar
  −
useradd -m -u 64002 -g sugar -s /bin/bash sugar
  −
 
  −
=== D-Bus ===
  −
 
  −
Sugar wants to be able to use global state stored in both HAL and NetworkManager, both of which live on the system bus. Consequently, ''outside the chroot'', we need to
  −
 
  −
sudo mount --bind /var/run/dbus $CHROOT/var/run/dbus
  −
 
  −
before entering the chroot. (Mock uses unshare() to enter a new mount-point namespace since this makes garbage collection of mountpoints much easier.)
  −
 
  −
=== X11 ===
  −
 
  −
We need to point Sugar at an X server. One easy (but insecure) way to do this is to make a nested X server like so, ''outside the chroot'':
  −
 
  −
Xephyr -ac :1 -screen 800x600x24 # 1024x768x24
  −
 
  −
See the talk page for more secure alternatives.
  −
 
  −
=== Running Sugar ===
  −
 
  −
Then, inside the chroot, you can happily run sugar as user 'sugar' with something like
  −
 
  −
sudo chroot $CHROOT /bin/bash -l
  −
su sugar -
  −
cd ~
  −
ulimit -c unlimited
  −
export DISPLAY=localhost:1
  −
export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --print-address --fork)
  −
sugar
  −
 
  −
Then pull up the frame, switch to the home view, and launch some activities!
  −
 
  −
=== Cleaning Up ===
  −
 
  −
To correctly delete a chroot that you no longer need, kill all processes running in the chroot, and
  −
 
  −
sudo killall -u sugar
  −
export CHROOT=/path/to/my/chroot  # important!
  −
umount $CHROOT/var/run/dbus
  −
umount $CHROOT/proc
  −
umount $CHROOT/dev/pts
  −
umount $CHROOT/tmp
  −
rm -rf $CHROOT
 
76

edits