Backport PR #1688 to fix Rawhide bug #1648472

This commit is contained in:
Adam Williamson 2018-11-09 16:04:57 -08:00
parent 7d8060b9e3
commit dc43817ead
2 changed files with 88 additions and 1 deletions

View File

@ -0,0 +1,80 @@
From e5619c9d094833fd9d256c2c8d1ad22fc43b3b13 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Fri, 9 Nov 2018 14:42:28 -0800
Subject: [PATCH] Re-generate BLS loader file snippets on live installs
(#1648472)
Currently, on live installs, the BLS loader snippets that are
part of the live image itself - in /boot/loader/entries - are
simply rsync'ed into the installed system along with everything
else. This is no good in most cases because they point to
`/boot/vmlinuz-(foo)` and `/boot/initramfs-(foo)` (since the
live image itself does not have a separate /boot partition),
whereas most installs will have a separate /boot partition so
the path specified in the config snippet should not include
`/boot`. (The files are also named for the machine ID that was
used during live image generation, which will not be the machine
ID of the installed system; I'm not sure exactly what the
consequences of this are, probably nothing major but it may be
somehow an issue when the kernel is removed, perhaps.)
To fix this, we should exclude these files from the rsync, and
instead do something to have them re-generated after the rsync
has run. There are a few different ways and places we could do
this, but my choice is to run `kernel-install` in live payload
postInstall. This seems like it should be fairly robust. In
testing it does the job, both BIOS and UEFI installs that I
tested installed cleanly and booted successfully. Note that
`kernel-install` must run *after* `/etc/machine-id` exists in
the install root, or it will bail immediately and do nothing.
Note that at present, the 'Generating rescue image' step in
`install()` actually results in the generation of a machine ID,
so this could be done any time after that, but doing it after
the explicit failsafe machine ID generation in `postInstall()`
seems safest.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
pyanaconda/payload/livepayload.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/pyanaconda/payload/livepayload.py b/pyanaconda/payload/livepayload.py
index 04f7e2b79..2749f540e 100644
--- a/pyanaconda/payload/livepayload.py
+++ b/pyanaconda/payload/livepayload.py
@@ -48,6 +48,7 @@ from pyanaconda.anaconda_loggers import get_packaging_logger
log = get_packaging_logger()
from pyanaconda.errors import errorHandler, ERROR_RAISE
+from pyanaconda.flags import flags
from pyanaconda.progress import progressQ
from blivet.size import Size
import blivet.util
@@ -143,6 +144,7 @@ class LiveImagePayload(ImagePayload):
# file system boundaries
args = ["-pogAXtlHrDx", "--exclude", "/dev/", "--exclude", "/proc/",
"--exclude", "/sys/", "--exclude", "/run/", "--exclude", "/boot/*rescue*",
+ "--exclude", "/boot/loader/", "--exclude", "/boot/efi/loader/",
"--exclude", "/etc/machine-id", INSTALL_TREE + "/", util.getSysroot()]
try:
rc = util.execWithRedirect(cmd, args)
@@ -194,9 +196,16 @@ class LiveImagePayload(ImagePayload):
super().postInstall()
# Make sure the new system has a machine-id, it won't boot without it
+ # (and nor will some of the subsequent commands)
if not os.path.exists(util.getSysroot() + "/etc/machine-id"):
+ log.info("Generating machine ID")
util.execInSysroot("systemd-machine-id-setup", [])
+ for kernel in self.kernelVersionList:
+ if flags.blscfg:
+ log.info("Regenerating BLS info for %s", kernel)
+ util.execInSysroot("kernel-install", ["add", kernel, "/lib/modules/{0}/vmlinuz".format(kernel)])
+
@property
def spaceRequired(self):
return Size(util.getDirSize("/") * 1024)
--
2.19.1

View File

@ -7,7 +7,7 @@
Summary: Graphical system installer
Name: anaconda
Version: 30.10
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+ and MIT
Group: Applications/System
URL: http://fedoraproject.org/wiki/Anaconda
@ -19,6 +19,9 @@ URL: http://fedoraproject.org/wiki/Anaconda
# make dist
Source0: %{name}-%{version}.tar.bz2
# Fix Rawhide live image boot fail bug #1648472
Patch0: 0001-Re-generate-BLS-loader-file-snippets-on-live-install.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
@ -251,6 +254,7 @@ runtime on NFS/HTTP/FTP servers or local disks.
%prep
%setup -q
%patch0 -p1
%build
# use actual build-time release number, not tarball creation time release number
@ -353,6 +357,9 @@ update-desktop-database &> /dev/null || :
%{_prefix}/libexec/anaconda/dd_*
%changelog
* Fri Nov 09 2018 Adam Williamson <awilliam@redhat.com> - 30.10-2
- Backport PR #1688 to fix Rawhide bug #1648472
* Tue Nov 06 2018 Martin Kolman <mkolman@redhat.com> - 30.10-1
- Make the pyanaconda/image.py more pep8 (jkonecny)
- Test image repodata folder based on treeinfo file (jkonecny)