Linux Sysprep Official

rm -f /etc/udev/rules.d/70-persistent-net.rules rm -f /etc/network/interfaces.d/50-cloud-init.cfg # if using netplan

Alternatives exist: ignition (CoreOS style), user-data scripts via DHCP options, or even a simple rc.local that checks for a /firstboot flag. But cloud-init is the standard for a reason.

Real Linux sysprep happens in three phases. Most people only do the first.

Build a VM exactly how you want your golden image: packages, configs, users, hardening.

Next time you're about to clone a Linux VM, stop. Run the script. Let the machine die a little. Then, when it boots for the first time, it will live properly—unique, secure, and ready.

#!/bin/bash set -e