hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.22k stars 4.43k forks source link

App Image package builds an older version of libcurl which results in a failure when running `VBoxManage` #11735

Open zioalex opened 4 years ago

zioalex commented 4 years ago

Vagrant version

vagrant version 2.2.7 and 2.2.9

Host operating system

Ubuntu 18.04

Guest operating system

Macos Cataline - but not relevant

Vagrantfile

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

Vagrant.require_version ">= 2.2.7"

# require virtualbox 6.1 or higher
# The follow check generate the error
# /usr/lib/virtualbox/VBoxManage: /tmp/.mount_vagranussWKE/usr/lib/x86_64-linux-gnu/libcurl.so.4: version  `CURL_OPENSSL_4' not found (required by /usr/lib/virtualbox/VBoxRT.so)

if Gem::Version.new(`VBoxManage --version`.strip) <= Gem::Version.new('6.1.0')
  abort "Please upgrade Virtualbox to 6.1.0 or later!"
end

Vagrant.configure("2") do |config|
  config.vm.box = "ramsey/macos-catalina"
  config.vm.box_version = "1.0.0"
  # Note this violating the Apple EULA
  # https://github.com/ramsey/macos-vagrant-box/issues/1
  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--cpuidset", "1","000206a7","02100800","1fbae3bf","bfebfbff"]
    vb.customize ["setextradata", :id, "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct", "MacBookPro11,3"]
    vb.customize ["setextradata", :id, "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion", "1.0"]
    vb.customize ["setextradata", :id, "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct", "Iloveapple"]
    vb.customize ["setextradata", :id, "VBoxInternal/Devices/smc/0/Config/DeviceKey", "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"]
  end
  config.vm.synced_folder ".", "/Users/vagrant/data", type: "rsync"
  config.vm.provision :shell, :path => 'scripts/provision.sh'
end

Debug output

Expected behavior

The usual vagrant help output

Actual behavior

When I just run vagrant I get the follow error:

> vagrant 
/usr/lib/virtualbox/VBoxManage: /tmp/.mount_vagranw8073c/usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_4' not found (required by /usr/lib/virtualbox/VBoxRT.so)
Please upgrade Virtualbox to 6.1.0 or later!

I identified the problem in the first if check:

if Gem::Version.new(`VBoxManage --version`.strip) <= Gem::Version.new('6.1.0')
  abort "Please upgrade Virtualbox to 6.1.0 or later!"
end

But I do not understand why. If I comment such lines vagrant works regularly so far.

I tried with the latest Vagrant 2.2.9 and cleaning up the ~/.vagrant.d dir but nothing change.

Steps to reproduce

  1. run vagrant

References

9908

briancain commented 4 years ago

@zioalex - Your Vagrantfile is doing the check, not vagrant. It's right there above the configure. You can just remove that, it's not required. The warning you are seeing is coming from ruby executing the VirtualBox version.

And, assuming you want to leave it in, the check is wrong. It's saying that you can use VirtualBox 6.1.0 but the check itself includes that version as bad and aborts due to the <= in the if statement. If 6.1.0 is ok, then it should just be <.

Again, this is not something Vagrant is doing, but just something you have in your Vagrantfile. Hope that makes sense, thanks!

zioalex commented 4 years ago

Hi @briancain, thanks to have pointed out the error in the check. Fixed. Nevertheless I get the same error.

How can I track done the broken ruby/gem version?

zioalex commented 4 years ago

I think this was closed too prematurely!

briancain commented 4 years ago

Hey @zioalex - I believe it's because VBoxManage --version is returning nothing. You can try it yourself by printing it and running vagrant status. I just tried it myself with the linux package (which I believe you're using).

vagrant@vagrant:~/test$ ./vagrant status
/usr/lib/virtualbox/VBoxManage: /tmp/.mount_vagran52b6ul/usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_4' not found (required by /usr/lib/virtualbox/VBoxRT.so)
The version: 0
vagrant@vagrant:~/test$ cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.

puts "The version: #{Gem::Version.new(`/usr/bin/VBoxManage --version`.strip)}"
# Other vagrant stuff ....

It seems like because the app image package is built against an older version of libcurl, it seems to be affecting the output of running system commands. For example, using the debian package, I don't get the same result:

vagrant@vagrant:~/test$ vagrant status
The version: 6.1.10r138449
Current machine states:
ubuntu                    not created (virtualbox)
hashicorp                 not created (virtualbox)
windows                   not created (virtualbox)
docker-1                  not created (virtualbox)
docker-2                  not created (virtualbox)
docker-3                  not created (virtualbox)
This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.

It sounds like this should be fixed in the next release with an updated libcurl. But for now I'd remove the app image package and install the debian package instead.

zioalex commented 4 years ago

@briancain , I downloaded the latest vagrant version because in Ubuntu doesn't exist yet the 2.2.9 version and I needed it. Is there already an issue to update the appimage to the latest curl version or will be it tracked here?

briancain commented 4 years ago

@zioalex - You can install the official debian package here: https://www.vagrantup.com/downloads The Vagrant package in Ubuntu repos will be pretty old and isn't updated very often.

And yep, this issue will be tracking updating libcurl for the app image package here.

jl2501 commented 4 years ago

it doesn't seem that the issue is fixed by using the debian package available from Vagrants download links. (https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.deb)

any other options to get vagrant to work on Debian Buster at this time?

EDIT: please let me know if you need more information. error appears identical to original error, even after apt purge vagrant and installing vagrant from hashicorp's download link

briancain commented 4 years ago

@jl2501 the 2.2.9 debian package ships a recent version of curl:

vagrant@vagrant:~$ /opt/vagrant/embedded/bin/curl --version
curl 7.69.1 (x86_64-pc-linux-gnu) libcurl/7.69.1 OpenSSL/1.1.1g zlib/1.2.11 libssh2/1.8.0
Release-Date: 2020-03-11
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets
vagrant@vagrant:~$ vagrant -v
Vagrant 2.2.9

Do you have a debug log?

jl2501 commented 4 years ago

well, cancel that.

must be something I did to the env on the other machine. (I tried to reproduce from a fresh(er) Buster install on a different machine and have no problems here)