Skip to content

AlmaLinux 10: vagrant can't setup static private network #13685

Closed
@matejzero

Description

@matejzero

I'm trying to boot up almalinux/10 image with static IP address for private network but it errors out with Connection activation failed.

When the machine boots up, these are the connections I see:

# nmcli c show
NAME                UUID                                  TYPE      DEVICE
Wired connection 1  1d9e36de-97b8-3e40-8e12-626f71858928  ethernet  eth0
Wired connection 2  1d994f91-f504-355e-9be6-877564942396  ethernet  eth1
lo                  988a1ca7-4fa2-4c0a-95b0-5abc4607dbf2  loopback  lo
eth1                8f226133-72ba-4552-b54d-f3289ffd706e  ethernet  --

Wired connection 2 is the auto-generated device NetworkManager creates when it finds a new ethernet device. Vagrant creates a new eth1 device in /etc/NetworkManager/system-connections/eth1.nmconnection and tries to activate it with nmcli d connect 'eth1', but the device is already in active state (Wired connection 2).

Looking through the code, Redhat network provider in https://github.com/hashicorp/vagrant/blob/main/plugins/guests/redhat/cap/configure_networks.rb calls https://github.com/hashicorp/vagrant/blob/main/lib/vagrant/util/guest_networks.rb#L11, which should delete the "Wired connection 2" connection and create a new one (https://github.com/hashicorp/vagrant/blob/main/lib/vagrant/util/guest_networks.rb#L83), but this part of code is never called.

My ruby is not good enough to find the issue in networks provider.

Debug output

If I boot up the VM with debug enabled, this is the problematic part (full gist: https://gist.github.com/matejzero/4459d552466c4fcf60d236a43dfd222a)

 INFO ssh: Execute: mkdir -p "/tmp" (sudo=false)
DEBUG ssh: stderr: 41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh
DEBUG ssh: Exit status: 0
DEBUG ssh: Uploading file /tmp/vagrant-nm-configure-networks20250616-35049-2bn2ng to remote /tmp/vagrant-network-entry-eth1-1750085173-0
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: chown root:root '/tmp/vagrant-network-entry-eth1-1750085173-0' (sudo=true)
DEBUG ssh: stderr: 41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh
DEBUG ssh: Exit status: 0
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: chmod 0600 '/tmp/vagrant-network-entry-eth1-1750085173-0' (sudo=true)
DEBUG ssh: stderr: 41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh
DEBUG ssh: Exit status: 0
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: mv '/tmp/vagrant-network-entry-eth1-1750085173-0' '/etc/NetworkManager/system-connections/eth1.nmconnection' (sudo=true)
DEBUG ssh: stderr: 41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh
DEBUG ssh: Exit status: 0
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: nmcli c load '/etc/NetworkManager/system-connections/eth1.nmconnection' (sudo=true)
DEBUG ssh: stderr: 41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh
DEBUG ssh: Exit status: 0
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: nmcli d connect 'eth1' (sudo=true)
DEBUG ssh: stderr: 41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh
DEBUG ssh: stderr: Error: Connection activation failed: IP configuration could not be reserved (no available address, timeout, etc.).

DEBUG ssh: Exit status: 4
ERROR warden: Error occurred: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

nmcli d connect 'eth1'

Stdout from the command:
Stderr from the command:
Error: Connection activation failed: IP configuration could not be reserved (no available address, timeout, etc.).
 INFO warden: Beginning recovery process...
 INFO warden: Calling recover: #<Vagrant::Action::Builtin::Call:0x00007fc1582b4078>

Expected behavior

VM would boot up successfully.

Actual behavior

Error I get in the console:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

nmcli d connect 'eth1'

Stdout from the command:
Stderr from the command:
Error: Connection activation failed: IP configuration could not be reserved (no available address, timeout, etc.).

Reproduction information

Vagrant version

Vagrant 2.4.6
vagrant-libvirt (0.12.2, global)
vagrant-scp (0.5.9, global)

  • Version Constraint: > 0

Host operating system

$ cat /etc/redhat-release
AlmaLinux release 9.5 (Teal Serval)

Guest operating system

AlmaLinux 10.0

Steps to reproduce

  1. Setup Vagrantfile
  2. vagrant up and wait for the rror

Vagrantfile

Vagrant.configure("2") do |c|
  c.ssh.insert_key = false
  c.vm.define 'almalinux/10' do |v|
    v.vm.hostname = 'almalinux/10'
    v.vm.box = 'almalinux/10'
    v.vm.box_check_update = 'true'
    v.vm.synced_folder '.', '/vagrant', disabled: true
    v.vm.network :private_network, ip: "10.254.7.109", :netmask => "255.255.0.0"
    v.vm.provider :libvirt do |node|
      node.cpus = 2
      node.memory = 2048
      node.qemu_use_session = false
      node.management_network_keep = 'true'
      node.graphics_type = 'none'
    end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions