[Bug 1191322] New: Optimize building initrd when updating system
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 Bug ID: 1191322 Summary: Optimize building initrd when updating system Classification: openSUSE Product: openSUSE Distribution Version: Leap 15.3 Hardware: All OS: Other Status: NEW Severity: Enhancement Priority: P5 - None Component: Kernel Assignee: kernel-bugs@opensuse.org Reporter: Ulrich.Windl@rz.uni-regensburg.de QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- When installing updates, dracut is called multiple times to update the initrds of all kernels, for example when lvm2 is updated or when the kernel is updated. It would be better if the initrds were updated once at the end of the transaction (as Fedora does it, for example). Despite of that when keeping older kernels, there may be reasons _not_ to update the initrds of the older kernels: First, some may be removed on next boot anyway, and second, more important: If the idea of older kernels (and initrds) is to have a failback in case the new kernel, initrd or and binaries inside are broken (and thus fail to boot), it seems preferable to have the proven old kernel and initrd. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 http://bugzilla.opensuse.org/show_bug.cgi?id=1191322#c4 --- Comment #4 from Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> --- Here's a some sort of summary that lists over 20 mkconfigs while doing a "zypper dup" upgrade from 15.2 to 15.3 (yes, the upgrade almost took four hours!): 2021-12-29 22:43:49 <1> update-bootloader-6663 new.126: update-bootloader-6663 = /sbin/update-bootloader, version = 0.931, root = /dev/dm-2 2021-12-29 22:43:49 <1> update-bootloader-6663 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:29:25 <1> update-bootloader-2490 new.126: update-bootloader-2490 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:29:25 <1> update-bootloader-2490 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:30:56 <1> update-bootloader-3664 new.126: update-bootloader-3664 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:30:56 <1> update-bootloader-3664 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:32:27 <1> update-bootloader-5645 new.126: update-bootloader-5645 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:32:27 <1> update-bootloader-5645 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:33:50 <1> update-bootloader-1866 new.126: update-bootloader-1866 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:33:50 <1> update-bootloader-1866 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:35:41 <1> update-bootloader-2601 new.126: update-bootloader-2601 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:35:41 <1> update-bootloader-2601 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:37:30 <1> update-bootloader-5946 new.126: update-bootloader-5946 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:37:30 <1> update-bootloader-5946 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:38:51 <1> update-bootloader-1866 new.126: update-bootloader-1866 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:38:51 <1> update-bootloader-1866 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:40:28 <1> update-bootloader-2539 new.126: update-bootloader-2539 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:40:28 <1> update-bootloader-2539 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:42:20 <1> update-bootloader-1782 new.126: update-bootloader-1782 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:42:20 <1> update-bootloader-1782 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:43:39 <1> update-bootloader-8403 new.126: update-bootloader-8403 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:43:39 <1> update-bootloader-8403 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:45:07 <1> update-bootloader-3436 new.126: update-bootloader-3436 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:45:07 <1> update-bootloader-3436 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:46:25 <1> update-bootloader-7274 new.126: update-bootloader-7274 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:46:25 <1> update-bootloader-7274 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:51:38 <1> update-bootloader-9429 new.126: update-bootloader-9429 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:51:38 <1> update-bootloader-9429 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:52:57 <1> update-bootloader-9040 new.126: update-bootloader-9040 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:52:57 <1> update-bootloader-9040 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:55:27 <1> update-bootloader-1112 new.126: update-bootloader-1112 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:55:27 <1> update-bootloader-1112 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:57:02 <1> update-bootloader-4552 new.126: update-bootloader-4552 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:57:02 <1> update-bootloader-4552 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 00:58:46 <1> update-bootloader-7095 new.126: update-bootloader-7095 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 00:58:46 <1> update-bootloader-7095 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 01:00:18 <1> update-bootloader-2368 new.126: update-bootloader-2368 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 01:00:18 <1> update-bootloader-2368 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 01:41:17 <1> update-bootloader-8654 new.126: update-bootloader-8654 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 01:41:17 <1> update-bootloader-8654 main.269: /sbin/update-bootloader --refresh + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg 2021-12-30 01:42:40 <1> update-bootloader-6921 new.126: update-bootloader-6921 = /sbin/update-bootloader, version = 0.934, root = /dev/dm-2 2021-12-30 01:42:40 <1> update-bootloader-6921 main.269: /sbin/update-bootloader --reinit + /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg Redhat (Fedora) and Debian seems to be _much_ more streamlined. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 http://bugzilla.opensuse.org/show_bug.cgi?id=1191322#c7 --- Comment #7 from Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> --- (In reply to Martin Wilck from comment #5)
Can you see which packages triggered the update-booloader invocations?
Unsure I'll find it from the logs, but my guess is (among others): lvm2, virtual box kernel modules, kernel modules, kernel, mdadm, device mapper, etc.
Unless I'm mistaken, calling grub2-mkconfig isn't that expensive, unless you have enabled the OS prober and have a lot of parallel OS installations.
On that machine OS-prober is on (it always was), and it takes *a lot* of time.
initramfs building takes much more time.
Well I didn't find a way to find the dracut invocations, but my guess is at least 10 during upgrade. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 http://bugzilla.opensuse.org/show_bug.cgi?id=1191322#c8 --- Comment #8 from Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> --- (In reply to Michal Suchanek from comment #6)
Then again running grub2-mkconfig without creating the ramdisk first is pointless so if we do optimize ramdisk creation we can as well do grub2-mkconfig along with it.
Interestingly with auto-detecting the installed OSes and re-building the GRUB menu after each initrd change, the main advantage of GRUB (that is: not needing to reinstall/refresh it when the kernel files changed) vaporizes. The OS-prober is way to dumb and inefficient. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 http://bugzilla.opensuse.org/show_bug.cgi?id=1191322#c10 Sinisa Bandin <sinisa@4net.rs> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sinisa@4net.rs --- Comment #10 from Sinisa Bandin <sinisa@4net.rs> --- Hello All! I usually keep at least 5-6, sometime more kernels (I run on kernel-HEAD and update it regularly, then clean up from time to time). What I would like to see is running mkinitrd/dracut in parallel, because now it takes ages (well, OK, minutes instead of seconds) to recreate all of the initrd's after "zypper dup", and while doing that 7 out of 8 cores are doing nothing, SSD is 95% idle, RAM is free too... Running in parallel (up to CPU/core count at least), would considerably shorten that time, and I see no reason for not running in parallel because there should be no dependencies between initd's. Just my thinking... -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 http://bugzilla.opensuse.org/show_bug.cgi?id=1191322#c17 --- Comment #17 from Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> --- (In reply to Sinisa Bandin from comment #15)
Without parallel: real 0m43.247s user 0m32.279s sys 0m14.510s
With parallel: real 0m6.568s user 0m30.678s sys 0m9.899s
The fact that parallel execution uses less user and sys CPU made me wonder: Did you flush the caches before each test? -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 http://bugzilla.opensuse.org/show_bug.cgi?id=1191322#c18 --- Comment #18 from Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> --- Another note: The original bug was about avoiding needless rebuilds of initrd, while parallel execution in presence of multiple kernels would still be called needlessly (event though in parallel for multiple kernels), I'm afraid. So you fixed the symptom, not the cause. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 http://bugzilla.opensuse.org/show_bug.cgi?id=1191322#c19 --- Comment #19 from Sinisa Bandin <sinisa@4net.rs> --- (In reply to Ulrich Windl from comment #17)
(In reply to Sinisa Bandin from comment #15)
Without parallel: real 0m43.247s user 0m32.279s sys 0m14.510s
With parallel: real 0m6.568s user 0m30.678s sys 0m9.899s
The fact that parallel execution uses less user and sys CPU made me wonder: Did you flush the caches before each test?
No, this is all after running dracut a few times without "time" and doing some other random stuff. I just wanted to see the general effect, didn't mind about +/- 10% Now that you say it, it is interesting observation... will take another try afternoon, flushing the caches before each run. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 http://bugzilla.opensuse.org/show_bug.cgi?id=1191322#c20 --- Comment #20 from Sinisa Bandin <sinisa@4net.rs> --- (In reply to Ulrich Windl from comment #18)
Another note: The original bug was about avoiding needless rebuilds of initrd, while parallel execution in presence of multiple kernels would still be called needlessly (event though in parallel for multiple kernels), I'm afraid. So you fixed the symptom, not the cause.
Yes, sorry about hijacking the thread, but this has been bothering me for quite some time. It would still be nice to have some flag to tell zypper to run dracut only once at the end. That would save more time, and disk writes too. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1191322 http://bugzilla.opensuse.org/show_bug.cgi?id=1191322#c21 --- Comment #21 from Sinisa Bandin <sinisa@4net.rs> --- (In reply to Martin Wilck from comment #16)
(In reply to Sinisa Bandin from comment #15)
I did seem to have a problem: old initramfs files were called "initrd-xxxxxx", new ones are "initramffs-xxxxxxxx"
I suppose you simply copied dracut.sh from upstream? In that case this is expected. Upstream changed from "initrd" to "initramfs" a while ago (the term is technically more accurate), but openSUSE kept the name "initrd" for backward compatibility reasons.
Yes, I did, and only changed default behavior for "rebuild-all". Maybe I should have applied the diff, but this was quicker. Hopefully, changes will soon end up in official repo, but this works for me just fine for now. -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com