Skip to content

debootstrap

Debootstrap can be used to install Debian in a system without using an installation disk but can also be used to run a different Debian flavor in a chroot environment. This way you can create a full (minimal) Debian installation which can be used for testing purposes (see the EXAMPLES section). If you are looking for a chroot system to build packages please take a look at pbuilder.

Install

Install packages debootstrap and schroot.

apt install debootstrap schroot

Install Ubuntu 64-bit trusty

To install in directory /srv/chroot/trusty directory.

debootstrap --variant=buildd --arch=amd64 trusty /srv/chroot/trusty http://archive.ubuntu.com/ubuntu

Configure

Create file /etc/schroot/chroot.d/trusty.conf with content below.

[trusty]
description=Ubuntu Trusty
directory=/srv/chroot/trusty
type=directory
users=root
root-groups=root
#profile=desktop
personality=linux
preserve-environment=true

Change the root using schroot schroot -c trusty.

Manual mounting

mount -t proc proc /chroot/trusty/proc/
mount --rbind /sys /chroot/trusty/sys/
mount --rbind /dev /chroot/trusty/dev/

If you want to use your internet connection it in the chroot system, you have to copy over your DNS details.

cp /etc/resolv.conf etc/resolv.conf

Change root using chroot and your in there.

chroot /srv/chroot/trusty /bin/bash