hashicorp/vagrant

Curl broken in macOS vagrant 1.8.7

docwhat opened this issue Β· 31 comments

Vagrant version

Vagrant 1.8.7

Installed via brew cask install vagrant.

Host operating system

macOS Sierra
10.12.1

Vagrantfile

For testing I'm using this image, but it fails with anything that uses curl

vagrant init bento/centos-7.2

Debug output

From running vagrant box update

...
 INFO interface: output: Checking for updates to 'bento/centos-7.2'
 INFO interface: output: ==> default: Checking for updates to 'bento/centos-7.2'
==> default: Checking for updates to 'bento/centos-7.2'
 INFO interface: detail: Latest installed version: 2.3.0
 INFO interface: detail:     default: Latest installed version: 2.3.0
    default: Latest installed version: 2.3.0
 INFO interface: detail: Version constraints:
 INFO interface: detail:     default: Version constraints:
    default: Version constraints:
 INFO interface: detail: Provider: virtualbox
 INFO interface: detail:     default: Provider: virtualbox
    default: Provider: virtualbox
 INFO downloader: Downloader starting download:
 INFO downloader:   -- Source: https://atlas.hashicorp.com/bento/centos-7.2
 INFO downloader:   -- Destination: /var/folders/sb/bms_668s56dcm__8z_zp799w0000gn/T/vagrant-load-metadata20161111-9721-1ntvv4f
 INFO subprocess: Starting process: ["/opt/vagrant/embedded/bin/curl", "-q", "--fail", "--location", "--max-redirs", "10", "--user-agent", "Vagrant/1.8.7 (+https://www.vagrantup.com; ruby2.2.5)", "-H", "Accept: application/json", "--output", "/var/folders/sb/bms_668s56dcm__8z_zp799w0000gn/T/vagrant-load-metadata20161111-9721-1ntvv4f", "https://atlas.hashicorp.com/bento/centos-7.2"]
 INFO subprocess: Command in the installer. Specifying DYLD_LIBRARY_PATH...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stderr: dyld: Library not loaded: @rpath/libcurl.4.dylib
  Referenced from: /opt/vagrant/embedded/bin/curl
  Reason: Incompatible library version: curl requires version 9.0.0 or later, but libcurl.4.dylib provides version 7.0.0
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 6
 WARN downloader: Downloader exit code: 6
ERROR downloader: Exit code: 6
...

Steps to reproduce

  1. vagrant init bento/centos-7.2
  2. vagrant box update

Workaround

sudo rm -f /opt/vagrant/embedded/bin/curl

Impact

This breaks all network features (metadata, getting boxes, updating boxes, etc.) in Vagrant.

zg commented

I followed the steps you outlined and tried running vagrant up:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/centos-7.2' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
The box 'bento/centos-7.2' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://atlas.hashicorp.com/bento/centos-7.2"]
Error: 

I'm running El Capitan (10.11.6 (15G1108)) and am seeing the same exact problem.

The workaround also worked.

@zg:

I should have mentioned the error is also silently eaten by the vagrant command. I had to use debug to see the dynlib errors from curl.

You're seeing the same error I'm reporting. Try the work-around and see if that fixes it.

zg commented

That didn't fix the issue I'm having, unfortunately.

@zg: linking system curl didn't fix the issue for you?

zg commented

It did not. One thing to note is that I have System Integrity Protection disabled, though I don't know if that is relevant.

The workaround helped me with the following error:

docker-host: URL: file:///Users/paulj/Desktop/intelligence-api/vagrant/vagrantcloud.proxy.json An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again.

Huh... vagrant box add -c bento/centos-7.1 works fine for me. (I already have the 7.2 image and I don't want to risk deleting it).

Your error message didn't format right and is missing the bit where it says something like 404 or something. Also, I see proxy in your path... are you using a proxy server? Could the problem be there? Also, I'm not sure what that path is... What is that .json file?

zg commented

Okay, I managed to fix the issue on my end.

I realized after some time that it seems like the .dmg file that is posted up on vagarantup.com is unreliably outdated, so I built vagrant from source.

  1. Install and link Ruby (to override the pre-installed Ruby that comes with macOS)

    brew install ruby && brew link ruby --force

  2. Clone the vagrant repository off of GitHub

    git clone https://github.com/mitchellh/vagrant

  3. Install the bundle program

    gem install bundler

  4. Switch to the vagrant directory and generate the executables

    cd vagrant && bundle --binstubs exec

  5. Link the newly generated executables

    ln -sf /path/to/vagrant/exec/vagrant /usr/local/bin/vagrant

Please see #7969

I did managed to build vagrant from source on Mac OSX "El capitΓ‘n", but IΒ΄m still unable to "vagrant box add laravel/homestead"

sudo rm -rf /opt/vagrant/embedded/bin/curl

Got it working for me

broken in Yosemite too

Confirmed sudo rm -rf /opt/vagrant/embedded/bin/curl works for me too. macOS Sierra.

I got this as well on Vagrant version 1.8.7 on Mac OS Sierra but "fixed" it by reverting to Vagrant version 1.8.6

Confirming that removing the embedded curl binary works for me as well. Thanks for the fix @DelightedD0D!

For reference, this fix worked for me on:

macOS 10.12.1
vagrant 1.8.7
virtualbox 5.1.8

Me too! :)

I was running fine on vagrant 1.8.1. Then while troubleshooting vagrant problems for someone else I updated to 1.8.7 and got the same networking issues. The workaround fixed the problem for me.

macOS Sierra 10.12.1
vagrant 1.8.7
parallels 10.3.0 (29227)

ditto. i ran sudo rm /opt/vagrant/embedded/bin/curl and that allowed me to add boxes.

@chuckreynolds' solution worked for me. Running Vagrant 1.8.7 on Sierra 10.12.2 Beta (16C48b) with Xcode 8.2 Beta 2.

Same here. The workaround provided are working, but we'll stick on the 1.8.6 version time for a fix :)

More debug information:

/opt/vagrant/embedded/bin/curl --version
dyld: Library not loaded: @rpath/libcurl.4.dylib
  Referenced from: /opt/vagrant/embedded/bin/curl
  Reason: Incompatible library version: curl requires version 9.0.0 or later, but libcurl.4.dylib provides version 7.0.0
Trace/BPT trap: 5

Running on OS X El Capitan 10.11.6

jwm commented

See #7969 - looks like this will be fixed in Vagrant 1.8.8.

FWIW,
sudo rm -rf /opt/vagrant/embedded/bin/curl
fixed it for me too, OS X 10.10.5
vagrant 1.8.7

Yay thanks!! Fixed my MacOS 10.12.1... Oddly enough this was the same problem, the Windows version af Vagrant struggled with some months ago...

Just to add to the debug (vagrant 1.8.7, macOS sierra 10.12.1)

otool -L /opt/vagrant/embedded/bin/curl /usr/bin/curl | grep libcurl

/opt/vagrant/embedded/bin/curl:
	@rpath/libcurl.4.dylib (compatibility version 9.0.0, current version 9.0.0)
/usr/bin/curl:
	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 8.0.0)

Happened to me as well on macOS sierra 10.12.1 and the suggested work-around works for me:

sudo rm -rf /opt/vagrant/embedded/bin/curl

duplicate of #7997

@kikitux this is #7997, did you mean to close it as a duplicate of itself?

FYI: This issue still remains as of today. Fortunately, the posted workaround of deleting vagrant's embedded curl binary works.

Vagrant 1.8.7
MacOS 10.12.1 (Sierra)

The issue stills happening up today. I'm using an El Captain with the latest Vagrant version (1.8.7).

I inform that the aforementioned workaround (deleting curl) has been worked too.