From 1d476dd9943e15be81e765742ee75578df19e884 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 19 Nov 2015 14:51:03 +1100 Subject: [PATCH] Remove fedora-minimal/install.d/99-ramdisk When the kernel gets installed on Fedora, the rpm post scripts call "/bin/kernel-install" [1] to install it. This is a script provided by systemd. However, in [2], Fedora ships a patch to kernel-install that makes a call-out to /sbin/new-kernel-pkg -- the install script provided by grubby [3] Without grubby installed, systemd's kernel-install script goes off and runs dracut plugins directly [4], which eventually creates the initrd. For reasons that are not clearly explained, the initrd will end up in a a "machine-id" sub-directory of /boot (possibly, so you can symlink it?). It is also called "initrd", even though it's an initramfs, for historical reasons in dracut I think. It is at this point that I think 99-ramdisk has been written to move the generated initrd file back into /boot. Later on, when we build the image, we run grub-install and it picks up the kernel and the initrd and installs everything. grubby's new-kernel-pkg [6] it's very similar -- it uses dracut to make the initramfs ... but in this case it is put in /boot and is actually called initramfs. The subtle change that led me down this path is that dracut has been modified to have a "Recommends" for grubby for >F22 [7]. After discussing this change with the author, it turns out it was *always* intended to use the grubby-based kernel install scripts for Fedora -- our builds have been incorrect in not including the package. The author got sick of people removing the package and making unbootable systems, hence the change. Thus this removes the workarounds in 99-ramdisk and replace it with an install of the grubby package. grubby's kernel install script will put the kernel & generated initramfs in /boot, and it will be installed correctly via the usual grub install later when we build the disk image. I have built F22 & F23 fedora-minimal images with this and they boot. [1] http://pkgs.fedoraproject.org/cgit/kernel.git/tree/kernel.spec#n1832 [2] http://pkgs.fedoraproject.org/cgit/systemd.git/tree/kernel-install-grubby.patch [3] http://linux.die.net/man/8/new-kernel-pkg [4] https://github.com/haraldh/dracut/blob/master/50-dracut.install [5] https://github.com/systemd/systemd/commit/81516adcb71a47837544340f72eb8ee810274119 [6] https://github.com/rhinstaller/grubby/blob/master/new-kernel-pkg [7] https://github.com/haraldh/dracut/commit/47ff68e78b3bbd01367948b5b9fe1cbaeb45f262 Change-Id: I1a6e45d04755515286b3d49f8280c16b527e2f48 --- elements/fedora-minimal/install.d/99-ramdisk | 28 -------------------- elements/yum-minimal/package-installs.yaml | 1 + 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100755 elements/fedora-minimal/install.d/99-ramdisk diff --git a/elements/fedora-minimal/install.d/99-ramdisk b/elements/fedora-minimal/install.d/99-ramdisk deleted file mode 100755 index 2da6db73a..000000000 --- a/elements/fedora-minimal/install.d/99-ramdisk +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then - set -x -fi -set -eu -set -o pipefail - -# The RPM postinst packages for "kernel-core" have used kernel-install -# to (quoting from man) -# -# add KERNEL-VERSION KERNEL-IMAGE -# kernel-install creates the directory /boot/MACHINE-ID/KERNEL-VERSION/ -# and calls every executable /usr/lib/kernel/install.d/*.install and -# /etc/kernel/install.d/*.install ... -# -# We just want the initrd in /boot. Our later grub scripts will fix -# up the bootloader configuration - -initrd=$(find /boot -name initrd) -kernel_version=$(rpm -qa | grep kernel | sort | head -n 1 | cut -d '-' -f 2,3) - -if [ -n "$initrd" -a $(echo "$initrd" | wc -l) -eq 1 ]; then - cp $initrd /boot/initrd-$kernel_version.img -else - echo "Zero or multiple initrds found. This should not happen." - exit 1 -fi diff --git a/elements/yum-minimal/package-installs.yaml b/elements/yum-minimal/package-installs.yaml index 4b65e6544..9d3a3d392 100644 --- a/elements/yum-minimal/package-installs.yaml +++ b/elements/yum-minimal/package-installs.yaml @@ -1,4 +1,5 @@ dracut: +grubby: kernel: initscripts: man-pages: