I would like to build a debian stretch to run on vagrant with the libvirt provider.

I have tried building from scratch and also with packer and the best I get is a OS not found error on the reboot or a freeze on the vagrant up of the box.

When not using packer I can boot the box inside virt-manager and it works but it gets no network access if I do a vagrant up on the same box. Packer is supposed to simplify that but I get a no media found error at boot.

Booting with Vagrant up it freezes at the point of ==> default: Waiting for domain to get an IP address..

If I then attach to the screen of the machine through /virt-manager/ I see it frozen after

acpid: waiting for events: event logging is off

Where am I going wrong?

Is there need for an extra manual step after the output of this packer script.

Here is the packer template I use

"variables": {
    "user": "vagrant",
    "password": "vagrant",
    "disk_size": "100000",
    "domain": ""

"builders": [
        "name": "debian93-vagrant",

        "type": "qemu",
        "format": "qcow2",
        "accelerator": "kvm",
        "disk_size": "{{ user `disk_size` }}",
    "iso_url": "https://cdimage.debian.org/debian-cd/9.3.0/amd64/iso-cd/debian-9.3.0-amd64-netinst.iso",
        "iso_checksum": "83480be837710a76fd4e75a6573ca110e06f5a7589d2d3852bdb0f45749800b3",
        "iso_checksum_type": "sha256",

        "http_directory": "http",

        "ssh_username": "{{ user `user` }}",
        "ssh_password": "{{ user `password` }}",
        "shutdown_command": "echo '{{ user `password` }}' | sudo -S shutdown -h now",

        "ssh_wait_timeout": "60m",

        "boot_wait": "2s",
        "boot_command": [
               "install ",

               "auto=true ",
               "priority=critical ",
               "interface=auto ",

               "passwd/user-fullname={{ user `user` }} ",
               "passwd/user-password={{ user `password` }} ",
               "passwd/user-password-again={{ user `password` }} ",
               "passwd/username={{ user `user` }} ",


"provisioners": [
        "type": "shell",
        "execute_command": "echo '{{ user `password` }}' | {{ .Vars }} sudo -E -S bash '{{ .Path }}'",
        "scripts": [

    "post-processors": [
        "keep_input_artifact": false,
        "output": "box/debian93-vagrant.box",
        "type": "vagrant"


And the Vagrant file to boot it up


# configures the configuration version (we support older styles for
# you're doing.
Vagrant.configure("2") do |config|
   # TODO build our own and deploy it to vagrantboxes
   # config.vm.box = "debian/jessie64"
   config.vm.box = "debian93Vagrant"
   # config.vm.box = ""
   #config.vm.box_version = "0.0.1"

   # Remove or adapt host_ip if remote access is required
   config.vm.network "forwarded_port", guest: 5601, host: 5601, host_ip:    ""
   config.vm.network "forwarded_port", guest: 9200, host: 9200, host_ip: ""
   config.vm.network "forwarded_port", guest: 5044, host: 5044, host_ip: ""

   # Create a private network, which allows host-only access to the machine
   # using a specific IP.
   config.vm.network "private_network", ip: ""

   # Create a public network, which generally matched to bridged network.
   # Bridged networks make the machine appear as another physical device on
   # your network.
   # config.vm.network "public_network"

   # If more folders are needed map them here
   # config.vm.synced_folder ".", "/vagrant"

   config.vm.synced_folder "./config", "/config"

   # Libvirt provider with added oomph
   config.vm.provider :libvirt do |prov|
          prov.memory = 4096 
          prov.cpus = 4

   # Basic setup through a shell provisioner
   config.vm.provision "shell", inline: <<-SHELL
        apt-get update
        apt-get upgrade -y
        apt-get install net-tools htop
        sleep 5

  # Deploy the stack
  config.vm.provision "ansible" do |an|
        an.playbook = "./ansible/single_machine.yml"

  # Leave things running permanently post installation
  config.vm.provision "shell", inline: <<-SHELL
    systemctl enable logstash 
    systemctl enable elasticsearch 
    systemctl enable kibana
    service kibana start
    service elasticsearch start
    service logstash start


Further investigation reveals the following mismatch in the MAC addresses Inside the booted image (accessed through virt-manager): 52:54:00:a0:46:68 In Vagrant (from debug output): mac="52:54:00:9e:ad:85" And from the error message: DEBUG wait_till_up: Searching for IP for MAC address: 52:54:00:b8:88:7d

Also the UUIDs of the domains are not the same: Vagrant gives: id="24e1487f-c36f-4cc3-a45e-4d8c6d867a4d" virt-manager reports: c4d152fd-6da4-4b09-bb98-96767b367a6c

What could cause the mismatch?

Your Answer


Browse other questions tagged or ask your own question.