Ubuntu 20.04 ARM64 : minimal or how to "minimise" the default install?

It seems there isn't any minimal image for ARM64 architecture for Ubuntu 20.04 LTS; so how do you get/make a minimal version?

I use the AWS Ubuntu 20.04 ARM image and when I compare my packer build between an AMD64 minimal and the default ARM64 I roughly get 150 extra packages in the ARM64 version. The goal is to have a lean ubuntu (and not change distro).

Is there any trick to clean-up easily other than, the time consuming exercise, diff'ing dpkg -l


Solution 1:

There are special Ubuntu Base images available at http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ .

You can try to use it directly. Or use for diff'ing using QEMU on probably amd64 system:

sudo apt-get install qemu-user-static

cd ~/Downloads
wget -c http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.3-base-arm64.tar.gz
mkdir ubuntu-arm64
tar -xpf ubuntu-base-20.04.3-base-arm64.tar.gz -C ubuntu-arm64
sudo cp /usr/bin/qemu-aarch64-static ubuntu-arm64/usr/bin
sudo cp /etc/resolv.conf ubuntu-arm64/etc

# time to chroot
sudo chroot ubuntu-arm64
dpkg -l | grep ^ii | wc -l  # will return 92 with used image