Vagrant can SSH to Ubuntu Xenial/Bionic VMs but not to Focal ones on same host

121 views
Skip to first unread message

Adrià Mercader

unread,
Jul 23, 2020, 4:02:14 AM7/23/20
to Vagrant

Hi all,

I'm running Vagrant 2.2.9 using Virtualbox 6.1.12. My host OS is Ubuntu 20.04

I need to run VMs with different versions of Ubuntu: 16.04 (xenial), 18.04 (bionic) and 20.04 (focal). Xenial and Bionic VMs are created fine and I can SSH into them, but I can't SSH into Focal ones.

I'm using the simplest `.Vagrantfile`:

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.box = "ubuntu/focal64"
end

When I try to bring the `focal` VM up with `vagrant up` the process gets stuck on the `default: SSH auth method: private key` and eventually times out. `vagrant ssh` also times out after that.

But doing the same process with xenial and bionic works fine, I can start the VMs and SSH into them just fine.

Looking at the output of `vagrant ssh-config` reveals a major difference between the two though:

For the working Xenial / Bionic VMs, the private key file used is one created at the project level:

vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2200
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/adria/dev/testbionic/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL


But for the Focal VMs the private key file used is the one on the home folder:


vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2203
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /home/adria/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL


I'm creating all VMs in exactly the same way so I don't know why in the focal case it's picking a different private key. I'd be surprised if it was because the Host and Guest OS are the same but it's the only thing I can think of.

Any ideas or pointers?

Many thanks in advance,

Adrià

sop...@hashicorp.com

unread,
Jul 23, 2020, 10:28:43 AM7/23/20
to Vagrant
Hi there!
There is a confirmed bug (https://bugs.launchpad.net/cloud-images/+bug/1829625) that causes some of the newer Ubuntu boxes to boot slowly, which is causing the SSH timeout in this case.
You can work around this by adding the following customizations to your Vagrantfile:
```ruby
  config.vm.provider :virtualbox do |v|
    v.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
    v.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL]
  end
```
Cheers!

Adrià Mercader

unread,
Jul 24, 2020, 6:39:00 AM7/24/20
to Vagrant
Thanks, that workaround solved the issue.

Cheers!
Reply all
Reply to author
Forward
0 new messages