[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#868679: cloud.debian.org: Multiple identical vagrant boxes appear as the same machine to libvirt's dnsmasq dhcp provider



Package: cloud.debian.org
Severity: important
Tags: newcomer

Dear Maintainer,

   * What led up to the situation?

I've been having problems using the supplied vagrant boxes in more complex
setups (where a Vagrantfile brings up more than one identical
machine). They effectively end up stealing each other's management IP
address (and potentially others that are DHCP managed).

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

Use a Vagrantfile a bit like this:

[[[
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'

def main()
  Vagrant.configure("2") do |config|
    config.vm.box = "debian/stretch64"
    config.vm.box_check_update = false

    config.vm.provider :libvirt do |lv|
    end
    config.vm.synced_folder ".", "/vagrant", disabled: true
  end
  make_box "box-a"
  make_box "box-b"
end

def make_box(name)
  Vagrant.configure("2") do |config|
    config.vm.define name do |box|
      box.vm.provider :libvirt do |lv|
        lv.memory = 1024
        lv.cpus = 2
      end
    end
  end
end

main
]]]

Try bringing up both hosts at once. You might need to wait a bit.

   * What was the outcome of this action?

You'll see each host snaffle the allocated DHCP management address.

The same client-id is reported in dnsmasq's lease file on the host machine.

   * What outcome did you expect instead?

Each host should identify itself differently to dnsmasq; if you check the
leases file, each box appears to supply the same client-id (although
they have different MAC addresses).

   * Diagnosis:

It appears that the client-id is supplied by the systemd network client. This
is derived, I believe, from /etc/machine-id and in turn
/var/lib/dbus/machine-id. These files are present with *fixed
contents* on the box image that I've used; each instance gets the same
machine-id.

The box image should not include those files (it suffices to delete them prior
to packaging the image). This causes each instance to mint its own new
UUID, which in turn results in distinct client-ids being supplied by
systemd.

(I don't think systemd is strictly at fault here; the contents of machine-id
should be distinct per distinct host.)

Cheers,
jan


-- System Information:
Debian Release: stretch/sid
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Init: systemd (via /run/systemd/system)


Reply to: