Changes between Initial Version and Version 1 of ChrootSetup

Show
Ignore:
Timestamp:
12/12/08 22:22:38 (13 years ago)
Author:
allison
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ChrootSetup

    v1 v1  
     1This file outlines the steps needed to set up a chroot environment for building Debian/Ubuntu packages for Parrot (so you don't need a full install of the particular distribution to build packages for it, and so you can run Parrot's tests on multiple different distributions easily). The host system used to produce this guide was Ubuntu Edgy, and directions are provided for building chroots for Debian Etch and Ubuntu Gutsy. 
     2 
     3(Watch out for special characters in the configuration files and command-line examples. Best to view the wiki page in Advanced Edit mode.) 
     4 
     5== Initial Setup for All == 
     6 
     7 * Install the schroot package. 
     8 
     9 $ sudo aptitude install schroot 
     10 
     11 * Create a directory for the chroot instances 
     12 
     13 $ sudo mkdir /var/chroot 
     14 
     15== Debian Sid == 
     16 
     17(I tend to use the mirror ftp.osuosl.org instead of ftp.debian.org, pick your favorite.) 
     18 
     19 * Manually download the debootstrap package 
     20 
     21(or the latest at <http://ftp.debian.org/debian/pool/main/d/debootstrap/>) 
     22 
     23 $ wget http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.7_all.deb 
     24 
     25 * Manually install it: 
     26 
     27 $ sudo dpkg --install debootstrap_1.0.7_all.deb 
     28 
     29 * Edit /etc/schroot/schroot.conf and add the following lines: 
     30 
     31 [sid] 
     32 description=Debian sid 
     33 location=/var/chroot/sid 
     34 priority=3 
     35 users=<your user> 
     36 groups=sbuild 
     37 root-groups=root 
     38 
     39 * Set up a chroot environment using debootstrap: 
     40 
     41 $ sudo debootstrap sid /var/chroot/sid http://ftp.debian.org/debian/ 
     42 
     43(to run a 32bit chroot on a 64bit install, add the option "--arch i386") 
     44 
     45 * Copy over some configuration files from the base install to the chroot environment: 
     46 
     47 $ sudo cp /etc/resolv.conf /var/chroot/sid/etc/resolv.conf 
     48 
     49 * (optional) Add the following lines to /var/chroot/sid/etc/apt/sources.list to expand the list of available packages: 
     50 
     51 deb http://ftp.debian.org/debian sid contrib 
     52 
     53 * Start up the chroot environment: 
     54 
     55 $ sudo chroot /var/chroot/sid 
     56 
     57 * Get the latest versions of the package list and some core packages: 
     58 
     59 # aptitude update 
     60 # aptitude install build-essential dh-make pbuilder lintian \ 
     61 wget debconf devscripts sudo patch perl file debootstrap 
     62 # aptitude update 
     63 # aptitude install locales dialog # (optional) for locales 
     64 # dpkg-reconfigure locales # select your preferred locale 
     65 
     66 * (optional) Setup text for the command-line prompt, to display when running in chroot: 
     67 
     68 # echo sid > /etc/debian_chroot 
     69 
     70 * Leave the chroot environment: 
     71 
     72 # exit 
     73 
     74 * Set up users, groups, gpg, and sudo access in chroot: 
     75 
     76 $ sudo cp /etc/passwd /var/chroot/sid/etc/ 
     77 $ sudo sed 's/\([^:]*\):[^:]*:/\1:*:/' /etc/shadow \ 
     78 | sudo tee /var/chroot/sid/etc/shadow 
     79 $ sudo cp /etc/group /var/chroot/sid/etc/ 
     80 $ sudo cp /etc/gshadow /var/chroot/sid/etc/ 
     81 $ sudo cp /etc/hosts /var/chroot/sid/etc/ 
     82 $ sudo cp /etc/sudoers /var/chroot/sid/etc/ 
     83 
     84 $ sudo chroot /var/chroot/sid/ 
     85 # dpkg-reconfigure passwd 
     86 # passwd <your user> 
     87 # mkdir /home/<your user> 
     88 # chown <your user> /home/<your user> 
     89 # chgrp <your user> /home/<your user> 
     90 # exit 
     91 
     92 $ cp ~/.bashrc /var/chroot/sid/home/<your user>/. 
     93 $ cp -r ~/.gnupg /var/chroot/sid/home/<your user>/. 
     94 
     95 * Set up the environment for debuild, add the following lines to 
     96 
     97 /var/chroot/sid/home/<your user>/.devscripts: 
     98 
     99 DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i -I" 
     100 DEBUILD_PRESERVE_ENVVARS=DH_ALWAYS_EXCLUDE 
     101 
     102And in wherever you set environment variables for shell sessions: 
     103 
     104 export DH_ALWAYS_EXCLUDE='.svn' 
     105 
     106 * Done 
     107 
     108== Ubuntu Gutsy == 
     109 
     110 * Manually download the debootstrap package for Gutsy 
     111 
     112(or the latest at <http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/>) 
     113 
     114 $ wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.7~gutsy1_all.deb 
     115 
     116 * Manually install it: 
     117 
     118 $ sudo dpkg --install debootstrap_1.0.7~gutsy1_all.deb 
     119 
     120 * Edit /etc/schroot/schroot.conf and add the following lines: 
     121 
     122 [gutsy] 
     123 description=Ubuntu gutsy 
     124 location=/var/chroot/gutsy 
     125 priority=3 
     126 users=<your user> 
     127 groups=sbuild 
     128 root-groups=root 
     129 
     130 * Set up a chroot environment using debootstrap: 
     131 
     132 $ sudo debootstrap --variant=buildd gutsy /var/chroot/gutsy http://archive.ubuntu.com/ubuntu/ 
     133 
     134(to run a 32bit chroot on a 64bit install, add the option "--arch i386") 
     135 
     136 * Copy over some configuration files from the base install to the chroot environment (substituting if your install is a different release): 
     137 
     138 $ sudo cp /etc/resolv.conf /var/chroot/gutsy/etc/resolv.conf 
     139 $ sudo cp /etc/apt/sources.list /var/chroot/gutsy/etc/apt/ 
     140 $ sudo sed -i s/<your install>/gutsy/g /var/chroot/gutsy/etc/apt/sources.list 
     141 
     142 * Start up the chroot environment: 
     143 
     144 $ sudo chroot /var/chroot/gutsy 
     145 
     146 * Get the latest versions of the package list and some core packages: 
     147 
     148 # apt-get update # ignore gpg errors for now 
     149 # apt-get install gnupg 
     150 # apt-get update # get rid of gpg errors 
     151 # apt-get install build-essential dh-make automake pbuilder lintian \ 
     152 wget debconf devscripts sudo perl patch 
     153 # apt-get update 
     154 # apt-get install dialog language-pack-en # for locales 
     155 # apt-get install vim 
     156 
     157 * (optional) Setup text for the command-line prompt, to display when running in chroot: 
     158 
     159 # echo gutsy > /etc/debian_chroot 
     160 
     161 * Leave the chroot environment: 
     162 
     163 # exit 
     164 
     165 * (optional) Set up users, groups, and sudo access in chroot: 
     166 
     167 $ sudo cp /etc/passwd /var/chroot/gutsy/etc/ 
     168 $ sudo sed 's/\([^:]*\):[^:]*:/\1:*:/' /etc/shadow \ 
     169 | sudo tee /var/chroot/gutsy/etc/shadow 
     170 $ sudo cp /etc/group /var/chroot/gutsy/etc/ 
     171 $ sudo cp /etc/hosts /var/chroot/gutsy/etc/ 
     172 $ sudo cp /etc/sudoers /var/chroot/gutsy/etc/ 
     173 
     174 $ sudo chroot /var/chroot/gutsy/ 
     175 # dpkg-reconfigure passwd 
     176 # passwd <your user> 
     177 # mkdir /home/<your user> 
     178 # chown <your user> /home/<your user> 
     179 # chgrp <your user> /home/<your user> 
     180 # exit 
     181 
     182 * Done