Tech Chorus

vagrant-libvirt Issue After Upgrading To Fedora 30

written by Sudheer Satyanarayana on 2019-08-14

I had a working vagrant-libvirt setup on Fedora 29. I upgraded to Fedora 30 and faced this issue when starting up a guest:

vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Checking if box 'centos/7' version '1905.1' is up to date...
Name `centos7_default` of domain about to create is already taken. Please try to run
`vagrant up` command again.

Apparently, things have changed in Fedora 30 and documented.

I had to add the line:

 lvt.qemu_use_session = false

to my Vagrantfile.

Viola.

Here's the complete Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :
#distro = %x( /usr/bin/lsb_release -a )

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.hostname = "dev01.lab.gavika.com"
  config.vm.post_up_message = "Happy development"
  config.vm.network "private_network", ip: "192.168.200.4"
  config.vm.network :forwarded_port, guest: 80, host: 5037, host_ip: "127.0.0.1"
  config.vm.network :forwarded_port, guest: 22, host: 2627, id: 'ssh', auto_correct: false

  # https://gist.github.com/amccarty/2137ae65ddada56c0865
  id_rsa_key_pub = File.read(File.join(Dir.home, ".ssh", "id_rsa.pub"))
  config.vm.provision :shell,
        :inline => "echo 'appending SSH Pub Key to ~vagrant/.ssh/authorized_keys' && echo '#{id_rsa_key_pub }' >> /home/vagrant/.ssh/authorized_keys && chmod 600 /home/vagrant/.ssh/authorized_keys"
  config.ssh.insert_key = false


  config.vm.provider "libvirt" do |lvt, override|
      override.vm.synced_folder ".", "/vagrant", type: "sshfs"
      lvt.qemu_use_session = false
  end

end