[elrepo] CentOS KMOD RPMs and install time

Phil Perry phil at elrepo.org
Mon Feb 6 09:19:17 EST 2017


On 06/02/17 11:42, Manuel Wolfshant wrote:
> On 02/06/2017 01:36 PM, Harry Mallon wrote:
>> Hello all,
>>
>> As part of our default deployment we install a few (maybe ~5/6) KMOD
>> RPMs. These take a long time to install (I think due to the dracut
>> calls). Is there any way to only call dracut after the last one is
>> done? Maybe a YUM plugin?

Yes, most of the time comes from updating the initramfs for each kernel 
installed on the system. The more kernels present, the longer it takes, 
and of course this is repeated for each and every kmod package 
(un)installed.

On my system dracut takes approx 30secs per installed kernel, so a kmod 
package takes around 1.5mins to install on a system with 3 kernels.

The kmodtool bundled as part of the kmod package calls weak-modules 
which in turn calls dracut in the check_initramfs() function.

If you want to bypass this step you can either hack the kmodtool in the 
kmod package and add --no-initramfs to each call of the weak-modules 
script (but this would require a rebuild of each package), or you could 
hack the end of the weak-modules script on the target machines where the 
script checks for the no_initramfs flag and calls check_initramfs().

To test this hypothesis, I commented out the 3 lines at the end of the 
weak-modules script and installing/uninstalling kmod packages was near 
instant compared to the more normal 1.5mins for a regular kmod package 
with 3 kernels installed on the system.

You'll then need to manually run dracut to update the initramfs for each 
kernel on your system. This is still going to take around 30secs per 
kernel, but you are doing it once instead of 5-6 times depending upon 
the number of kmod packages you are installing. Additionally, you may 
not wish to update the initramfs of every installed kernel, maybe only 
the current/latest kernel giving additional savings. So you can get a 
time saving when installing a large number of kmod packages.


> You could try to install them in a yum shell rather by using individual
> yum install commands but since each one of the %post scripts includes a
> dracut command, I am afraid this would not help.
> What you could do and would certainly help - but will require a bit of
> work - is
> - analyze each kmod and verify what they do in their scripts
> - install them using the --noscript rpm directive ( hence not executing
> the dracut command either )
> - reproduce their scripts yourself without executing the invidual dracut
> command but using a single one at the end
>
>     wolfy



More information about the elrepo mailing list