Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network 192.168.33.10 is not available #1389

Closed
tuupola opened this issue Oct 28, 2021 · 3 comments
Closed

Network 192.168.33.10 is not available #1389

tuupola opened this issue Oct 28, 2021 · 3 comments

Comments

@tuupola
Copy link

tuupola commented Oct 28, 2021

Steps to reproduce

  1. $ vagrant init fedora/32-cloud-base
  2. In Vagrantfile uncomment: config.vm.network "private_network", ip: "192.168.33.10"
  3. $ vagrant up

Expected behaviour

Virtual machine should boot.

Actual behaviour

Trying to boot fails with.

$ vagrant up --provider=libvirt
...
Network 192.168.33.10 is not available. Specify available network
name, or an ip address if you want to create a new network.

If trying second time without destroying it hangs with:

$ vagrant up --provider=libvirt
...
==> default: Waiting for SSH to become available...

After destroying the error message is again:

$ vagrant destroy
$ vagrant up --provider=libvirt
...
Network 192.168.33.10 is not available. Specify available network
name, or an ip address if you want to create a new network.

If I comment out the private network config virtual machine boots up fine.

# config.vm.network "private_network", ip: "192.168.33.10"

Maybe there is some extra libvirt configuration needed which is not mentioned in the docs? Also tried with other boxes such as centos/7 and centos/8.

System configuration

OS/Distro version::
Fedora 34 (Workstation Edition)

Libvirt version:
7.0.0-7.fc34

Output of vagrant version; vagrant plugin list:

$ vagrant version; vagrant plugin list
Installed Version: 2.2.16

Vagrant was unable to check for the latest version of Vagrant.
Please check manually at https://www.vagrantup.com
vagrant-libvirt (0.4.1, system)

Attach Output of VAGRANT_LOG=debug vagrant ... --provider=libvirt >vagrant.log 2>&1

https://gist.github.com/tuupola/3b6cc36871cf47caabd6fda0922bebd3

A Vagrantfile to reproduce the issue:

$ cat Vagrantfile | grep "\S" | grep -v "#"

Vagrant.configure("2") do |config|
  config.vm.box = "fedora/32-cloud-base"
  config.vm.network "private_network", ip: "192.168.33.10"
end

Are you using upstream vagrant package or your distros package?
Distro

@electrofelix
Copy link
Contributor

electrofelix commented Oct 28, 2021

The rpm for Fedora defaults the connection to libvirt to use the session connection qemu:///session which does not support creating networks, though you can use networks that have been already created.

I'll have a look at improving the error message so that when in this mode it is flagged to users that it's not going to work (or see if it's possible to have the network creation code always use the system connection instead if it's possible to do so and have the URI work as expected).

In the mean time you can either uninstall the distro rpm and install directly using vagrant plugin install vagrant-libvirt (do keep using the distro vagrant this is just switching to the upstream plugin), and it will default to using qemu:///system.

Or set the following in your Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    libvirt.qemu_use_session = false
    # if the above doesn't work, try uncommenting the following instead
    #libvirt.uri = 'qemu:///system'
  end
end

@tuupola
Copy link
Author

tuupola commented Oct 28, 2021

Setting libvirt.qemu_use_session = false did the trick. Thanks!

@MrChadMWood
Copy link

MrChadMWood commented Mar 26, 2024

This wasn't immediately obvious to me, so in case it helps anyone else; I got it to run with the following changes:

Vagrant.configure("2") do |config|
  config.vm.provision "shell", env: { "IP_NW" => IP_NW, "IP_START" => IP_START, "NUM_WORKER_NODES" => NUM_WORKER_NODES }, inline: <<-SHELL
      apt-get update -y
      echo "$IP_NW$((IP_START)) controlplane" >> /etc/hosts
      for i in `seq 1 ${NUM_WORKER_NODES}`; do
        echo "$IP_NW$((IP_START+i)) node0${i}" >> /etc/hosts
      done
  SHELL

Changed to:

Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    libvirt.qemu_use_session = false
    # if the above doesn't work, try uncommenting the following instead
    #libvirt.uri = 'qemu:///system'
  end
  config.vm.provision "shell", env: { "IP_NW" => IP_NW, "IP_START" => IP_START, "NUM_WORKER_NODES" => NUM_WORKER_NODES }, inline: <<-SHELL
      apt-get update -y
      echo "$IP_NW$((IP_START)) controlplane" >> /etc/hosts
      for i in `seq 1 ${NUM_WORKER_NODES}`; do
        echo "$IP_NW$((IP_START+i)) node0${i}" >> /etc/hosts
      done
  SHELL

Edit: Maybe not. I'm getting a deadlock memory error
image

Edit 2: Not sure if this could be related, but the VM doesn't seem to be allocated the amount of memory shown in the Vagrant file. I modified the volume to 8GB and force reset the VM. This did not change anything.
Screenshot from 2024-03-26 02-23-13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants