Different behavior using ubuntu/trusty64 and ubuntu/groovy64 (default: Warning: Authentication failure. Retrying...)

Hello !

I was using the vagrant box ubuntu/trusty64 and i needed an ubuntu with a more recent version of DIG for some new tests i’m running. So I decided to use a more recent one and I tried to use ubuntu/groovy6.

The problem comes when I run a vagrant up using this new box the behavior is way different, vagrant is not able to log into the box.

Here’s the behavior with the ubuntu/trusty64

vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Importing base box ‘ubuntu/trusty64’…
==> default: Matching MAC address for NAT networking…
==> default: Checking if box ‘ubuntu/trusty64’ version ‘20190514.0.0’ is up to date…
==> default: Setting the name of the VM: XXXX
==> default: Clearing any previously set forwarded ports…
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
==> default: Forwarding ports…
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running ‘pre-boot’ VM customizations…
==> default: Booting VM…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address: 10.0.x.x:22
default: SSH username: vagrant
default: SSH auth method: password
default:
default: Inserting generated public key within guest…
default: Removing insecure key from the guest if it’s present…
default: Key inserted! Disconnecting and reconnecting using new SSH key…
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM…
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.3.40
default: VirtualBox Version: 6.0
==> default: Running provisioner: shell…
default: Running: script: Network Configuration
==> default: Running provisioner: file…
default: ./xxx.sh => ./xxx.sh
vagrant up 6.08s user 4.67s system 18% cpu 57.883 total

And here the behavior with the ubuntu/groovy64:

vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Importing base box ‘ubuntu/groovy64’…
==> default: Matching MAC address for NAT networking…
==> default: Checking if box ‘ubuntu/groovy64’ version ‘20200627.0.0’ is up to date…
==> default: Setting the name of the VM: XXXXX
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
==> default: Forwarding ports…
default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Running ‘pre-boot’ VM customizations…
==> default: Booting VM…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address: 10.0.x.x:22
default: SSH username: vagrant
default: SSH auth method: password
default: Warning: Host unreachable. Retrying…
default: Warning: Host unreachable. Retrying…
default: Warning: Host unreachable. Retrying…
default: Warning: Connection refused. Retrying…
default: Warning: Connection refused. Retrying…
default: Warning: Authentication failure. Retrying…
default: Warning: Authentication failure. Retrying…
default: Warning: Authentication failure. Retrying…
default: Warning: Authentication failure. Retrying…
default: Warning: Authentication failure. Retrying…
default: Warning: Authentication failure. Retrying…
default: Warning: Authentication failure. Retrying…
default: Warning: Authentication failure. Retrying…

Here’s my vagrant file:

-- mode: ruby --

vi: set ft=ruby :

Vagrant.configure(“2”) do |config|
config.vm.box = “ubuntu/trusty64”
config.vm.synced_folder ‘.’, ‘/vagrant’, disabled: true
config.ssh.insert_key = false

config.ssh.host= “10.0.x.x”
config.ssh.username= “vagrant”
config.ssh.password= “vagrant”

config.vm.provider “virtualbox” do |vb|
vb.name = “XXXXX”
vb.cpus = “1”
vb.memory = “2048”

vb.customize [“modifyvm”, :id, “–groups”, “/unit”]
vb.customize [“modifyvm”, :id, “–chipset”, “ich9”]
vb.customize [“modifyvm”, :id, “–nictype1”, “virtio”]
vb.customize [“modifyvm”, :id, “–nic1”, “bridged”]
vb.customize [“modifyvm”, :id, “–nictype1”, “82540EM”]
vb.customize [“modifyvm”, :id, “–nicpromisc1”, “allow-all”]
vb.customize [“modifyvm”, :id, “–bridgeadapter1”, “net0”]
vb.customize [“modifyvm”, :id, “–macaddress1”, “xxxxxxxxxxxxxxx”]

(0…1).each_with_index do |vboxnet, i|
vb.customize [“modifyvm”, :id, “–nic#{i + 2}”, “hostonly”]
vb.customize [“modifyvm”, :id, “–nictype#{i + 2}”, “82540EM”]
vb.customize [“modifyvm”, :id, “–nicpromisc#{i + 2}”, “allow-all”]
vb.customize [“modifyvm”, :id, “–cableconnected#{i + 2}”, “on”]
vb.customize [“modifyvm”, :id, “–hostonlyadapter#{i + 2}”, “vboxnet#{vboxnet}”]
end
end

SHELL
config.vm.provision “shell”,
name: “Network Configuration”,
inline: <<-SHELL
ip addr add 192.168.100.1/24 dev eth1
ip addr add 192.168.0.1/17 dev eth1 label eth1:1
ip addr add 192.168.0.2/17 dev eth1 label eth1:2
ip addr add 192.168.111.1/24 dev eth2
ip link set eth1 promisc on
ip link set eth2 promisc on
ip link set eth1 up
ip link set eth2 up
SHELL

config.vm.provision “file”, source: “./lease.sh”, destination: “./lease.sh”
end

I tried several things such as adding to my vagrant file “config.ssh.insert_key = false” but it didn’t help.

Hello,

Well in the meantime we found the solution to this. We added the following to our vagrant file:

config.ssh.insert_key = false
config.ssh.private_key_path = [“keys/.ssh/vagrant_rsa”, “~/.vagrant.d/insecure_private_key”]
config.vm.provision “file”, source: “keys/.ssh/vagrant_rsa.pub”, destination: “~/.ssh/authorized_keys”

We created a directory /keys/.ssh/ in the same directory than our Vagrantfile and generated the key using ssh-keygen command.

We also added the following provision command to allow to log into the ssh:

sed -i ‘s/PasswordAuthentication no/PasswordAuthentication yes/g’ /etc/ssh/sshd_config
sed -i ‘s/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g’ /etc/ssh/sshd_config
service ssh restart