dracut
dracut copied to clipboard
Darcut found a fuzzy match when using the parameter --omit-drivers
Describe the bug darcut found a fuzzy match when using the parameter --omit-drivers
Distribution used
darcut --omit-drivers " aaxx "
At this point, there is a module (ko) on the system: aaxxwwcc.ko , this module will also be removed synchronously, because aaxxwwcc contains the characters aaxx
Dracut version latest version
Init system linux OS , eg: centos
To Reproduce none
Expected behavior
Run: darcut --omit-drivers " aaxx "
At this point there is a module (ko) on the system: aaxxwwcc.ko , this module( aaxxwwcc.ko) will not be removed synchronously, only aaxx.ko will be removed
Additional context I suspect that similar regular matching is done in the code, such as a wildcard: aaxx operation, I have not found the abnormal code so far, I will continue to work hard to analyze ...... At the same time, I hope the master can give guidance,thanks very much.
This is an annoying regression. omit-drivers option is expected to be names of modules. And it works as expected on CentOS 7 (dracut-033-554.el7.x86_64).
But on CentOS 9 (dracut-055-30.git20220216.el9.x86_64), omit-drivers is found actually interpreted as regexp. Dracut may omit more than one module when given only one omit-drivers option.
To Reproduce
- Run a CentOS 9 system with an
ext4/boot - Install a kernel with
ext4,mbacheandbachebuilt as modules. (ext4depends onmbcache.) dracut --omit-drivers bcache /tmp/initramfs- Check
ext4in initramfs:lsinitrd /tmp/initramfs |grep ext4 - Check both
mbcacheandbcachenot in initramfs:lsinitrd /tmp/initramfs |grep bcache- Expected
mbcacheis in initramfs andbcacheis not
- Expected
Related commits
- Change omit_drivers to support regexp expressions (in dracut-017) - https://github.com/dracutdevs/dracut/commit/34248c926cef4adeb0c73b2f89c1ba992edccd19
- Commit introducing this functionality in dracut-install (in dracut-045). https://github.com/dracutdevs/dracut/commit/794b2d2c753489635b922457a5ccb06669f37268
Expected mbcache is in initramfs and bcache is not
I think this is a good example. It shows that the name of one kernel module could be a substring of another completely unrelated kernel module. Another example is (mc and async_memcpy).
Perhaps best to keep the dracut-install behavior as is and pass in as argument anchored regexp to do exact match.
Sadly currently we have no tests using the "omit-drivers" option.
@champtar @cheese @zhrf2020 - would you be able to test the following one line change locally to verify if this works in your environment ?
https://github.com/dracutdevs/dracut/pull/1947/commits/ceae1339064adf55be3074c117706ebb60f75aab#diff-99bfb8fe311d6a59318f685a5e3401b59293b577968aa08cc4ff7320a163bb28L1348
I think ^(a|b)$ is equivalent to ^a$|^b$, but your change works (tm).
Side note when using configuration file, we don't have the '-' to '_' substitution, so some kmods are not excluded, don't know if you want to fix it in this PR.