Error message with Ubuntu 22.04 / Virtualbox 7 / Vagrant 2.3.7

Hello,

I switch my configuration from an old computer with Ubuntu 20.04 / Virtualbox 6 / Vagrant 2.3.7 to a new one with Ubuntu 22.04 / Virtualbox 7 / Vagrant 2.3.7. The configuration worked correctly on my old computer.

Here is my config:

IMAGE_NAME = "debian/bullseye64"
MASTERS = 1
NODES = 2

Vagrant.configure("2") do |config|
    config.ssh.insert_key = false

    config.vm.provider "virtualbox" do |v|
        v.memory = 2048
        v.cpus = 1
    end

    (1..MASTERS).each do |i|
        config.vm.define "master-#{i}" do |master|
            master.vm.box = IMAGE_NAME
            master.vm.network "private_network", ip: "192.168.56.#{i + 100}"
            master.vm.hostname = "k8s-master-#{i}"

            # naming the virtualmachine
            master.vm.provider :virtualbox do |vb|
                vb.name = "k8s-master-#{i}"
            end

            master.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "/tmp/id_rsa.pub"

            # change ansible to ansible_local if you are running from windows,
            # so that vagrant will install ansible inside VM and run ansible playbooks
            # eg: master.vm.provision "ansible_local" do |ansible|
            master.vm.provision "ansible_local" do |ansible|
                ansible.compatibility_mode = "2.0"
                ansible.playbook = "node-config.yml"
            end
        end
    end

    (1..NODES).each do |i|
        config.vm.define "node-#{i}" do |node|
            node.vm.box = IMAGE_NAME
            node.vm.network "private_network", ip: "192.168.56.#{i + 110}"
            node.vm.hostname = "k8s-node-#{i}"

            # naming the virtualmachine
            node.vm.provider :virtualbox do |vb|
                vb.name = "k8s-node-#{i}"
            end

            node.vm.provision "file", source: "~/.ssh/id_rsa.pub", destination: "/tmp/id_rsa.pub"

            # change ansible to ansible_local if you are running from windows,
            # so that vagrant will install ansible inside VM and run ansible playbooks
            # eg: node.vm.provision "ansible_local" do |ansible|
            node.vm.provision "ansible_local" do |ansible|
                ansible.compatibility_mode = "2.0"
                ansible.playbook = "node-config.yml"
            end
        end
    end
end

When I do a vagrant up, I have the error message below:

Bringing machine 'master-1' up with 'virtualbox' provider...
Bringing machine 'node-1' up with 'virtualbox' provider...
Bringing machine 'node-2' up with 'virtualbox' provider...
==> master-1: Checking if box 'debian/bullseye64' version '11.20230615.1' is up to date...
==> master-1: Clearing any previously set forwarded ports...
==> master-1: Fixed port collision for 22 => 2222. Now on port 2202.
==> master-1: Clearing any previously set network interfaces...
==> master-1: Preparing network interfaces based on configuration...
    master-1: Adapter 1: nat
    master-1: Adapter 2: hostonly
==> master-1: Forwarding ports...
    master-1: 22 (guest) => 2202 (host) (adapter 1)
==> master-1: Running 'pre-boot' VM customizations...
==> master-1: Booting VM...
==> master-1: Waiting for machine to boot. This may take a few minutes...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.

If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.

The primary issue for this error is that the provider you're using
is not properly configured. This is very rarely a Vagrant issue.

However when I go to virtualbox gui and I start the vm, the vm is starting correctly so I don’t understand what’s wrong … is-it a bug ?

Thanks.

I tested with VirtualBox 6 on Ubuntu 22.04 and I have the same issue.
I added:

v.gui = true

The VM is starting correctly but if I start the virtualbox GUI the status of the VM is “Stopped” even if I see the VM started in the window started by vagrant.

I have also these errors in /home/smu/.config/VirtualBox/VBoxSVC.log:

00:00:03.597045 nspr-4   ERROR [COM]: aRC=VBOX_E_INVALID_VM_STATE (0x80bb0002) aIID={300763af-5d6b-46e6-aa96-273eac15538a} aComponent={MachineWrap} aText={The machine is not mutable (state is PoweredOff)}, preserve=false aResultDetail=0
00:01:03.633928 main     ERROR [COM]: aRC=VBOX_E_OBJECT_IN_USE (0x80bb000c) aIID={ad47ad09-787b-44ab-b343-a082a3f2dfb1} aComponent={MediumWrap} aText={Medium '/home/smu/VirtualBox VMs/master-1/box.vmdk' cannot be closed because it is still attached to 1 virtual machines}, preserve=false aResultDetail=0
00:01:03.650494 Watcher  ERROR [COM]: aRC=E_ACCESSDENIED (0x80070005) aIID={7682d5eb-f00e-44f1-8ca2-99d08b1cd607} aComponent={VirtualBoxWrap} aText={The object is not ready}, preserve=false aResultDetail=0

Have you tried destroying all the guests and running vagrant up again to fully recreate them?

Yes, I already tried this.

After doing a vagrant destroy, I removed the ~/.vagrant.d folder, le .vagrant folder next to the Vagrant file, the ~/.config/VirtualBox folder and the ~/VirtualBox VMs folder.

I tried again and the same error.