#StackBounty: #ubuntu #networking #ubuntu-18.04 #netplan Replace systemd-machine-id-setup with alternative?

Bounty: 50

We’re using a ubuntu-18.04 template on a virtualization environment. Therefore, before creating the template, we always empty the /etc/machine-id file so it’s recreated upon the first boot.

The problem is that if several ubuntu-18-based VMs are started at once, systemd-machine-id-setup will generate the same ID for all of them, resulting in IP duplication. I checked these servers and they all have the same content in the /etc/machine-id file.

IP duplication

If machines are powered-on spaced in time, different IPs are assigned, thus I assume systemd-machine-id-setup is generated based on current time (possibly). This isn’t acceptable for us because of the problem in the image above.

Is there a way to make the OS generate the /etc/machine-id on boot based on an alternative binary?

— UPDATE 1 —

On @GeraldSchneider’s tip, I switched back from netplan to ifdownup and the IPs stopped duplicating, so definitely this is a netplan issue.

no duplicated IPs

Even if this could solve the problem, I’m curious if there’s a way to set an alternative way to generate the /etc/machine-id file so no duplications happen using netplan.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.