• Home
  • Solutions
  • Pricing
  • Blog
  • Contact
  • Portfolio
  • Toolbox
  • WizOne Solutions
  • Home
  • Solutions
  • Pricing
  • Blog
  • Contact
  • Portfolio
  • Toolbox
  • Menu

Fixing “The box … could not be found” in the new Vagrant (1.1+)

Posted on April 18, 2013 by WizOne Solutions - DevOps

Visual people: Watch this screencast

Anti-video readers: Keep reading.

This morning I ran into an issue with my Vagrant upgrade (I went from 1.0.7 to 1.2.1) that took me a few hours to figure out. I did, however, solve it in the end and thought it’d be useful to share how. It’s an easy fix.

First, the error I was getting was:

The box ‘boxname’ could not be found.

(where boxname was the actual name of the box, e.g. precise32)

The box did show up when I ran vagrant box list, so I knew that it should have been working.

After trying an assortment of things, including converting my Vagrantfile configuration to the version 2 format and trying to use the box in a fresh directory and with a fresh Vagrantfile, I decided to try re-adding the precise32 box that Vagrant provides. I did that, and then typed vagrant init precise32d. (I had called it precise32d.) This worked fine. I deduced that there must have been some change in the box itself. So I fired up DiffMerge.

DiffMerge told me that there weren’t any files it could compare. This, I discovered, was because everything in the new box I had downloaded was under a virtualbox directory. A-ha! I was on to something. I looked in that directory and saw these files:

Vagrantfile box.ovf box-disk1.vmdk metadata.json

Wait, metadata.json? That wasn’t in my existing box’s folder at all! What could be in there, I wondered?

$ cat virtualbox/metadata.json

{“provider”:”virtualbox”}

Ah. So it’s relying on this to figure out the provider, since Vagrant 1.1+ has the concept of providers other than VirtualBox. That explained a lot. The simplest fix is just as you may suppose:

To eliminate the potential for human error, we’ll use an existing metadata.json file. Run:

$ vagrant box add precise32 http://files.vagrantup.com/precise32.box

Wait for it to download and be added.

Then,

$ cd ~/.vagrant.d/boxes/yourbox

$ mkdir virtualbox

$ mv * virtualbox (or you can specify all the filenames manually)

$ cp ../precise32d/virtualbox/metadata.json virtualbox

You should now be able to vagrant up any projects that are relying on your pre-upgrade box. And they should work just as well as they did before!

Some notes:

  • I assume your boxes are VirtualBox VMs. If they’re not, then you probably wouldn’t have this issue anyway.
  • Don’t type the $ marks. That’s just to show you type the command in a terminal.

Tags: 1.0, 1.1, 1.2, box, format, found, metadata.json, not, vagrant, virtualbox

Latest Posts

  • Avoid colons when manually installing Meteor packages
  • Moving a custom profile to its own repo
  • Drupal 7: Watch for hyphens in CTools and Panels plugin names
  • Thinking about starting a web service for two-way synchronization of Habitica and Todoist

Connect

  • Twitter
  • LinkedIn
  • Facebook Page
  • RSS

Projects and Services

  • FillPDF Service
  • FillPDF Drupal Module

Partners

  • April Afternoon (web development + web design; projects when I'm busy)
  • Project Ricochet (full-service agency; projects when I'm busy)
  • Think Up! Design (web design, branding)
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

© 2022 WizOne Solutions.