I believe I submitted this bug for Ubuntu in the past, maybe that has been fixed since, but I just hit the same issue for RHEL:
Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpydu_muv6/target', 'rpm', '-q', '--queryformat', '%{VERSION}-%{RELEASE}.%{ARCH}', 'kernel'] with allowed return codes [0] (capture=True)
Found kver=5.14.0-427.13.1.el9_4.x86_645.14.0-427.37.1.el9_4.x86_64
Rebuilding initramfs with: ['dracut', '-f', '/boot/initramfs-5.14.0-427.13.1.el9_4.x86_645.14.0-427.37.1.el9_4.x86_64.img', '5.14.0-427.13.1.el9_4.x86_645.14.0-427.37.1.el9_4.x86_64']
Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpydu_muv6/target', 'dracut', '-f', '/boot/initramfs-5.14.0-427.13.1.el9_4.x86_645.14.0-427.37.1.el9_4.x86_64.img', '5.14.0-427.13.1.el9_4.x86_645.14.0-427.37.1.el9_4.x86_64'] with allowed return codes [0] (capture=True)
Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
TIMED subp(['udevadm', 'settle']): 0.016
Running command ['mount', '--make-private', '/tmp/tmpydu_muv6/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpydu_muv6/target/sys/firmware/efi/efivars'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpydu_muv6/target/sys'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpydu_muv6/target/sys'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpydu_muv6/target/run'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpydu_muv6/target/run'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpydu_muv6/target/proc'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpydu_muv6/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/tmp/tmpydu_muv6/target/dev'] with allowed return codes [0] (capture=False)
Running command ['umount', '/tmp/tmpydu_muv6/target/dev'] with allowed return codes [0] (capture=False)
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/updating-initramfs-configuration: FAIL: updating initramfs configuration
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
Traceback (most recent call last):
File "/curtin/curtin/commands/main.py", line 202, in main
ret = args.func(args)
File "/curtin/curtin/commands/curthooks.py", line 1918, in curthooks
builtin_curthooks(cfg, target, state)
File "/curtin/curtin/commands/curthooks.py", line 1863, in builtin_curthooks
redhat_update_initramfs(target, cfg)
File "/curtin/curtin/commands/curthooks.py", line 1696, in redhat_update_initramfs
in_chroot.subp(dracut_cmd, capture=True)
File "/curtin/curtin/util.py", line 792, in subp
return subp(*args, **kwargs)
File "/curtin/curtin/util.py", line 280, in subp
return _subp(*args, **kwargs)
File "/curtin/curtin/util.py", line 144, in _subp
raise ProcessExecutionError(stdout=out, stderr=err,
curtin.util.ProcessExecutionError: Unexpected error while running command.
Command: ['unshare', '--fork', '--pid', '--', 'chroot', '/tmp/tmpydu_muv6/target', 'dracut', '-f', '/boot/initramfs-5.14.0-427.13.1.el9_4.x86_645.14.0-427.37.1.el9_4.x86_64.img', '5.14.0-427.13.1.el9_4.x86_645.14.0-427.37.1.el9_4.x86_64']
Exit code: 1
Reason: -
Stdout: /etc/dracut.conf.d/50-curtin-storage.conf:add_dracutmodules+=" lvm"
Stderr:
dracut: WARNING: <key>+=" <values> ": <values> should have surrounding white spaces!
dracut: WARNING: This will lead to unwanted side effects! Please fix the configuration file.
dracut: Cannot find module directory /lib/modules/5.14.0-427.13.1.el9_4.x86_645.14.0-427.37.1.el9_4.x86_64/
dracut: and --no-kernel was not specified
Unexpected error while running command.
For the custom image in question, there happens to be 2 kernel versions installed, due to yum update
being run by image-builder and it not having a cleanup of old kernel versions by default. This results in
/lib/modules/5.14.0-427.13.1.el9_4.x86_64
/lib/modules/5.14.0-427.37.1.el9_4.x86_64
Which gets concatenated into one big kver variable of: 5.14.0-427.13.1.el9_4.x86_645.14.0-427.37.1.el9_4.x86_64, resulting in a failed deployment.
Similar to under Ubuntu, it should only select the newest version from /lib/modules
and use that, or run dracut for each version separately.