Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I misspelled the name of a box when I added it to my box list:

vagrant box list
debian
ubnutu

Can I rename the box without repackaging it?

share|improve this question

2 Answers 2

You can simply rename the dir that represents the box. If your vagrant files are in their default dir (i.e. /path/to/your/home/.vagrant.d) you can just do:

mv vagrant_path/boxes/box_to_rename vagrant_path/boxes/new_box_name

Also be sure to change the Vagrantfile to use the new label for the box. You just need to change the config.vm.box directive to reflect the changes.

share|improve this answer
    
This didn't work for me - I suspect there is a config file somewhere that needs to be updated as well. @Till's suggestion worked. –  Adrian Mouat Feb 11 at 11:35
    
@AdrianMouat: Hmm, worked for me. Did you have VMs actively running with the box in question at the time of the rename? I could imagine that maybe causing problems, though I don't really know that or why it would, necessarily. What results did you get when you tried? –  lindes-hw Nov 16 at 6:36
    
@lindes-hw I've no idea, it was 10 months ago... –  Adrian Mouat Nov 17 at 9:13
    
@AdrianMouat: fair enough. Mostly, I just wanted to not have that comment left there un-responded-to, as it detracts (to my mind) from the idea of this being a correct answer, and yet, I think it is. If there are real problems with it, though, it would be good to hear about them - whether from you, or someone else who encounters them in the future. –  lindes-hw Nov 17 at 18:31
    
@lindes-hw It might be relevant that I was running on Mac OS. I don't believe I had actively running VMs at the time; I think I would have checked that. –  Adrian Mouat Nov 18 at 19:11

I would do this:

$ vagrant box repackage mis-spelled-name
[vagrant] Compressing package to: /Users/johndoe/package.box
$ vagrant box add correct-name /Users/johndoe/package.box
...

Not the worst to know about these two anyway, since you can frequently update base boxes (e.g. to update the kernal, software and guest editions) to avoid running all these required updates every time you vagrant up.

share|improve this answer
    
Is it okay to delete the package.box file when this is done? –  Peter Hanley Oct 8 '12 at 0:33
1  
@PeterHanley Yep. Once imported, it's ok to get rid off it. –  Till Oct 8 '12 at 16:35
    
Thanks, I appreciate you getting back to me! –  Peter Hanley Oct 10 '12 at 21:24
    
Note that this will take much longer than simply renaming the underlying file, and does lots of extra work that's probably not necessary in most (all?) cases. –  lindes-hw Nov 16 at 6:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.