Fix fedora-minimal kernel-install on older platforms
fedora-minimal fails to build on Ubuntu Trusty due do being unable to find the initrd (see Id4c04d7ae20068643df34d2fa31068e8a917a52d). This is a rather obscure problem that comes from the intersection of several things. The first thing to note is that the post-install scripts of the kernel-core package use kernel-install [1]. For whatever reason, this installs the kernel to /boot/MACHINE-ID/KERNEL-VERSION MACHINE-ID comes from /etc/machine-id; a UUID that should have been created by the systemd post-inst scripts with systemd-machine-id-setup [2]. The chroot environment provided for root.d elements has no kernel file-systems like /proc or /dev mounted. This is where differences in the base-system come into play -- on more recent systems that implement getrandom() systemd does not need /dev/urandom to generate the machine-id [3]; we get a value and /etc/machine-id is populated. On older platforms (Trusty), systemd-machine-id-setup fails (unable to access /dev/urandom) and we end up with a blank /etc/machine-id. This ends up making kernel-install (the script) fail during yum's installation of kernel-core, which means the initrd is not installed correctly. We end up bailing out in fedora-minimal/install.d/99-ramdisk, where we try to put the installed ramdisk in /boot for the later grub install scripts to find. The solution here is to mount the standard kernel file-systems within the chroot before we try installing. [1] http://www.freedesktop.org/software/systemd/man/kernel-install.html [2] http://www.freedesktop.org/software/systemd/man/systemd-machine-id-setup.html [3] https://github.com/systemd/systemd/blob/master/src/basic/random-util.c Change-Id: Ibcce35da928f64e6a719b070bcc833346ee7ee92
This commit is contained in:
parent
a67ee17d62
commit
f307bb4d8b
@ -97,6 +97,16 @@ if [ -n "$DIB_OFFLINE" -o -n "${DIB_YUMCHROOT_USE_CACHE:-}" ] && [ -f $YUMCHROOT
|
||||
echo $YUMCHROOT_TARBALL found in cache. Using.
|
||||
sudo tar -C $TARGET_ROOT --numeric-owner -xzf $YUMCHROOT_TARBALL
|
||||
else
|
||||
# Note this is not usually done for root.d elements (see
|
||||
# lib/common-functions:mount_proc_dev_sys) but it's important that
|
||||
# we have things like /dev/urandom around inside the chroot for
|
||||
# the rpm [pre|post]inst scripts within the packages.
|
||||
sudo mkdir -p $TARGET_ROOT/proc $TARGET_ROOT/dev $TARGET_ROOT/sys
|
||||
sudo mount -t proc none $TARGET_ROOT/proc
|
||||
sudo mount --bind /dev $TARGET_ROOT/dev
|
||||
sudo mount --bind /dev/pts $TARGET_ROOT/dev/pts
|
||||
sudo mount -t sysfs none $TARGET_ROOT/sys
|
||||
|
||||
# initalize rpmdb
|
||||
sudo mkdir -p $TARGET_ROOT/var/lib/rpm
|
||||
sudo rpm --root $TARGET_ROOT --initdb
|
||||
@ -128,8 +138,14 @@ else
|
||||
install passwd findutils sudo util-linux-ng
|
||||
|
||||
# cleanup
|
||||
# TODO : move this into a exit trap; and reconsider how
|
||||
# this integrates with the global exit cleanup path.
|
||||
sudo rm $TARGET_ROOT/etc/resolv.conf
|
||||
sudo umount $TMP_MOUNT_PATH/tmp/yum
|
||||
sudo umount $TARGET_ROOT/proc
|
||||
sudo umount $TARGET_ROOT/dev/pts
|
||||
sudo umount $TARGET_ROOT/dev
|
||||
sudo umount $TARGET_ROOT/sys
|
||||
|
||||
# RPM doesn't know whether files have been changed since install
|
||||
# At this point though, we know for certain that we have changed no
|
||||
|
Loading…
Reference in New Issue
Block a user