CentOS Kickstart on KVM doesn't clear partition labels

I used a kickstart file with the command clearpart --all --initlabel to make sure anaconda would clear any disks before trying to create and format new partitions.

This has worked in the past for me, on physical machines. However, when doing so on a KVM guest with an underlying LVM volume as storage, Anaconda waits for user input at the following warning:

error screenshot

I'm going to answer this question myself. I mistakenly thought my problem and solution were related to this question here on ServerFault. Since they are not, I'm creating and answering a new question.


The solution on CentOS/RHEL is apparently adding zerombr to your kickstart file. You should have these two lines before defining your bootloader location and disk partitioning:

zerombr
clearpart --initlabel

Or use this if you want ALL attached drives to have their partition table wiped.

zerombr
clearpart --all --initlabel