3

I updated my local linux notebook from Ubuntu 20.04 to 22.04. I did a fresh installation for several reasons.

Now I have a problem with my most important vagrantbox. This box encapsulates my development environment. I thought I could just start this box after a fresh installation and then everything works the way I am used to. Now I'm running into an error with OpenSSL 3.0 which breaks the VM provisioning. I run my start.sh which basically invokes vagrant validate, vagrant box update and vagrant up. So nothing spectacular.

This is my Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

IMAGE_NAME = "ubuntu/jammy64" # impish = 21.10 | jammy = 22.04 | bento/ubuntu-21.10
HOSTNAME = "pegasus"
#IP="10.42.10.10"

Vagrant.configure(2) do |config|

    #
    # Vagrantbox: pegasus
    #
    config.vm.define HOSTNAME do |pegasus|
        pegasus.vm.box = IMAGE_NAME
        pegasus.vm.hostname = HOSTNAME
        #pegasus.vm.network :private_network, ip: IP

        if Vagrant.has_plugin?("vagrant-cachier")
            pegasus.cache.scope = :box # Configure cached packages to be shared between instances of the same base box
        end

        pegasus.vm.provider "virtualbox" do |v|
            v.memory = 1024*6
            v.cpus = 2
            v.customize ["modifyvm", :id, "--groups", "/vagrantboxes"]
            # v.customize ["modifyvm", :id, "--ioapic", "on"] # https://www.mkwd.net/improve-vagrant-performance/
            v.name = HOSTNAME
        end

        # copy files and mount shared volumes
        pegasus.ssh.forward_agent = true # If true, agent forwarding over SSH connections is enabled. Defaults to false.
        pegasus.vm.provision "file", source: "~/.ssh", destination: "/home/vagrant/.ssh"
        pegasus.vm.synced_folder "~/tmp", "/home/vagrant/tmp"
        pegasus.vm.synced_folder "~/work", "/home/vagrant/work"

        # provisioning
        pegasus.vm.provision "shell", :inline => "sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime", run: "always"
        pegasus.vm.provision "shell", path: "provision/install/uninstall.sh"
        pegasus.vm.provision "shell", path: "provision/configure.sh"
        pegasus.vm.provision "shell", path: "provision/ssh-keys.sh", privileged: false # Use default user (vagrant) instead of root
        pegasus.vm.provision :docker
        pegasus.vm.provision "shell", path: "docker/images/build-images.sh"
        pegasus.vm.provision :docker_compose, yml: "/vagrant/docker/services/ops/docker-compose.yml", run: "always"
        pegasus.vm.provision :docker_compose, yml: "/vagrant/docker/services/services/docker-compose.yml", run: "always"
        pegasus.vm.provision "shell", path: "provision/install/update-upgrade.sh"
        pegasus.vm.provision "shell", path: "provision/install/basic-packages.sh"
        pegasus.vm.provision "shell", path: "provision/install/java.sh"
        pegasus.vm.provision "shell", path: "provision/install/node.sh"
        pegasus.vm.provision "shell", path: "initialize/rundeck/init.sh"

        # in use -> see src/main/vagrantboxes/pegasus/docker/services/docker-compose.yml
        pegasus.vm.network "forwarded_port", host: 7100, guest: 9100
        pegasus.vm.network "forwarded_port", host: 7110, guest: 7110
        pegasus.vm.network "forwarded_port", host: 7440, guest: 7440
        pegasus.vm.network "forwarded_port", host: 7990, guest: 7990

        # prepared
        pegasus.vm.network "forwarded_port", host: 7000, guest: 7000 # free
        pegasus.vm.network "forwarded_port", host: 7080, guest: 7080 # free
        pegasus.vm.network "forwarded_port", host: 7081, guest: 7081 # free
        pegasus.vm.network "forwarded_port", host: 7443, guest: 7443 # free
        pegasus.vm.network "forwarded_port", host: 7888, guest: 7888 # pegasus/website & pegasus/docs-website
    end
end

Everytime I start this box on my fresh Ubuntu installation I run into this error:

[INFO] Startup
Bringing machine 'pegasus' up with 'virtualbox' provider...
==> pegasus: Importing base box 'ubuntu/jammy64'...
==> pegasus: Matching MAC address for NAT networking...
==> pegasus: Checking if box 'ubuntu/jammy64' version '20220423.0.0' is up to date...
==> pegasus: Setting the name of the VM: pegasus
==> pegasus: Clearing any previously set network interfaces...
==> pegasus: Preparing network interfaces based on configuration...
    pegasus: Adapter 1: nat
==> pegasus: Forwarding ports...
    pegasus: 9100 (guest) => 7100 (host) (adapter 1)
    pegasus: 7110 (guest) => 7110 (host) (adapter 1)
    pegasus: 7440 (guest) => 7440 (host) (adapter 1)
    pegasus: 7990 (guest) => 7990 (host) (adapter 1)
    pegasus: 7000 (guest) => 7000 (host) (adapter 1)
    pegasus: 7080 (guest) => 7080 (host) (adapter 1)
    pegasus: 7081 (guest) => 7081 (host) (adapter 1)
    pegasus: 7443 (guest) => 7443 (host) (adapter 1)
    pegasus: 7888 (guest) => 7888 (host) (adapter 1)
    pegasus: 22 (guest) => 2222 (host) (adapter 1)
==> pegasus: Running 'pre-boot' VM customizations...
==> pegasus: Booting VM...
==> pegasus: Waiting for machine to boot. This may take a few minutes...
    pegasus: SSH address: 127.0.0.1:2222
    pegasus: SSH username: vagrant
    pegasus: SSH auth method: private key
    pegasus: Warning: Remote connection disconnect. Retrying...
    pegasus: Warning: Connection reset. Retrying...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
==> pegasus: Attempting graceful shutdown of VM...
/usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb:21:in `generate_key!': pkeys are immutable on OpenSSL 3.0 (OpenSSL::PKey::PKeyError)
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb:21:in `generate_key'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/kex/abstract.rb:32:in `initialize'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/algorithms.rb:437:in `new'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/algorithms.rb:437:in `exchange_keys'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/algorithms.rb:245:in `proceed!'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/algorithms.rb:184:in `accept_kexinit'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:210:in `block in poll_message'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:190:in `loop'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:190:in `poll_message'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:225:in `block in wait'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:223:in `loop'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:223:in `wait'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:90:in `initialize'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh.rb:251:in `new'
    from /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh.rb:251:in `start'
    from /usr/share/rubygems-integration/all/gems/vagrant-2.2.19/plugins/communicators/ssh/communicator.rb:467:in `block (2 levels) in connect'
    from /usr/lib/ruby/3.0.0/timeout.rb:97:in `block in timeout'
    from /usr/lib/ruby/3.0.0/timeout.rb:35:in `block in catch'
    from /usr/lib/ruby/3.0.0/timeout.rb:35:in `catch'
    from /usr/lib/ruby/3.0.0/timeout.rb:35:in `catch'
    from /usr/lib/ruby/3.0.0/timeout.rb:112:in `timeout'

I shortend the stacktrace for better readability. The actual message is way longer.

My environment consists of

  • Ubuntu 22.04
  • Kernel 5.15.0-25-generic
  • Virtualbox 6.1.32_Ubuntu r149290
  • Vagrant 2.2.19

Anyone got an idea on how I can fix this error? As I said, on my old Ubuntu 20.04 everything worked just fine.


UPDATE I just tried to start a new vagrantbox. Really basic. Same error.

# -*- mode: ruby -*-
# vi: set ft=ruby :

IMAGE_NAME = "ubuntu/jammy64" # jammy = 22.04
HOSTNAME = "ubuntu-cloud-init"

Vagrant.configure(2) do |config|
    config.vm.box = IMAGE_NAME
    config.vm.hostname = HOSTNAME

    config.vm.provider "virtualbox" do |v|
        v.memory = 2048
        v.cpus = 2
        v.customize ["modifyvm", :id, "--groups", "/vagrantboxes"]
        v.name = HOSTNAME
    end

    config.vm.provision "shell", path: "provision/configure.sh"
    config.vm.provision "shell", path: "provision/install/update-upgrade.sh"
    config.vm.provision "shell", path: "provision/install/basic-packages.sh"
end
3
  • I thought the line /usr/share/rubygems-integration/all/gems/net-ssh-6.1.0/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb:21:in 'generate_key!': pkeys are immutable on OpenSSL 3.0 (OpenSSL::PKey::PKeyError indicates an OpenSSL error ... am I mistaken? Commented Apr 25, 2022 at 13:38
  • I just tried to start a new vagrantbox. Really basic. Same error. I updated my question ... Commented Apr 26, 2022 at 6:45
  • there is a solutin here, that does work in some cases (not mine though): stackoverflow.com/questions/71987581/…
    – rubo77
    Commented Apr 30, 2022 at 5:34

2 Answers 2

0

Installing like sugested on https://www.vagrantup.com/downloads this doesn't work:

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install vagrant

But manually installing the Debian package works though:

sudo apt-get remove vagrant
# this will remove the packages vagrant and vagrant-libvirt
sudo dpkg -i vagrant_2.2.19_i686.deb

REALLY STRANGE!!! maybe it is important to uninstall the package vagrant-libvirt?

More updates on the issue here: https://github.com/hashicorp/vagrant/issues/12751

0

TLDR; Upgrade to Ruby 2.7 and recent versions of dependencies for vagrant.


Anyone got an idea on how I can fix this error? As I said, on my old Ubuntu 20.04 everything worked just fine.

Generally speaking: Fix the net-ssh package for Ruby 2.6 or upgrade to Ruby 2.7.

On Gentoo, this worked out for me (2022-05).

After allowing "testing" or "unstable" versions of packages:

$ emerge app-emulation/vagrant -1va 

These are the packages that would be merged, in order:

Calculating dependencies  ..... done!
[ebuild   R    ] dev-ruby/log4r-1.1.10-r3::gentoo  USE="-doc -test" RUBY_TARGETS="ruby26 ruby27* (-ruby30)" 0 KiB
[ebuild   R    ] dev-ruby/ed25519-1.2.4-r1:1::gentoo  USE="-doc -test" RUBY_TARGETS="ruby26 ruby27* (-ruby30)" 0 KiB
[ebuild     U ~] dev-ruby/vagrant_cloud-3.0.5::gentoo [3.0.2::gentoo] USE="-doc -test" RUBY_TARGETS="ruby26 ruby27* -ruby30%" 35 KiB
[ebuild     U ~] app-emulation/vagrant-2.2.18-r1::gentoo [2.2.9-r1::gentoo] USE="-test (-virtualbox%*)" RUBY_TARGETS="ruby26 ruby27%*" 1,583 KiB

Total: 4 packages (2 upgrades, 2 reinstalls), Size of downloads: 1,617 KiB

Would you like to merge these packages? [Yes/No] Yes
>>> Verifying ebuild manifests
>>> Emergink (1 of 4) dev-ruby/log4r-1.1.10-r3::gentoo
>>> Emergink (2 of 4) dev-ruby/ed25519-1.2.4-r1::gentoo
>>> Instlink (1 of 4) dev-ruby/log4r-1.1.10-r3::gentoo
>>> Emergink (3 of 4) dev-ruby/vagrant_cloud-3.0.5::gentoo
>>> Instlink (2 of 4) dev-ruby/ed25519-1.2.4-r1::gentoo
>>> Instlink (3 of 4) dev-ruby/vagrant_cloud-3.0.5::gentoo
>>> Emergink (4 of 4) app-emulation/vagrant-2.2.18-r1::gentoo
>>> Instlink (4 of 4) app-emulation/vagrant-2.2.18-r1::gentoo
(...)

Then refresh plugins for vagrant (READ what it warns you about).

$ vagrant plugin expunge --reinstall

Continue? [N]: Y

All user installed plugins have been removed from this Vagrant environment!

Vagrant will now attempt to reinstall user plugins that were removed.
(...)
Installed the plugin 'vagrant-disksize (0.1.3)'!
Installed the plugin 'vagrant-vbguest (0.30.0)'!

And now UP:

$ vagrant up
(...)
==> pegasus: Successfully added box 'ubuntu/jammy64' (v20220423.0.0) for 'virtualbox'!
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The host path of the shared folder is missing: ~/work
* The 'docker_compose' provisioner could not be found.
* The 'docker_compose' provisioner could not be found.
(...)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .