Skip to content

Instantly share code, notes, and snippets.

@MerijnHendriks
Last active May 23, 2025 20:50
Show Gist options
  • Save MerijnHendriks/f26be00d4bd880ed3967b7b94ef9a705 to your computer and use it in GitHub Desktop.
Save MerijnHendriks/f26be00d4bd880ed3967b7b94ef9a705 to your computer and use it in GitHub Desktop.
Ubuntu Base 22.04 installation guide

Ubuntu Base 22.04

The goal is to have a minimal Ubuntu Base installation close to Ubuntu's mini iso.

  • Core: Ubuntu Base 22.04
  • Kernel: linux-image-5.18.0-051800-generic
  • Bootloader: EFISTUB
  • Init: systemd

Requirements

  • Ubuntu desktop (22.04)
  • A usb stick
  • A working internet connection

Notes

For sake of keeping this simple, I assume:

  • Installation is performed on
    • a x86_64 machine
    • a NVME drive (< 2Tb storage)
  • No swap partition is needed (no hibernate for example).

Make sure you change:

  • 5.18.0-051800-generic to the kernel version
  • nvme0n1 to the name of the storage device
  • nvme0n1p1 to the partition named "boot"
  • nvme0n1p2 to the partition named "os"
  • user to your system username

1. Preparation

  1. Boot into usb with ubuntu desktop
  2. Try ubuntu
  3. Terminal > Download required files (to the/home/ubuntu/Downloads folder):
cd ~/Downloads

# ubuntu base
wget -O ubuntu-base_amd64.tar.gz https://cdimage.ubuntu.com/ubuntu-base/releases/22.04/release/ubuntu-base-22.04-base-amd64.tar.gz

# kernel
# - linux-image-5.18.0-051800-generic
wget -O linux-headers_amd64.deb https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.18/amd64/linux-headers-5.18.0-051800-generic_5.18.0-051800.202205222030_amd64.deb
wget -O linux-headers_all.deb https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.18/amd64/linux-headers-5.18.0-051800_5.18.0-051800.202205222030_all.deb
wget -O linux-headers_image_amd64.deb https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.18/amd64/linux-image-unsigned-5.18.0-051800-generic_5.18.0-051800.202205222030_amd64.deb
wget -O linux-headers_modules_amd64.deb https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.18/amd64/linux-modules-5.18.0-051800-generic_5.18.0-051800.202205222030_amd64.deb
wget -O libelf1_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/e/elfutils/libelf1_0.186-1build1_amd64.deb
wget -O linux-base_all.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/l/linux-base/linux-base_4.5ubuntu9_all.deb
wget -O kmod_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/k/kmod/kmod_29-1ubuntu1_amd64.deb
wget -O libkmod2_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/k/kmod/libkmod2_29-1ubuntu1_amd64.deb
wget -O dialog_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/universe/d/dialog/dialog_1.3-20211214-1_amd64.deb
wget -O locales_all.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/g/glibc/locales_2.35-0ubuntu3_all.deb
wget -O language-pack-en-base_all.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/l/language-pack-en-base/language-pack-en-base_22.04+20220415_all.deb
wget -O language-pack-en_all.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/l/language-pack-en/language-pack-en_22.04+20220415_all.deb

# init system
# - systemd
wget -O systemd_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/s/systemd/systemd_249.11-0ubuntu3_amd64.deb
wget -O systemd-sysv_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/s/systemd/systemd-sysv_249.11-0ubuntu3_amd64.deb
wget -O libapparmor1_app64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/a/apparmor/libapparmor1_3.0.4-2ubuntu2_amd64.deb
wget -O libcryptsetup12_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/c/cryptsetup/libcryptsetup12_2.4.3-1ubuntu1_amd64.deb
wget -O libargon2-1_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/a/argon2/libargon2-1_0~20171227-0.3_amd64.deb
wget -O libdevmapper1.02.1_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/l/lvm2/libdevmapper1.02.1_1.02.175-2.1ubuntu4_amd64.deb
wget -O libjson-c5_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/j/json-c/libjson-c5_0.15-2build4_amd64.deb
wget -O libip4tc2_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/i/iptables/libip4tc2_1.8.7-1ubuntu5_amd64.deb

# used for building initrd.img
# - initramfs-tools-core
wget -O initramfs-tools-core_all.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/i/initramfs-tools/initramfs-tools-core_0.140ubuntu13_all.deb
wget -O initramfs-tools-bin_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/i/initramfs-tools/initramfs-tools-bin_0.140ubuntu13_amd64.deb
wget -O klibc-utils_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/k/klibc/klibc-utils_2.0.10-4_amd64.deb
wget -O libklibc_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/k/klibc/libklibc_2.0.10-4_amd64.deb
wget -O cpio_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/c/cpio/cpio_2.13+dfsg-7_amd64.deb
wget -O udev_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/s/systemd/udev_249.11-0ubuntu3_amd64.deb
wget -O zstd_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/libz/libzstd/zstd_1.4.8+dfsg-3build1_amd64.deb
wget -O busybox-initramfs_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/b/busybox/busybox-initramfs_1.30.1-7ubuntu3_amd64.deb

# utilities
# - efibootmgr
wget -O efibootmgr_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/e/efibootmgr/efibootmgr_17-1ubuntu2_amd64.deb
wget -O libefiboot1_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/e/efivar/libefiboot1_37-6ubuntu2_amd64.deb
wget -O libefivar1_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/e/efivar/libefivar1_37-6ubuntu2_amd64.deb
wget -O libpopt0_amd64.deb http://nl.archive.ubuntu.com/ubuntu/pool/main/p/popt/libpopt0_1.18-3build1_amd64.deb

2. Disk modification

  1. Remove all partitions
  • GParted > nvme0n1 > remove all partitions manually
  1. Make new gpt table
  • GParted > nvme0n1 > device > create partition table > gpt
  1. Add new partitions
Order Label Size Format Flags
1 boot 512Mb FAT32 boot, esp
2 root Entire disk EXT4
  1. Mount partitions
# Mount partitions
sudo mkdir /mnt/boot
sudo mount /dev/nvme0n1p1 /mnt/boot
sudo mount /dev/nvme0n1p2 /mnt

Prepare chroot environment

cd /mnt

# extract ubuntu base
sudo tar zxfm ~/Downloads/*.tar.gz

# prepare chroot packages
cp ~/Downloads/*.deb /mnt/tmp

# prepare chroot mounts
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
  1. Update fstab
sudo nano /mnt/etc/fstab
/dev/nvme0n1p1 /boot vfat defaults 0 2
/dev/nvme0n1p2 /     ext4 noatime  0 1

Install system

sudo chroot /mnt

# install most packages
dpkg -i /tmp/*.deb

# configure systemd-sysv
dpkg -i /tmp/systemd-sysv_amd64.deb

# Make initrd
mkinitramfs 5.18.0-051800-generic -o /boot/initrd.img-5.18.0-051800-generic

# Initialize bootloader
efibootmgr --disk /dev/nvme0n1 --part 1 --create --label "Ubuntu 22.04" --loader /vmlinuz --unicode 'root=/dev/nvme0n1p2 rw noquiet nosplash initrd=/initrd.img'

# Add sudo user
adduser user
addgroup user adm
addgroup user sudo

exit

4. Reboot

Restart the system and start installing stuff using apt!

Sources

@dimitsev
Copy link

dimitsev commented Jan 7, 2025

Thank you very much for this guide! ๐Ÿ‘ One question:
Instead of downloading and installing so many .deb packages manually, wouldn't it have been enough to run apt update && apt install linux-generic dialog language-pack-en systemd-sysv initramfs-tools-core efibootmgr inside the chroot environment?

@MerijnHendriks
Copy link
Author

MerijnHendriks commented Jan 27, 2025

Thanks for your message and I'm very sorry for the late reply @dimitsev!
Using apt is definetly possible. Reason I wanted to download all packages separately was to prevent download issues while setting up the device. Also makes for a great rescue usb ๐Ÿ‘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment