Archive for October, 2017

Vagrant: editing metadata_url file causes illegal character issue

Tuesday, October 10th, 2017

I was editing the ~/.vagrant.d/boxes//metadata_url file in a box I was testing and when I ran “vagrant box update” I received the following:

$ vagrant box update
==> default: Checking for updates to 'edev-developer'
    default: Latest installed version: 2.0.5
    default: Version constraints: 
    default: Provider: virtualbox
There was an error while downloading the metadata for this box.
The error message is shown below:

Illegal characters found in URL


The illegal character happens to be an EOL char added automatically by your editor, mine was vi, and that is causing the error. I used the following commands to remove the eol character from the file.

perl -pe 'chomp if eof' .vagrant.d/boxes//metadata_url > .vagrant.d/boxes//metadata_url2
mv ~/.vagrant.d/boxes//metadata_url2 ~/.vagrant.d/boxes//metadata_url