Not able to install kernel packages with error "error: unpacking of archive failed on file /lib/modules: cpio: open failed - Not a directory"
Issue
- Below errors were noticed while installing packages:
 
Running transaction
  Preparing        :                                                                                                                                                1/1
  Installing       : kernel-core-4.18.0-372.96.1.el8_6.x86_64                                                                                                       1/2
error: failed to open dir lib of /lib/: Not a directory
Error unpacking rpm package kernel-core-4.18.0-372.96.1.el8_6.x86_64
  Installing       : kernel-modules-4.18.0-372.96.1.el8_6.x86_64                                                                                                    2/2
error: unpacking of archive failed on file /lib/modules: cpio: open failed - Not a directory
error: kernel-core-4.18.0-372.96.1.el8_6.x86_64: install failed
error: failed to open dir lib of /lib/modules/4.18.0-372.96.1.el8_6.x86_64/kernel/drivers/base/regmap/: Not a directory
Error unpacking rpm package kernel-modules-4.18.0-372.96.1.el8_6.x86_64
  Verifying        : kernel-core-4.18.0-372.96.1.el8_6.x86_64                                                                                                       1/2
  Verifying        : kernel-modules-4.18.0-372.96.1.el8_6.x86_64                                                                                                    2/2
Installed products updated.
Failed:
kernel-core-4.18.0-372.96.1.el8_6.x86_64                                          
kernel-modules-4.18.0-372.96.1.el8_6.x86_64
Error: Transaction failed
  Environment
- Red Hat Enterprise Linux 8 and above
 
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.