Trying to understand why zypper does multiple initrd in one update run

I have been wondering why when I update TW using zypper dup or Leap using zypper up it does initrd multiple times throughout rather than once at the end? This morning on updating TW it did it 6 times which takes a while and the last two were at the end after all updates (twice in succession). I would have thought it could set a flag and do it once at the end. I’m sure there is a good reason but just to satisfy my curiosity can anyone explain why?

Stuart

This has been explained on the factory ML, where Dimstar explained that this cannot be done differently. Had a quick look but I can’t find the thread it was posted in. FWIW the post left me with an “OK, then that’s explained and done, I’ll live with it.” . Anyway, NVIDIA / Broadcom involved? AFAIK triggering the recreation of the initrd is done on package level. So, an upgrade may or may not contain packages that need recreation of the initrd. The kernel package cannot count on NVIDIA or any other kernel-related packages being in the upgrade session, so no other way than on package level. Hope this gives you enough info to see a bit of the why :).

I do not know much of the internals, but I can imagine that when a package is installed that needs initrd to be recreated, it should happen asap. Waiting for a multiple package installation session to finish, could lead to that session being broken off for whatever reason. Couldn’t that leave you with an unbootable system?

Thanks guys, I can understand why now, just that 6 initrd creates seemed excessive.

Stuart