pbuilder tips

27 Sep 2013

I’ll write down some tips useful when dealting with pbuilder in Ubuntu, pbuilder is a builder for testing the creation of .deb packages from .dsc sources, however I often use it as a light replacement for full virtual machines.

E: Release signed by unknown key (key id 8B48AD6246925553)

I: Distribution is sid.
I: Building the build environment
I: running debootstrap
/usr/sbin/debootstrap
I: Retrieving Release
I: Retrieving Release.gpg
I: Checking Release signature
E: Release signed by unknown key (key id 8B48AD6246925553)

This messages indicates debootstrap has not been able to verify than 8B48AD6246925553 is a valid key, by default pbuilder in Ubuntu reads /usr/share/keyrings/ubuntu-archive-keyring.gpg. This key is defined at: /usr/share/pbuilder/pbuilderrc. It sounds logic than a Debian key is not valid in an Ubuntu setup, however sometimes it’s useful to test a package against Debian without installing a full Debian environment.

This problem can be solved by adding the Debian key to the Ubuntu keys:

$ sudo gpg --no-default-keyring --keyring /usr/share/keyrings/ubuntu-archive-keyring.gpg --recv-keys 8B48AD6246925553
$ sudo DIST=sid ARCH=amd64 pbuilder create

Or adding it to other ring and use it temporally:

$ gpg --no-default-keyring --keyring /etc/apt/trusted.gpg --recv-keys 8B48AD6246925553
$ tail $HOME/.pbuilderrc
DEBOOTSTRAPOPTS=(
 '--variant=buildd'
 '--keyring' '/etc/apt/trusted.gpg'
)
$ sudo DIST=sid ARCH=amd64 pbuilder create

If you don’t want to mess with ~/.pbuilderrc the parameter can also be set from the prompt command:

$ sudo DIST=sid ARCH=amd64 pbuilder create --debootstrapopts --keyring=/etc/apt/trusted.gpg

Run X apps

Pbuilder is a nothing but a chroot + debian enchantments, you can run virtually anything, from audio/video, to cli/gui applications, etc. Running a X app is a two step process:

$ xhost + #in the host environment
[chroot] $ export DISPLAY=:0.0
[chroot] $ app

Run i18n apps

Running apps in other languages requires to download extra language packages and modify the LC_ALL variable:

[chroot] $ apt-get install language-pack-es #interchange -es for the 2 letters of your own lang
[chroot] $ LC_ALL=es_ES.utf-8 app

Run multimedia apps

To run multimedia applications besides enabling X, you’ll need to mount /proc and /dev:

$ printf "%s\\n" 'BINDMOUNTS="${BINDMOUNTS} /dev /proc' >> ~/.pbuilderrc
$ pbuilder login