Vagrant timed out error

Hello,
I have two ubuntu machine, when I run vagrant up this message error appears:

vagrant up
Bringing machine ‘ubuntu1’ up with ‘virtualbox’ provider…
Bringing machine ‘ubuntu2’ up with ‘virtualbox’ provider…
==> ubuntu1: Checking if box ‘ubuntu/focal64’ version ‘20230823.0.0’ is up to date…
==> ubuntu1: Clearing any previously set forwarded ports…
==> ubuntu1: Clearing any previously set network interfaces…
==> ubuntu1: Preparing network interfaces based on configuration…
ubuntu1: Adapter 1: nat
ubuntu1: Adapter 2: hostonly
==> ubuntu1: Forwarding ports…
ubuntu1: 22 (guest) => 2222 (host) (adapter 1)
==> ubuntu1: Running ‘pre-boot’ VM customizations…
==> ubuntu1: Booting VM…
==> ubuntu1: Waiting for machine to boot. This may take a few minutes…
ubuntu1: SSH address: 127.0.0.1:2222
ubuntu1: SSH username: vagrant
ubuntu1: SSH auth method: private key

Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured (“config.vm.boot_timeout” value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you’re using a custom box, make sure that networking is properly
working and you’re able to connect to the machine. It is a common
problem that networking isn’t setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout (“config.vm.boot_timeout”) value.

Help me, what should I do?

What OS are you running Virtualbox/Vagrant on and what version of both?

I just tested on OSX with a default Virtualbox install and that box appears to come up fine.

 default: VirtualBox Version: 7.0
==> default: Mounting shared folders...
    default: /vagrant => /Users/jon/vagrant/focal64

focal64 % vagrant ssh

Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-167-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sat Dec 23 20:03:26 UTC 2023

  System load:  0.0               Processes:               115
  Usage of /:   3.7% of 38.70GB   Users logged in:         0
  Memory usage: 20%               IPv4 address for enp0s3: 10.0.2.15
  Swap usage:   0%


Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


The list of available updates is more than a week old.
To check for new updates run: sudo apt update
New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


vagrant@ubuntu-focal:~$ 

My Computer system is Windows 10 Pro
Vagrant 2.4.0
Virtulabox 7.0.12
My virutal machine is ubuntu/focal64

Have you added any customizations to the Vagrantfile? Everything comes up okay for me on Windows as well (above was OSX).

I am just using the stock Vagrantfile from Vagrant box ubuntu/focal64 - Vagrant Cloud

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/focal64"
end
default: VirtualBox Version: 7.0
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/jon/Documents/vagrant/focal64

> vagrant ssh
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-167-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Sun Dec 24 14:13:49 UTC 2023

  System load:  0.45              Processes:               122
  Usage of /:   3.7% of 38.70GB   Users logged in:         0
  Memory usage: 21%               IPv4 address for enp0s3: 10.0.2.15
  Swap usage:   0%


Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


The list of available updates is more than a week old.
To check for new updates run: sudo apt update
New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


vagrant@ubuntu-focal:~$

I haven’t added any customized to the vagrantfile, but I download the ubuntu machine and all files from this repository:

I can’t say I’ve tried that way. I rely on Vagrant to download what it needs. Here are the steps I am performing to bring up the Vagrant box.

  1. Make a new directory for the OS type/version (e.g. c:\users\myname\vagrant\focal64)
  2. In that directory, make a new file named vagrantfile (no extension)
  3. Open vagrantfile in your text editor and enter the following:
    Vagrant.configure("2") do |config|
        config.vm.box = "ubuntu/focal64"
    end
    
  4. Save and close vagrantfile
  5. From the focal64 directory you created run vagrant up.

Vagrant will handle pulling all the necessary. You should not need to download anything else.

I make a directory for each OS version I need to use so I can have my default vagrantfile there and when I need a new VM I can just run vagrant up from that directory. You can search

For any type of OS you may need. Some are contributed by community members, some by the vendor themselves.

Hope that helps.

Thank you
I will try to do that
But I have a question: how can I give each virtual machine a IP address, because I will need to communicate between the two machines

Since you’re using Virtualbox, you could use a bridged network. I can test this out later this week as I am traveling right now but adding something like:

config.vm.network :bridged to the Vagrantfile which should grab an IP assuming you have DHCP on your network. Our docs show using "public_network" and you can specify which of your network adapters to use:

I haven’t tried with public_network myself as my use case has generally been isolated VMs.