]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Drop HostonlyInitrd
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 18 Nov 2022 10:07:27 +0000 (11:07 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 15 Dec 2022 14:45:24 +0000 (14:45 +0000)
Adding this option was a mistake (mea culpa), we should limit host
impact on image builds as much as possible so let's drop this option
that makes the initrd generated by dracut host specific. This will
slow down initrd generation but once we switch to generating initrds
with mkosi we'll have a proper fix for that.

mkosi.md
mkosi/__init__.py
mkosi/backend.py
mkosi/distributions/centos.py
mkosi/distributions/debian.py
mkosi/distributions/fedora.py
tests/test_config_parser.py

index 4377c0dec266128b2be1c8ff396fae1f33fae286..8ca685a5aa80649e4a7f9a7f38888137c93c2036 100644 (file)
--- a/mkosi.md
+++ b/mkosi.md
@@ -649,14 +649,6 @@ a boolean argument: either "1", "yes", or "true" to enable, or "0",
   installs kernels with a separate initrd and boot loader config to
   the efi or bootloader partition.
 
-`HostonlyInitrd=`, `--hostonly-initrd`
-
-: If specified, mkosi will run the tool to create the initrd such that
-  a non-generic initrd is created that will only be able to run on the
-  system mkosi is run on. Currently mkosi uses dracut for all
-  supported distributions and this option translates to enabling dracut's
-  hostonly option.
-
 `CacheInitrd=`, `--cache-initrd`
 
 : If specified, and incremental mode is used, mkosi will build the initrd
index 1ebb1de3d715a1cca14c93ec09d094c4d96004bb..b6f196053d157552aacef1e61897188c54dfe549 100644 (file)
@@ -1302,11 +1302,6 @@ def configure_dracut(state: MkosiState, cached: bool) -> None:
     dracut_dir = state.root / "etc/dracut.conf.d"
     dracut_dir.mkdir(mode=0o755, exist_ok=True)
 
-    dracut_dir.joinpath('30-mkosi-hostonly.conf').write_text(
-        f'hostonly={yes_no(state.config.hostonly_initrd)}\n'
-        'hostonly_default_device=no\n'
-    )
-
     dracut_dir.joinpath("30-mkosi-qemu.conf").write_text('add_dracutmodules+=" qemu "\n')
 
     with dracut_dir.joinpath("30-mkosi-systemd-extras.conf").open("w") as f:
@@ -1317,11 +1312,6 @@ def configure_dracut(state: MkosiState, cached: bool) -> None:
             for conf in state.root.joinpath("etc/systemd/system.conf.d").iterdir():
                 f.write(f'install_optional_items+=" {Path("/") / conf.relative_to(state.root)} "\n')
 
-    if state.config.hostonly_initrd:
-        dracut_dir.joinpath("30-mkosi-filesystem.conf").write_text(
-            f'filesystems+=" {(state.config.output_format.needed_kernel_module())} "\n'
-        )
-
     if state.get_partition(PartitionIdentifier.esp):
         # efivarfs must be present in order to GPT root discovery work
         dracut_dir.joinpath("30-mkosi-efivarfs.conf").write_text(
@@ -3985,12 +3975,6 @@ def create_parser() -> ArgumentParserMkosi:
         help=argparse.SUPPRESS,
     )
     group.add_argument("--gpt-first-lba", type=int, help="Set the first LBA within GPT Header", metavar="FIRSTLBA")
-    group.add_argument(
-        "--hostonly-initrd",
-        metavar="BOOL",
-        action=BooleanAction,
-        help="Enable dracut hostonly option",
-    )
     group.add_argument(
         "--cache-initrd",
         metavar="BOOL",
@@ -5540,7 +5524,6 @@ def print_summary(config: MkosiConfig) -> None:
             print("           UEFI SecureBoot:", yes_no(config.secure_boot))
             print("     Unified Kernel Images:", yes_no(config.with_unified_kernel_images))
             print("             GPT First LBA:", str(config.gpt_first_lba))
-            print("           Hostonly Initrd:", yes_no(config.hostonly_initrd))
 
     if config.secure_boot or config.verity == "sign":
         print("SecureBoot/Verity Sign Key:", config.secure_boot_key)
index 453ce28811c2d5544f8e3b7d3c7bce34ea5f7662..fd35692bf2ceee8523baf4647e60da1042d671d2 100644 (file)
@@ -579,7 +579,6 @@ class MkosiConfig:
     minimize: bool
     with_unified_kernel_images: bool
     gpt_first_lba: Optional[int]
-    hostonly_initrd: bool
     cache_initrd: bool
     base_packages: Union[str, bool]
     packages: List[str]
index d8336c6f7472273395ce6766b9bd6c4bdf3bfa15..2a9b583848914c968599ac30833d9e98c1ff57a4 100644 (file)
@@ -41,7 +41,7 @@ class CentosInstaller(DistributionInstaller):
         packages = {*state.config.packages}
         add_packages(state.config, packages, "systemd", "dnf")
         if not state.do_run_build_script and state.config.bootable:
-            add_packages(state.config, packages, "kernel", "dracut")
+            add_packages(state.config, packages, "kernel", "dracut", "dracut-config-generic")
             add_packages(state.config, packages, "systemd-udev", conditional="systemd")
 
         if state.do_run_build_script:
index c7ea105b4c433feda0631cb18729bd380e0c1b20..4b505c4343f9111911b9eaaef861e36b2ab72bd9 100644 (file)
@@ -107,7 +107,7 @@ class DebianInstaller(DistributionInstaller):
             extra_packages.update(state.config.build_packages)
 
         if not state.do_run_build_script and state.config.bootable:
-            add_packages(state.config, extra_packages, "dracut")
+            add_packages(state.config, extra_packages, "dracut", "dracut-config-generic")
             cls._add_default_kernel_package(state, extra_packages)
 
             if state.config.output_format == OutputFormat.gpt_btrfs:
index 97c94386b2713af79cffd0680c3c4ac0fb899ffb..cf35a7055de3f0d3cf8f242ba38979e081c1cf92 100644 (file)
@@ -133,7 +133,7 @@ def install_fedora(state: MkosiState) -> None:
     add_packages(state.config, packages, "systemd", "util-linux", "dnf")
 
     if not state.do_run_build_script and state.config.bootable:
-        add_packages(state.config, packages, "kernel-core", "kernel-modules", "dracut")
+        add_packages(state.config, packages, "kernel-core", "kernel-modules", "dracut", "dracut-config-generic")
         add_packages(state.config, packages, "systemd-udev", conditional="systemd")
     if state.do_run_build_script:
         packages.update(state.config.build_packages)
index c946820e6c88432a10e3944dcfd0dae15f161d48..b6eea4680ce4aff672c2dbcee2381233eca4806b 100644 (file)
@@ -155,7 +155,6 @@ class MkosiConfig:
             "netdev": False,
             "ephemeral": False,
             "with_unified_kernel_images": True,
-            "hostonly_initrd": False,
             "cache_initrd": False,
             "ssh": False,
             "ssh_key": None,
@@ -301,8 +300,6 @@ class MkosiConfig:
                 self.reference_config[job_name]["with_unified_kernel_images"] = mk_config_output[
                     "WithUnifiedKernelImages"
                 ]
-            if "HostonlyInitrd" in mk_config_output:
-                self.reference_config[job_name]["hostonly_initrd"] = mk_config_output["HostonlyInitrd"]
             if "CacheInitrd" in mk_config_output:
                 self.reference_config[job_name]["cache_initrd"] = mk_config_output["CacheInitrd"]
             if "MachineID" in mk_config_output: