Vagrant syntax to remove just one box-version

19 views
Skip to first unread message

James E Keenan

unread,
May 28, 2021, 9:23:51 PM5/28/21
to vagra...@googlegroups.com
I have a server on which I use Vagrant to install and manage VirtualBox
VMs for various operating systems. Over time I have installed 3
different OpenBSD VMs. The box for each of these was originally
obtained from the listings at vagrantup.com. Each box holds a different
OpenBSD version.

I believe the following command accurately lists the Vagrant box versions:

###
$ ls -l .vagrant.d/boxes/generic-VAGRANTSLASH-openbsd6/
total 2
drwxr-xr-x 3 vmuser vmuser 3 Nov 4 2018 1.8.40
drwxr-xr-x 3 vmuser vmuser 3 Oct 7 2019 1.9.34
drwxr-xr-x 3 vmuser vmuser 3 Feb 1 2020 2.0.6
###

This data correlates with the output of this command:

###
$ vagrant box list | grep -i openbsd
generic/openbsd6 (virtualbox, 1.8.40)
generic/openbsd6 (virtualbox, 1.9.34)
generic/openbsd6 (virtualbox, 2.0.6)
###

Problem: I want to make sure that I am using the correct syntax to
remove *one* of the boxes but not the others. Suppose that I want to
remove 1.8.40. Is the following the correct way to remove that one and
leave the other two untouched?

###
vagrant box remove generic-openbsd6 --provider virtualbox --box-version
1.8.40
###

Thank you very much.
Jim Keenan

Alvaro Miranda Aguilera

unread,
May 29, 2021, 3:04:57 AM5/29/21
to vagra...@googlegroups.com
Hello

If you are comfortable with command line, you can remove the directory version of the box you want to remove.

.vagrant.d/boxes/generic-VAGRANTSLASH-openbsd6/1.8.40/


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/vagrant/issues
Discuss: https://discuss.hashicorp.com/c/vagrant/24
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/45adf0de-0631-50e3-6c5c-ff7141e45db2%40pobox.com.


--
Alvaro

James E Keenan

unread,
May 29, 2021, 7:16:22 AM5/29/21
to vagra...@googlegroups.com
On 5/29/21 3:04 AM, Alvaro Miranda Aguilera wrote:
> Hello
>
> If you are comfortable with command line, you can remove the directory
> version of the box you want to remove.
>
> .vagrant.d/boxes/generic-VAGRANTSLASH-openbsd6/1.8.40/
>
>

Well, that doesn't answer the question I asked. What I asked was:

>
> Is the following the correct way to remove that one and
> leave the other two untouched?
>
> ###
> vagrant box remove generic-openbsd6 --provider virtualbox --box-version
> 1.8.40
> ###
>

I know that I can remove directories from the command line. But I would
presume that a 'vagrant' command would be so formulated as to do that
safely and precisely and would be knowledgeable enough so that it would
delete the correct information in as many places as is needed -- rather
than having the user attempt to guess where all the relevant data is
located.

So I re-pose my original question.

dragon788

unread,
May 29, 2021, 9:35:49 AM5/29/21
to Vagrant
You are correct, you can remove specific versions by passing in the --box-version.

James E Keenan

unread,
Jun 1, 2021, 10:56:15 AM6/1/21
to vagra...@googlegroups.com
On 5/29/21 9:35 AM, dragon788 wrote:
> You are correct, you can remove specific versions by passing in the
> --box-version.
>
>

Thanks for confirming that. I have now successfully removed 4 old VMs
using that command.
Reply all
Reply to author
Forward
0 new messages