From: Daan De Meyer Date: Thu, 6 Apr 2023 09:27:24 +0000 (+0200) Subject: Only install basic filesystem package by default X-Git-Tag: v15~261^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55a22ab33f9c0d0a5a74464e61e62f0450ee8ce6;p=thirdparty%2Fmkosi.git Only install basic filesystem package by default Let's trim down on the default packages we install, and only install the most basic filesystem package by default. We'll leave everything else up to the user. This change is important when considering mkosi's use to build system extensions and similar, where even the default packages we have now are too much. --- diff --git a/NEWS.md b/NEWS.md index 7e3896287..7a09833a5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -58,7 +58,10 @@ runtime. Use the new `--qemu-gui` option to start qemu in its graphical interface. - Removed `--netdev`. Can be replaced by manually installing systemd-networkd, putting a network file in the image and enabling systemd-networkd. -- If `mkosi.extra/` exists, it is now always used instead of only when no explicit extra trees are defined. +- If `mkosi.extra/` or `mkosi.skeleton/` exist, they are now always used instead of only when no explicit + extra/skeleton trees are defined. +- mkosi doesn't install any default packages anymore aside from the base filesystem layout package. In + practice, this means systemd and other basic tools have to be installed explicitly from now on. - Removed `--qcow2` option in favor of supporting only raw disk images as the disk image output format. - Removed `--bmap` option as it can be trivially added manually by utilizing a finalize script. - The `never` value for `--with-network` was spun of into its own custom option `--cache-only`. diff --git a/mkosi/distributions/arch.py b/mkosi/distributions/arch.py index 71859dbab..02a19e739 100644 --- a/mkosi/distributions/arch.py +++ b/mkosi/distributions/arch.py @@ -87,7 +87,7 @@ def install_arch(state: MkosiState) -> None: f.write(f"Include = {d}/*\n") packages = state.config.packages.copy() - add_packages(state.config, packages, "base") + add_packages(state.config, packages, "filesystem") if state.config.bootable and not state.config.initrds: add_packages(state.config, packages, "dracut") diff --git a/mkosi/distributions/centos.py b/mkosi/distributions/centos.py index f1f05eb0d..43260c74f 100644 --- a/mkosi/distributions/centos.py +++ b/mkosi/distributions/centos.py @@ -95,7 +95,7 @@ class CentosInstaller(DistributionInstaller): env = {} packages = state.config.packages.copy() - add_packages(state.config, packages, "systemd", "rpm") + add_packages(state.config, packages, "filesystem") if state.config.bootable: add_packages(state.config, packages, "kernel") if not state.config.initrds: @@ -106,14 +106,6 @@ class CentosInstaller(DistributionInstaller): if state.config.ssh: add_packages(state.config, packages, "openssh-server") - if "epel" in state.config.repositories: - add_packages(state.config, packages, "epel-release") - - # Make sure we only install the minimal language files by default on CentOS Stream 8 which still - # defaults to all langpacks. - if release <= 8: - add_packages(state.config, packages, "glibc-minimal-langpack") - invoke_dnf(state, "install", packages, env) syslog = state.root.joinpath("etc/systemd/system/syslog.service") diff --git a/mkosi/distributions/debian.py b/mkosi/distributions/debian.py index f03b5a1a0..50e4dc234 100644 --- a/mkosi/distributions/debian.py +++ b/mkosi/distributions/debian.py @@ -25,14 +25,6 @@ class DebianInstaller(DistributionInstaller): if not any(package.startswith("linux-image") for package in packages): add_packages(state.config, packages, f"linux-image-{DEBIAN_KERNEL_ARCHITECTURES[state.config.architecture]}") - @classmethod - def _fixup_resolved(cls, state: MkosiState, packages: list[str]) -> None: - if "systemd" in packages and "systemd-resolved" not in packages: - # The default resolv.conf points to 127.0.0.1, and resolved is disabled, fix it in - # the base image. - state.root.joinpath("etc/resolv.conf").unlink(missing_ok=True) - state.root.joinpath("etc/resolv.conf").symlink_to("../run/systemd/resolve/resolv.conf") - @classmethod def filesystem(cls) -> str: return "ext4" @@ -90,7 +82,7 @@ class DebianInstaller(DistributionInstaller): # conflicts. dbus and libpam-systemd are optional dependencies for systemd in debian so we include them # explicitly. packages = state.config.packages.copy() - add_packages(state.config, packages, "systemd", "systemd-sysv", "dbus", "libpam-systemd") + add_packages(state.config, packages, "base-files") if state.config.bootable: if not state.config.initrds: @@ -155,9 +147,6 @@ class DebianInstaller(DistributionInstaller): if state.config.bootable: add_apt_package_if_exists(state, packages, "systemd-boot") - # systemd-resolved was split into a separate package - add_apt_package_if_exists(state, packages, "systemd-resolved") - invoke_apt(state, "get", "install", ["--assume-yes", "--no-install-recommends", *packages]) # Now clean up and add the real repositories, so that the image is ready @@ -173,8 +162,6 @@ class DebianInstaller(DistributionInstaller): # Don't ship dpkg config files in extensions, they belong with dpkg in the base image. dpkg_nodoc_conf.unlink() # type: ignore - cls._fixup_resolved(state, packages) - # Debian/Ubuntu use a different path to store the locale so let's make sure that path is a symlink to # etc/locale.conf. state.root.joinpath("etc/default/locale").unlink(missing_ok=True) diff --git a/mkosi/distributions/fedora.py b/mkosi/distributions/fedora.py index 15d8fa952..df9c46e48 100644 --- a/mkosi/distributions/fedora.py +++ b/mkosi/distributions/fedora.py @@ -97,7 +97,7 @@ def install_fedora(state: MkosiState) -> None: setup_dnf(state, repos) packages = state.config.packages.copy() - add_packages(state.config, packages, "systemd", "util-linux", "rpm") + add_packages(state.config, packages, "filesystem") if state.config.bootable: add_packages(state.config, packages, "kernel-core", "kernel-modules") diff --git a/mkosi/distributions/mageia.py b/mkosi/distributions/mageia.py index e82257b23..597556d04 100644 --- a/mkosi/distributions/mageia.py +++ b/mkosi/distributions/mageia.py @@ -58,7 +58,7 @@ def install_mageia(state: MkosiState) -> None: setup_dnf(state, repos) packages = state.config.packages.copy() - add_packages(state.config, packages, "basesystem-minimal", "dnf") + add_packages(state.config, packages, "filesystem") if state.config.bootable and not state.config.initrds: add_packages(state.config, packages, "dracut") # Mageia ships /etc/50-mageia.conf that omits systemd from the initramfs and disables hostonly. diff --git a/mkosi/distributions/openmandriva.py b/mkosi/distributions/openmandriva.py index 08a0ab1ec..987038fc0 100644 --- a/mkosi/distributions/openmandriva.py +++ b/mkosi/distributions/openmandriva.py @@ -60,7 +60,7 @@ def install_openmandriva(state: MkosiState) -> None: packages = state.config.packages.copy() # well we may use basesystem here, but that pulls lot of stuff - add_packages(state.config, packages, "basesystem-minimal", "systemd", "dnf") + add_packages(state.config, packages, "filesystem") if state.config.bootable: add_packages(state.config, packages, "systemd-boot", "systemd-cryptsetup", conditional="systemd") add_packages(state.config, packages, "kernel-release-server", "timezone") diff --git a/mkosi/distributions/opensuse.py b/mkosi/distributions/opensuse.py index 3f92f882a..5710907ac 100644 --- a/mkosi/distributions/opensuse.py +++ b/mkosi/distributions/opensuse.py @@ -169,12 +169,7 @@ def install_opensuse(state: MkosiState) -> None: packages = state.config.packages.copy() if state.config.base_image is None: - add_packages(state.config, packages, "systemd", "glibc-locale-base", "zypper") - - if state.config.release.startswith("42."): - add_packages(state.config, packages, "patterns-openSUSE-minimal_base") - else: - add_packages(state.config, packages, "patterns-base-minimal_base") + add_packages(state.config, packages, "filesystem") if state.config.bootable: add_packages(state.config, packages, "kernel-default") diff --git a/mkosi/distributions/ubuntu.py b/mkosi/distributions/ubuntu.py index 09303879a..6b49418d7 100644 --- a/mkosi/distributions/ubuntu.py +++ b/mkosi/distributions/ubuntu.py @@ -31,7 +31,3 @@ class UbuntuInstaller(DebianInstaller): security = f"deb http://ports.ubuntu.com/ {state.config.release}-security {' '.join(repos)}" state.root.joinpath(f"etc/apt/sources.list.d/{state.config.release}-security.list").write_text(f"{security}\n") - - @classmethod - def _fixup_resolved(cls, state: MkosiState, packages: Sequence[str]) -> None: - pass