【发布时间】:2022-07-07 13:33:24
【问题描述】:
我将本地 linux 笔记本从 Ubuntu 20.04 更新到 22.04。出于多种原因,我进行了全新安装。
现在我最重要的 vagrantbox 出现了问题。这个盒子封装了我的开发环境。我以为我可以在全新安装后启动这个盒子,然后一切都按照我习惯的方式工作。现在我遇到了 OpenSSL 3.0 的错误,它破坏了 VM 配置。我运行我的 start.sh,它基本上调用 vagrant validate、vagrant box update 和 vagrant up。所以没什么了不起的。
这是我的 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
每次我在全新的 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 上一切正常。
【问题讨论】:
-
Ubuntu 22.04 将 OpenSSL 升级到 3.0 但 apparently ruby net-ssh doesn't yet support that。他们似乎正在努力,但遇到了麻烦。 (PS 重新投票:我认为 vagrant 在这里有资格作为开发工具,尽管这值得商榷。)
-
据我了解,问题出在我的主机操作系统上?我将 Vagrantbox 降级到 21.04。结果相同。所以解决方案是等到 ruby-net-ssh 包修复/支持 OpenSSL 3.0?或者我现在可以做点什么吗?更新 ruby-net-ssh?通过 apt-get 或其他方式?
-
将鼠标悬停在 vagrant 和 virtualbox 标签上并阅读它们。
-
移至超级用户 -> superuser.com/questions/1717913/…
标签: ubuntu openssl vagrant virtualbox