]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Reduce amount of packages in default image
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 28 Sep 2025 20:01:00 +0000 (22:01 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 15 Oct 2025 18:59:06 +0000 (20:59 +0200)
Let's introduce some profiles and remove unused packages to reduce
the size of the default image.

Both building the rpm and running mkosi inside the default image are
only rarely useful and shouldn't slow down image builds by default,
so we move both of these operations into their own profiles.

We drop the fish,zsh shells from the default image and also drop
qemu-user-static.

We also clean up a little inside mkosi-vm, getting rid of duplicated
packages across the main and per distro configs.

21 files changed:
mkosi.conf
mkosi.conf.d/arch.conf
mkosi.conf.d/azure-centos-fedora/mkosi.conf
mkosi.conf.d/centos.conf
mkosi.conf.d/debian-kali-ubuntu/mkosi.conf
mkosi.conf.d/fedora/mkosi.conf
mkosi.conf.d/fedora/mkosi.conf.d/x86_64.conf
mkosi.conf.d/opensuse/mkosi.conf
mkosi.postinst
mkosi.profiles/mkosi-depends/mkosi.conf [new file with mode: 0644]
mkosi.profiles/mkosi-depends/mkosi.prepare [moved from mkosi.prepare with 100% similarity]
mkosi.profiles/rpm/mkosi.build.chroot [moved from mkosi.conf.d/rpm/mkosi.build.chroot with 100% similarity]
mkosi.profiles/rpm/mkosi.conf [moved from mkosi.conf.d/rpm/mkosi.conf with 72% similarity]
mkosi.profiles/rpm/mkosi.prepare [moved from mkosi.conf.d/rpm/mkosi.prepare with 100% similarity]
mkosi/resources/mkosi-initrd/mkosi.conf.d/opensuse.conf
mkosi/resources/mkosi-initrd/mkosi.conf.d/postmarketos.conf
mkosi/resources/mkosi-vm/mkosi.conf
mkosi/resources/mkosi-vm/mkosi.conf.d/arch.conf
mkosi/resources/mkosi-vm/mkosi.conf.d/debian-kali-ubuntu/mkosi.conf
mkosi/resources/mkosi-vm/mkosi.conf.d/opensuse.conf
mkosi/resources/mkosi-vm/mkosi.conf.d/postmarketos.conf

index f0f61f3741dbb1301322ac096c79c8e0a9845dcd..0e9be29b948c9d5fd301eb7154554dbff0728f1f 100644 (file)
@@ -25,14 +25,9 @@ ShimBootloader=unsigned
 Packages=
         binutils
         gdb
-        sudo
-        tmux
         wireless-regdb
-        zsh
 
 InitrdProfiles=lvm
-InitrdPackages=
-        less
 
 RemoveFiles=
         # The grub install plugin doesn't play nice with booting from virtiofs.
index 81ff9446b8efcbc6f59e90b02b50d57b55ec460e..b3704b3aea3bf76112a005f6e843e62023ef255d 100644 (file)
@@ -8,5 +8,4 @@ Packages=
         grub
         openssh
         python
-        qemu-user-static
         shim
index 7558d8b9227d65f1c330eeb20fe51964aa99337b..afba426c869c1d037be9fbbbc92ef1f52f9f45cf 100644 (file)
@@ -11,5 +11,3 @@ Distribution=|azure
 Packages=
         openssh-clients
         openssh-server
-        python3
-        rpm-build
index 0cade4bca93965aea74c95d5bdf3b77e21a54fec..0a23ce4a3a4360f8acfd139ef0becdb59dbc6220 100644 (file)
@@ -12,6 +12,3 @@ Repositories=epel
 [Content]
 # CentOS Stream 10 does not ship an unsigned shim
 ShimBootloader=none
-Packages=
-        linux-firmware
-        rpmautospec
index de663544706af2f6705524f49ed47fa9bdece4c2..0e3fc5cd6e47a61ba3d798c89f5a25508d676c1f 100644 (file)
@@ -7,8 +7,6 @@ Distribution=|ubuntu
 
 [Content]
 Packages=
-        fish
         openssh-client
         openssh-server
         python3
-        qemu-user-static
index 6021758f05d42e6eb14c078a0e2f9b68af959860..5ecb4d48d2d41141918f0562e9ef69aba5bfc31a 100644 (file)
@@ -5,9 +5,3 @@ Distribution=fedora
 
 [Distribution]
 Release=rawhide
-
-[Content]
-Packages=
-        fish
-        qemu-user-static
-        rpmautospec
index dea16c8ab15449e192dacc59e0b091a667ce383c..1ffd9d4e21ab67359746418c9c0c6e2a60d4d1fd 100644 (file)
@@ -6,5 +6,4 @@ Architecture=x86-64
 [Content]
 Packages=
         amd-ucode-firmware
-        kernel-uki-virt
         shim-unsigned-x64
index 9f6d02715bf2d8e9fa4d2714fd9584d7a6f5ce8a..84bda2b46053dcf1a2d68f3afba2d4866bccb2d0 100644 (file)
@@ -10,17 +10,6 @@ Release=tumbleweed
 # openSUSE does not ship an unsigned shim
 ShimBootloader=none
 Packages=
-        diffutils
-        fish
         openssh-clients
         openssh-server
-        python3
-        qemu-linux-user
         shim
-        sudo-policy-wheel-auth-self
-
-        # Various packages added as dependencies. If they are not explicitly installed, the zypper inner
-        # logic picks the busybox-package variant, which adds also busybox in the image.
-        grep
-        gzip
-        xz
index fa7ec25a46c22bada04cdb304bfb63f81d423ded..a3554c9211ebe8a7d924d66a86ca92dfe58a2ec6 100755 (executable)
@@ -2,18 +2,12 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 set -e
 
-if [[ "$DISTRIBUTION" =~ ubuntu|kali|debian ]]; then
-    SUDO_GROUP=sudo
-else
-    SUDO_GROUP=wheel
-fi
-
 mkosi-chroot \
     useradd \
     --user-group \
     --create-home \
     --password "$(openssl passwd -1 mkosi)" \
-    --groups "$SUDO_GROUP",systemd-journal \
+    --groups systemd-journal \
     --shell /bin/bash \
     --uid 4711 \
     mkosi
diff --git a/mkosi.profiles/mkosi-depends/mkosi.conf b/mkosi.profiles/mkosi-depends/mkosi.conf
new file mode 100644 (file)
index 0000000..990dda4
--- /dev/null
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+[Content]
+Packages=python3
similarity index 72%
rename from mkosi.conf.d/rpm/mkosi.conf
rename to mkosi.profiles/rpm/mkosi.conf
index 8efdb00a7d69516058f153ec89ff7eee9600f125..4c4ad035cf17aa1bf144056592f4a966bd0cf5a7 100644 (file)
@@ -1,10 +1,16 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 
 [Match]
-BuildSources=rpm
 Distribution=fedora
 
+[Build]
+BuildSources=rpm
+
 [Content]
+Packages=
+        rpm-build
+        rpmautospec
+
 VolatilePackages=
         mkosi
         mkosi-initrd
index 76e22c432d3122818ea660c3cd8911ec57fab83f..83ba50f76770765c3455b140b39dd09e7e2bed6a 100644 (file)
@@ -11,7 +11,6 @@ Packages=
         # logic picks the busybox-package variant, which adds also busybox in the initrd.
         diffutils
         grep
-        gzip
         xz
 
         # Various libraries that are dlopen'ed by systemd
index db354729b73cd8633da36c41b3c2c1165931f895..1e3cebad1f63ee8d66165199525b74ee43b2b7e9 100644 (file)
@@ -8,4 +8,3 @@ Packages=
         kbd
         libseccomp
         util-linux
-        systemd-udevd
index 5fd2d771bc6bbbc4988dd0d78d83bc1b350c4b56..ebdfc1d2af8d048ed5a15fbf3c618dfd8c1b768e 100644 (file)
@@ -5,6 +5,7 @@ Bootable=yes
 
 Packages=
         bash
+        dbus-broker
         diffutils
         gawk
         grep
index 3387e6576476de15a2a3259957c197eaf9e2f87f..99a48a99125ac5002d955ca4f53220565c29b08f 100644 (file)
@@ -5,7 +5,6 @@ Distribution=arch
 
 [Content]
 Packages=
-        dbus-broker
         dbus-broker-units
         iproute
         iputils
index a979b06a9b8d69283cd12f5c87cda0b900ebf185..be7677a41f6c10694ba4dc444014c64b0467efb2 100644 (file)
@@ -7,8 +7,6 @@ Distribution=|ubuntu
 
 [Content]
 Packages=
-        bash
-        dbus-broker
         iproute2
         iputils-ping
         login
index 7cb4dda1ddb6178766fc91a2f9e5e1b129f9fa94..c56f696d36fc1eee5518a3aa1b2a5fe49df520e0 100644 (file)
@@ -15,3 +15,7 @@ Packages=
         systemd-boot
         systemd-network
         tpm2.0-tools
+
+        # Various packages added as dependencies. If they are not explicitly installed, the zypper inner
+        # logic picks the busybox-package variant, which adds also busybox in the image.
+        xz
index d98a7a2552085cc0389c9f5de5d0918f9acbe47b..836e5b0dd487ee55e97178b75c5ed523e0c56aae 100644 (file)
@@ -6,7 +6,6 @@ Distribution=postmarketos
 [Content]
 Packages=
         agetty # required for *getty@ services
-        dbus-broker
         iproute2
         iputils
         kmod   # mkosi is incompatible with busybox depmod