home | tech | misc | code | bookmarks (broken) | contact | README

pkgsrc bootstrap

This file explains ways to bootstrap pkgsrc. If you have problems, check the pkgsrc troubleshooting page.

For more information on bootstrapping pkgsrc, see the Bootstrapping pkgsrc section of the pkgsrc guide.

Basic Bootstraping

Bootstraping, for me, is necessary in two situations:

  1. You are using NetBSD (or not) but you don't want to put your packages in the default location (packages in /usr/pkg and database in /var/db).
  2. You are not using NetBSD, but you want to use pkgsrc.
  3. You want to have parallel installations of pkgsrc.

All problems can be addressed running the script bootstrap/bootstrap in the pkgsrc distribution. To address problem 1 (no matter if you are using NetBSD or not), you just have to pass some parameters to the bootstrap script.

If you want to put your packages in the default place, just run the script, as root:

# cd /usr/pkgsrc/bootstrap
# ./bootstrap --prefix /usr/upkg --varbase /usr/upkg/var

See that --prefix and --varbase options are optional.

At the end of the process, there should be a workable version of the tools needed to make pkgsrc work where you bootstrapped it (the directory you passed for the --prefix option or /usr/pkg), like BSD make and others.

Problem 2 have the same process.

Problem 3 arise if you want to test pkgsrc but don't want to mess up your default pkgsrc installation. In this case, you might want to install both pkgsrc source code and the binary files place in different places other than the default one:

# cd tmp
# tar zxf pkgsrc.tar.gz
# mv pkgsrc /usr/upkgsrc
# cd /usr/upkgsrc/bootstrap
# ./bootstrap --prefix /usr/upkg --varbase /usr/upkg/var

System specific issues and tips

Chroot'ed Bootstrapped Debian

In a Debian-like system (like Ubuntu or Debian itself), some can chroot a small Debian environment easily with the debootstrap command. The following command downloads Debian Lenny basic packages and setup its environment under the chroot directory:

# debootstrap lenny chroot

You can chroot to this area:

# chroot chroot

Once you entered in chroot, you should install some basic packages that make pkgsrc work:

# apt-get install gcc g++ make
# apt-get install ncurses-dev
# apt-get install xorg-dev
# apt-get install groff

One thing of those distributions, is that /bin/sh is a symbolic link to /bin/dash, which doesn't work with pkgsrc. To make it work, make /bin/sh point to /bin/bash:

# cd /bin
# mv sh sh_
# ln -s bash sh


Note that just setting SH variable to /bin/bash doesn't work, because it will try to use /bin/sh when building your packages and you may get problems (TODO: dahm... I have to document the problem I had for using /bin/dash).

Lastly, create a link for your X libraries and headers:

# cd /usr
# mv X11R6 X11R6_
# ln -s . X11R6

Now the system is ready to bootstrap pkgsrc.