Cheatsheet for debootstrap

12/August/2018 debootstrapchroot

Deploying the required system for a quick debugging


Sometimes you need to quickly test something in a specific environment that is native to that application, such as Ubuntu.
And no, it’s not Docker, because you often need to have a normal ability to work with this environment as a system, edit configs, install packages, and so on.
Rebuilding docker images or configuring something inside them is a very specific and strange pleasure.
KVM is not needed here, LXC takes longer to set up and is more difficult to interact with.
Yes, the easiest way is debootstrap and good old chroot.

Let me note that this is not about isolation and security, but about a quick way to run trusted software in a specific environment.

amd64 xenial

1
2
mkdir /data/.box/amd64_xenial
/usr/sbin/debootstrap --verbose --include=nano,bash-completion,aptitude --arch amd64 xenial /data/.box/amd64_xenial http://archive.ubuntu.com/ubuntu/
Cheatsheet for debootstrap...

ext4 without journaling, fast and insecure

3/December/2015 ext4tune2fsmkfsmount

This use is not recommended for an important data.

A little faster, but much less reliable

1
2
3
4
mkfs.ext4 -m0 /dev/mapper/lvm-test
# Disable periodic file system checking after a certain number of mounts
tune2fs -c0 -i0 -m0 /dev/mapper/lvm-test
# Same as data=writeback when mounting a partition
ext4 without journaling,...
Page 2 from 2