Mini How-to/Cheatsheet

How to create a Debian install inside a chroot with Debootstrab

debootstrap –arch i386 lenny $CHROOTDIR http://ftp.us.debian.org/debian

debootstrap lenny|testing|unstable

Remember you can use release name (lenny) or type testing; the important difference is that if you use, say, squeeze, which is now testing, when it becomes stable, you stay on squeeze; if you use testing, you stay on testing even when squezee is released. –arch can be omitted ftp.us.debian.org if not set it’s the default setting

Configure the chroot

First, mount the /proc filesystem.

mount -t proc proc $CHROOTDIR/proc
mount -t devpts devpts $CHROOTDIR/dev/pts # Don’t worry if this doesn’t work
for you.

Enter the chroot
LANG=C chroot $CHROOTDIR/ /bin/bash

The LANG it’s important to avoid errors with programs that require setting locales, if you wish you can do apt-get install locales o dpkg-reconfigure locales.

Important to not confuse chroot with normal system

export PS1=»CHROOT:\w# »

Also you can create

/etc/debian_chroot

and put something like «lenny» and when do chroot that adds to the prompt.

Commands to configure the chroot

You only run them once.

cd /dev; /sbin/MAKEDEV generic; cd –

To prevent problems with locales entering the chroot

LANG=C chroot $CHROOTDIR /bin/bash

Sometimes MAKEDEV will fail from inside chroot you can do outside the chroot as root

Also sometimes debotstrab forgot to get the signing key for the archive-repositories, most of times doing apt-get update && apt-get upgrade fixes it, if not you need to install debian-archive-keyring.

At the end one can free space with apt-get clean and with deborphan.

Its good idea to umount $CHROOTDIR/proc and $CHROOTDIR/dev/ when shutting down the machine.

Esta entrada fue publicada en General, planetalinux, sysadmin, Trabajo. Guarda el enlace permanente.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.