the most minimal Debian/sid installed with debootstrap?

In the past years I used debootstrap to install my desktop Debian (daily usage) and I’m planning to use it once again, but until now I just used debootstrap default options, this time instead I’d like to install a minimal system.

I did some search but so far found nothing I didn’t already knew, most articles say bare minimal but then they just use default options too, instead I’d like to know if there are exclude options to trim it down and still get a working system.

I plan to look into debootstrap but thought to ask here before, maybe somebody already did or know about and may save me some time.

edit

A minimal Debian is composed by the packages with priority required and important

dpkg-query -f '${binary:Package} ${Priority}n' -W 
   | grep -w 'required|important'

The minbase option still install some extra, optional, standard, but very few, eventually some of those and some important could be removed (or not installed at all, I think --exclude should work but haven’t checked)

The shell deboostrap’s sub-script for sid is /usr/share/debootstrap/scripts/sid, easy to (backup and) customize.

After the installation a lot of disk space is taken from downloaded .deb, apt-get clean, apt-get autoclean should free some.

Some space is taken from locales, docs, man pages, dpkg-reconfigure locales and the package localepurge should help.

Asked By: Alex

||

I use the option --variant=minbase which seems to be fairly minimal (about 150MB).
No text editor, but essential GNU tools, package manager, and networking functionnalities with iproute2.

Answered By: pedroapero

Since the container images are widely available nowadays, the minimal installation can be achieved from a container image. For example, the aarch64 debian stretch docker container installation is only 57.3M. That is way smaller than the debootstrap minbase variant.

Detailed info follows.

Run the following on a PC to get the debian stretch container image in a tar’ed directory.

docker pull arm64v8/debian:stretch-2020-0130-slim
docker save -o stretch-root.tar arm64v8/debian:stretch-2020-0130-slim

Extract the stretch-root.tar, and the installation directory is inside in a file named layer.tar. Place the content from this file onto an aarch64 target, the directory tree size returned by a du -sh is 57.3M.

Start a mount and pid namesapce with root to this container image directory. Or alternatively run a chroot on this image directory, that should work but I’ve not tried.

There is a glitch with me though. In the namesapce, apt-get update will keep waiting for headers. Somehow it cold be resolved by adding the sandbox user root to the command so the command will become apt-get -o APT::Sandbox::User=root update. The stretch aarch64 version does not complain about the problem, but it did by the stretch arm32v5 version, so the answer can easily be found on the internet.

Install the debootstrap package inside the container. Run the following to install two debian buster installations:

debootstrap --include=apt,bash,dpkg buster /root/buster-root-1/
debootstrap --variant=minbase buster /root/buster-root-2/

The sizes, returned by a du -sh on the two installations are respectively 266.4M and 308.1M.

Answered By: minghua
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.