This wiki is obsolete, see the NorduGrid web pages for up to date information.

Debian/chroot

From NorduGrid
Jump to navigationJump to search

Warn.png

NOTE: This page is out of date and is kept for purely historical reasons.

"root" is how the directory "/" is pronounced, at least in English. In principle, this could be any directory. Any directory, that has bin and lib and ... underneath, this means. If you have that, then you can, as the superuser who unfortunately is also called "root", change the original root directory to that other directory. The command to do so is "chroot", short for "change root". This is very helpful when you want to make sure that

  • you don't overwrite your real system by chance when experimenting as root with new software
  • you don't want certain users to see more than they need to see, e.g. in grid computing

Preparing a chroot environment

There are two ways to prepare chroot environments in Debian. debootstrap and cdebootstrap, the latter being a implementation of the prior Perl script in C. The original works and I just use it. debootstrap is also available for SuSE, so you can have Debian chroots under SuSE. I have not seen it for RedHat/Fedora. A decision you need to make is the distribution. It can be stable, testing or unstable. Also see "man debootstrap".

What is your nearest Debian mirror? You might actually have one at your university already. Please check.

 # yourcountry=us
 # yourcountry=se
 # yourcountry=it
 # yourcountry=hu
 yourcountry=de

What distribution are you inclined to use or build for?

 # dist=etch # for stable
 dist=sid # for unstable

Location of the chroot

 chrootdest=/local/$dist-root

Then execute the following

 sudo debootstrap $dist $chrootdest http://ftp.$yourcountry.debian.org/debian/

It is common to prepare an alias for the shell like

 echo "alias $dist='sudo chroot $chrootdest'" >> ~/.bashrc

And to render the chroot somewhat usable

 grep proc /etc/fstab > $chrootdest/etc/fstab
 grep localhost /etc/fstab > $chrootdest/etc/hosts
 cp /etc/resolv.conf $chrootdest/etc/
 echo $dist > $chrootdest/etc/debian_chroot

This will now run for a while. Once it is completed, do

 sudo chroot $chrootdest
 if [ ! -r /proc/cpuinfo ]; then mount /proc; fi

Installing additional packages to compile ARC-0/1

There is a series of packages that you need to compile ARC successfully. These are all listed in the "debian" subfolder of the sources and there in the the file "control". As root, you should install some more packages, though:

 apt-get install debian-keyring dpkg-dev
 apt-get install build-essential debhelper subversion locales less lintian fakeroot
 # if you already know you want to install globus
 apt-get install libssl-dev quilt automake libxml2-dev lintian
 apt-get clean

which will drag a series of dependencies in. Some will say that this build environment is no longer pure enough. But in our philosophy you also want to work with that chroot directory to some degree, not only build in it. Change directory to whereever you want to build the packages. Feel free to mount your regular home directory for instance. Retrieve the build script and execute it.

 svn export http://svn.nordugrid.org/repos/workarea/T5.2/debian-distribution/get_arc1_source_from_svn_and_prepare_debian_package.sh
 ./get_arc1_source_from_svn_and_prepare_debian_package.sh

Well, if you are aiming at installing ARC-0 or a Globus-dependent ARC-1 all from sources, then you may well decide to go for all the Debian-related packaging sources

 svn export http://svn.nordugrid.org/repos/workarea/T5.2/debian-distribution/

It contains build instructions for

The first time when trying this, all files are checked out but dpkg-buildpackage will fail. Install all the packages reported as missing with "apt-get install ....<packages>....". Then either directly call

 cd nordugrid-arc* && dpkg-buildpackage -rfakeroot -uc -us

or call that previous script again, which will then check out the sources again. Uh, wait, this does not belong here, this section was meant to tell about setting up the environment only.

What is pbuilder / cowbuilder ?

Well, in a perfect world, the build dependencies for any particular packages are installed at the very moment that the build starts. The automation of all this is helped by the pbuilder tool. The nightlies are built this way. The Debian build daemons use that (or a variant of it), too. And if you are a Debian developer then you should use it, too. Should. It is far more intuitive to use readily prepred build environments, instead. Start with the above and if you are up to it, do the (p|cow)builder once you feel like it.