簡體   English   中英

啟動 Vagrantbox 時出現 Openssl 3.0 錯誤

[英]Openssl 3.0 error when booting Vagrantbox

我將本地 linux 筆記本從 Ubuntu 20.04 更新到 22.04。 由於幾個原因,我進行了全新安裝。

現在我最重要的 vagrantbox 有問題。 這個盒子封裝了我的開發環境。 我以為我可以在全新安裝后啟動這個盒子,然后一切都按照我習慣的方式工作。 現在我遇到了 OpenSSL 3.0 的錯誤,它破壞了 VM 配置。 我運行我的 start.sh,它基本上調用vagrant validatevagrant box updatevagrant up 所以沒什么了不起的。

這是我的流浪文件:

# -*- 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

每次我在全新的 Ubuntu 安裝上啟動此框時,都會遇到此錯誤:

[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'

我縮短了堆棧跟蹤以獲得更好的可讀性。 實際消息要長得多。

我的環境包括

  • Ubuntu 22.04
  • 內核 5.15.0-25-generic
  • Virtualbox 6.1.32_Ubuntu r149290
  • 流浪者 2.2.19

有人知道如何解決此錯誤嗎? 正如我所說,在我的舊 Ubuntu 20.04 上一切正常。

  1. 這里下載最新的 .deb 版本(不要使用存儲庫!向下滾動到頁面底部)
  2. 確保刪除以前安裝的 vagrant : sudo apt purge vagrantsudo apt autoremove
  3. 還刪除與以前的流浪安裝添加的密鑰: sudo apt-key list以查找 hashcorp 密鑰並將其刪除: sudo apt-key del "E8A0 32E0 94D8 EB4E A189 D270 DA41 8C88 A321 9F7B"在您的情況下,密鑰可能不同.
  4. 還要刪除與先前的 vagrant 安裝一起添加的存儲庫: sudo ls /etc/apt/sources.list.d以查找存儲庫並將其刪除: sudo rm /etc/apt/sources.list.d/archive_uri-https_apt_releases_hashicorp_com-jammy.list
  5. 打開一個終端和 CD 到您將其下載到的位置,例如: cd /Downloads
  6. 運行以下命令(注意你的包名可能不同): sudo dpkg -i vagrant_2.2.19_i686.debsudo dpkg -i vagrant_2.2.19_x86_64.deb

您可能必須在再次vagrant up之前vagrant destroy您當前的 VM。

希望現在您的問題已經解決。

這個解決方案的所有功勞都歸功於這里的這些人。

這對我不起作用,我在 Ubuntu 22.04 上做了apt purge vagrant* ,然后從網站上安裝了 .deb 版本。 我使用 test-kitchen 和 kitchen-vagrant 進行構建測試。 我的測試廚房設置構建了虛擬機,但隨后失敗

Failed to complete #create action: [pkeys are immutable on OpenSSL 3.0] on ssh-ubuntu-focal64

廚房狀態顯示

$ kitchen status
Instance             Driver   Provisioner  Verifier  Transport  Last Action    Last Error
ssh-ubuntu-focal64   Vagrant  SaltSolo     Busser    Ssh        <Not Created>  OpenSSL::PKey::PKeyError
ssh-debian-buster64  Vagrant  SaltSolo     Busser    Ssh        <Not Created>  <None>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM