Troubleshooting building RHEL9 derivatives using Packer and the QEMU builder
Troubleshooting building RHEL9 derivatives using Packer and the QEMU builder.
I have been messing about with Packer over the last week or so, to hopefully improve some of the image building that my team needs to take care of.
Mostly we are able to start from the amazing images provided by the community, but as I mentioned in my last post, running baremetal services sometimes means we need to build our own images to ensure they boot correctly when deploying to a baremetal node.
Here are a couple of things I have personally run into over the last week or so.
Environment.
- Virtual guest running on OpenStack
- Ansible
- Packer
- Qemu/Libvirt
- 4 Cores
- 8Gb Ram
- 100Gb Disk
Packer Plugins
Other Tools
- Red Hat Kickstart helper tool Makes writing kickstart files a breeze.
The issues.
- Always make sure you give the nested QEMU virtual machine enough memory.
- The examples in the Packer documentation are set to 512MB, this is not enough and will cause the booting instance to kernel panic.
- In the Packer HCL file ensure you set
cpu-model
tohost
otherwise the booting instance will kernel panic. - RHEL9 derivatives by default do not allow SSH to the root user with a password. So you will need to configure SSH keys for the packer build. This should be done by injecting a known SSH pub key in via kickstart.
- Watch out for differences between RHEL8 and RHEL9 kickstart files.
- Remember that you will need to “sysprep” the images after the build to ensure a smooth experience.
- You can either write a script to clean up all the bits, or run them through virt-sysprep.
Hopefully these tips will help you not have the same issue I have had.
Until next time, Steve.