RedHat 8 and cloud-init not running userdata until new VM is rebooted

fr flag

I have a Terraform script that is cloning a RedHat 8 VM on vSphere V7.

The VM is successfully cloned, but the user in my userdata is not created when the VM starts. If I reboot the VM after it is cloned, the user specified in the userdata is then created successfully.

I am not sure if this is a problem or feature of cloud-init and RedHat 8, or if there is something I need to do with the VM I am cloning from.

I have tried to clone from a VM and a Template, but I get the same problem with both. I have also run the following on the VM that is being cloned.

cloud-init clean --logs 
cloud-init clean --seed
rm -rf /var/lib/cloud

But my users are still not created until the VM is rebooted.

pt flag
I don't think there's enough information here for us to reproduce (or understand) the problem. `cloud-init` should run automatically and process the userdata whenever it boots on a "new" system (where "new" means "no instance directory exists in `/var/lib/cloud/instances` for the same machine id). If you are deleting `/var/lib/cloud/*` before the first boot, you should be good. It would be interesting to see the cloud-init logs from the initial boot.
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.