This patch adds one more step to LiveCD installations -- generating new initrd after the installation. With the DracutHostOnly feature [1] dracut now includes only one keymap to the initrd image which makes the vconsole.keymap boot option not working. Users need the keymap they used in the installation in the initrd, especially when they use LUKS.
However, to save 3 MB (summed size of all keymaps) in the initrd size, all live installations would generate initrd twice -- when the kernel package is installed and at the end of the installation.
Vratislav Podzimek (1): Regenerate initrd on live installations (#994180)
pyanaconda/install.py | 19 +++++++++++++++---- pyanaconda/iutil.py | 5 +++++ 2 files changed, 20 insertions(+), 4 deletions(-)
Fedora now uses --host-only initrds that don't have all keymaps, just the one that was set in the /etc/vconsole.conf at the time of initrd generation.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/install.py | 19 +++++++++++++++---- pyanaconda/iutil.py | 5 +++++ 2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py index ab00369..0a42b2e 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -27,6 +27,7 @@ from pyanaconda.progress import progress_report, progressQ from pyanaconda.users import createLuserConf, getPassAlgo, Users from pyanaconda import flags from pyanaconda import timezone +from pyanaconda import iutil from pyanaconda.i18n import _ from pyanaconda.threads import threadMgr import logging @@ -53,11 +54,16 @@ def doConfiguration(storage, payload, ksdata, instClass): from pyanaconda.kickstart import runPostScripts
step_count = 5 - # if a realm was discovered, - # increment the counter as the - # real joining step will be executed + + # if a realm was discovered, increment the counter as the real joining step + # will be executed if ksdata.realm.discovered: - step_count = 6 + step_count += 1 + + # one more step for regenerating initrd in live installations (see #994180) + if flags.flags.livecdInstall: + step_count += 1 + progressQ.send_init(step_count)
# Now run the execute methods of ksdata that require an installed system @@ -89,6 +95,11 @@ def doConfiguration(storage, payload, ksdata, instClass): ksdata.addons.execute(storage, ksdata, instClass, u) ksdata.configured_spokes.execute(storage, ksdata, instClass, u)
+ # see rhbz#994180 + if flags.flags.livecdInstall: + with progress_report(_("Generating initrd")): + iutil.regenerate_initrd() + if ksdata.realm.discovered: with progress_report(_("Joining realm: %s") % ksdata.realm.discovered): ksdata.realm.execute(storage, ksdata, instClass) diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py index 4e362ff..dd6eb9d 100644 --- a/pyanaconda/iutil.py +++ b/pyanaconda/iutil.py @@ -742,3 +742,8 @@ def lowerASCII(s): locale-independent. """ return string.translate(_toASCII(s), _ASCIIlower_table) + +def regenerate_initrd(root=ROOT_PATH): + """Regenerate initrd with dracut.""" + + execWithRedirect("dracut", ["-f"], root=ROOT_PATH)
On Thu, Sep 05, 2013 at 03:32:42PM +0200, Vratislav Podzimek wrote:
This patch adds one more step to LiveCD installations -- generating new initrd after the installation. With the DracutHostOnly feature [1] dracut now includes only one keymap to the initrd image which makes the vconsole.keymap boot option not working. Users need the keymap they used in the installation in the initrd, especially when they use LUKS.
However, to save 3 MB (summed size of all keymaps) in the initrd size, all live installations would generate initrd twice -- when the kernel package is installed and at the end of the installation.
Live doesn't install packages, so it would only be once.
I'm not totally opposed to this, but I wonder if this should be fixed in the livecd tools instead? The kernel included on the iso should not be host-only and we're just rsyncing it over to the target system.
The drawback there is on the first kernel upgrade thing would be a lot different, introducing the possibility (small, but there) of something going wrong so maybe it is better to regenerate sooner.
I think I've just talked myself into acking this. Unless anyone else has concerns?
On Thu, 2013-09-05 at 15:29 -0700, Brian C. Lane wrote:
On Thu, Sep 05, 2013 at 03:32:42PM +0200, Vratislav Podzimek wrote:
This patch adds one more step to LiveCD installations -- generating new initrd after the installation. With the DracutHostOnly feature [1] dracut now includes only one keymap to the initrd image which makes the vconsole.keymap boot option not working. Users need the keymap they used in the installation in the initrd, especially when they use LUKS.
However, to save 3 MB (summed size of all keymaps) in the initrd size, all live installations would generate initrd twice -- when the kernel package is installed and at the end of the installation.
Live doesn't install packages, so it would only be once.
I'm not totally opposed to this, but I wonder if this should be fixed in the livecd tools instead? The kernel included on the iso should not be host-only and we're just rsyncing it over to the target system.
The drawback there is on the first kernel upgrade thing would be a lot different, introducing the possibility (small, but there) of something going wrong so maybe it is better to regenerate sooner.
I think I've just talked myself into acking this. Unless anyone else has concerns?
I found out that it affects both live and DVD installations so re-generating initrd would need to happen always. Also dracut generates an initrd for the currently running kernel, which might be different from the installed one. I've added '--regenerate-all' to the dracut invocation, but that may prolong the action.
I really think we shouldn't be bothering with that at all. But it seems nobody else will do any change, so we need to fix this dracut's bug on our side. We could write out keyboard and language configuration files before the package installation/copying files, but I don't want to play this game of hacks. Some more files like those might appear in the future and it would break again.
Fedora now uses --host-only initrds that don't have all keymaps, just the one that was set in the /etc/vconsole.conf at the time of initrd generation.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/install.py | 16 +++++++++++----- pyanaconda/iutil.py | 6 ++++++ 2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py index ab00369..c5969ab 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -27,6 +27,7 @@ from pyanaconda.progress import progress_report, progressQ from pyanaconda.users import createLuserConf, getPassAlgo, Users from pyanaconda import flags from pyanaconda import timezone +from pyanaconda import iutil from pyanaconda.i18n import _ from pyanaconda.threads import threadMgr import logging @@ -52,12 +53,13 @@ def _writeKS(ksdata): def doConfiguration(storage, payload, ksdata, instClass): from pyanaconda.kickstart import runPostScripts
- step_count = 5 - # if a realm was discovered, - # increment the counter as the - # real joining step will be executed + step_count = 6 + + # if a realm was discovered, increment the counter as the real joining step + # will be executed if ksdata.realm.discovered: - step_count = 6 + step_count += 1 + progressQ.send_init(step_count)
# Now run the execute methods of ksdata that require an installed system @@ -89,6 +91,10 @@ def doConfiguration(storage, payload, ksdata, instClass): ksdata.addons.execute(storage, ksdata, instClass, u) ksdata.configured_spokes.execute(storage, ksdata, instClass, u)
+ # see rhbz#994180 + with progress_report(_("Generating initrd")): + iutil.regenerate_initrd() + if ksdata.realm.discovered: with progress_report(_("Joining realm: %s") % ksdata.realm.discovered): ksdata.realm.execute(storage, ksdata, instClass) diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py index 4e362ff..31d7f12 100644 --- a/pyanaconda/iutil.py +++ b/pyanaconda/iutil.py @@ -742,3 +742,9 @@ def lowerASCII(s): locale-independent. """ return string.translate(_toASCII(s), _ASCIIlower_table) + +def regenerate_initrd(root=ROOT_PATH): + """Regenerate initrd with dracut.""" + + print "Generating initrd" + execWithRedirect("dracut", ["-f", "--regenerate-all"], root=ROOT_PATH)
From: "Brian C. Lane" bcl@redhat.com
dracut depends on some of the configuration settings we write out in doConfiguration so we need to always regenerate the initramfs for the system after we write these.
-- I realized that livepayload was already doign this, and that the driver disk -- code does as well. I think this patch should cover all the cases. --- pyanaconda/install.py | 7 +++++-- pyanaconda/packaging/__init__.py | 12 +++++++++--- pyanaconda/packaging/livepayload.py | 1 - 3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py index ab00369..4b23016 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -52,12 +52,12 @@ def _writeKS(ksdata): def doConfiguration(storage, payload, ksdata, instClass): from pyanaconda.kickstart import runPostScripts
- step_count = 5 + step_count = 6 # if a realm was discovered, # increment the counter as the # real joining step will be executed if ksdata.realm.discovered: - step_count = 6 + step_count += 1 progressQ.send_init(step_count)
# Now run the execute methods of ksdata that require an installed system @@ -89,6 +89,9 @@ def doConfiguration(storage, payload, ksdata, instClass): ksdata.addons.execute(storage, ksdata, instClass, u) ksdata.configured_spokes.execute(storage, ksdata, instClass, u)
+ with progress_report(_("Generating initramfs")): + payload.recreateInitrds(force=True) + if ksdata.realm.discovered: with progress_report(_("Joining realm: %s") % ksdata.realm.discovered): ksdata.realm.execute(storage, ksdata, instClass) diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py index a90663d..2e266a2 100644 --- a/pyanaconda/packaging/__init__.py +++ b/pyanaconda/packaging/__init__.py @@ -565,10 +565,16 @@ class Payload(object): # XXX TODO: real error handling, as this is probably going to # prevent boot on some systems
- if new_firmware: - self._recreateInitrds() + def recreateInitrds(self, force=False): + """ Recreate the initrds by calling new-kernel-pkg
- def _recreateInitrds(self, force=False): + This needs to be done after all configuration files have been + written, since dracut depends on some of them. + + :param force: Always recreate, default is to only do it on first call + :type force: bool + :returns: None + """ if not force and self._createdInitrds: return
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py index d8cbbc8..0046f4f 100644 --- a/pyanaconda/packaging/livepayload.py +++ b/pyanaconda/packaging/livepayload.py @@ -147,7 +147,6 @@ class LiveImagePayload(ImagePayload): blivet.util.umount(INSTALL_TREE)
super(LiveImagePayload, self).postInstall() - self._recreateInitrds()
@property def spaceRequired(self):
On Fri, 2013-09-06 at 09:55 -0700, Brian C. Lane wrote:
From: "Brian C. Lane" bcl@redhat.com
dracut depends on some of the configuration settings we write out in doConfiguration so we need to always regenerate the initramfs for the system after we write these.
-- I realized that livepayload was already doign this, and that the driver disk
-- code does as well. I think this patch should cover all the cases.
pyanaconda/install.py | 7 +++++-- pyanaconda/packaging/__init__.py | 12 +++++++++--- pyanaconda/packaging/livepayload.py | 1 - 3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py index ab00369..4b23016 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -52,12 +52,12 @@ def _writeKS(ksdata): def doConfiguration(storage, payload, ksdata, instClass): from pyanaconda.kickstart import runPostScripts
- step_count = 5
- step_count = 6 # if a realm was discovered, # increment the counter as the # real joining step will be executed if ksdata.realm.discovered:
step_count = 6
step_count += 1progressQ.send_init(step_count)
# Now run the execute methods of ksdata that require an installed system
@@ -89,6 +89,9 @@ def doConfiguration(storage, payload, ksdata, instClass): ksdata.addons.execute(storage, ksdata, instClass, u) ksdata.configured_spokes.execute(storage, ksdata, instClass, u)
- with progress_report(_("Generating initramfs")):
payload.recreateInitrds(force=True)- if ksdata.realm.discovered: with progress_report(_("Joining realm: %s") % ksdata.realm.discovered): ksdata.realm.execute(storage, ksdata, instClass)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py index a90663d..2e266a2 100644 --- a/pyanaconda/packaging/__init__.py +++ b/pyanaconda/packaging/__init__.py @@ -565,10 +565,16 @@ class Payload(object): # XXX TODO: real error handling, as this is probably going to # prevent boot on some systems
if new_firmware:self._recreateInitrds()
- def recreateInitrds(self, force=False):
""" Recreate the initrds by calling new-kernel-pkg
- def _recreateInitrds(self, force=False):
This needs to be done after all configuration files have beenwritten, since dracut depends on some of them.:param force: Always recreate, default is to only do it on first call:type force: bool:returns: None""" if not force and self._createdInitrds: returndiff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py index d8cbbc8..0046f4f 100644 --- a/pyanaconda/packaging/livepayload.py +++ b/pyanaconda/packaging/livepayload.py @@ -147,7 +147,6 @@ class LiveImagePayload(ImagePayload): blivet.util.umount(INSTALL_TREE)
super(LiveImagePayload, self).postInstall()
self._recreateInitrds()@property def spaceRequired(self):
Looks good to me.
anaconda-patches@lists.fedorahosted.org