#1057808 vagrant: 'vagrant box prune' raises 'undefined method `provider' for nil:NilClass (NoMethodError)'

Package:
vagrant
Source:
vagrant
Description:
Tool for building and distributing virtualized development environments
Submitter:
Philippe SWARTVAGHER
Date:
2023-12-08 18:33:03 UTC
Severity:
normal
#1057808#5
Date:
2023-12-08 18:29:45 UTC
From:
To:
Dear Maintainer,

When I run the command `vagrant box prune`, I get the following output
(and error):
The following boxes will be kept...
generic/debian10 (virtualbox, 4.3.2)
generic/debian11 (virtualbox, 3.6.12)
generic/debian12 (virtualbox, 4.3.8)

Checking for older boxes...
Box 'generic/debian12' (v4.3.6) with provider 'virtualbox' appears
to still be in use by at least one Vagrant environment. Removing
the box could corrupt the environment. We recommend destroying
these environments first:

test (ID: 303e585f8f23406dbf2de67ab5d7d1e8)

Are you sure you want to remove this box? [y/N]
/usr/share/rubygems-integration/all/gems/vagrant-libvirt-0.11.2/lib/vagrant-libvirt/action/remove_libvirt_image.rb:15:in
`call': undefined method `provider' for nil:NilClass (NoMethodError)

return @app.call(env) unless env[:box_removed].provider == :libvirt
^^^^^^^^^
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in
`call'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/lib/vagrant/action/builtin/box_remove.rb:123:in
`call'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in
`call'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in
`call'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in
`block in run'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in
`busy'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in
`run'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/plugins/commands/box/command/prune.rb:114:in
`block in delete_oldest_boxes'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/plugins/commands/box/command/prune.rb:102:in
`each'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/plugins/commands/box/command/prune.rb:102:in
`delete_oldest_boxes'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/plugins/commands/box/command/prune.rb:48:in
`execute'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/plugins/commands/box/command/root.rb:66:in
`execute'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/lib/vagrant/cli.rb:67:in
`execute'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/lib/vagrant/environment.rb:301:in
`cli'
from
/usr/share/rubygems-integration/all/gems/vagrant-2.3.4/bin/vagrant:243:in
`<top (required)>'
from /usr/bin/vagrant:25:in `load'
from /usr/bin/vagrant:25:in `<main>'

At the question `Are you sure you want to remove this box? [y/N]`, I hit
Enter to select the 'N' answer.

I'm using VirtualBox and not libvirt, but I have some libvirt-related
packages:
ii libsys-virt-perl 9.8.0-1
ii libvirt-l10n 9.10.0-1
ii libvirt0:amd64 9.10.0-1
ii ruby-fog-libvirt 0.11.0-1
ii ruby-libvirt 0.7.1-2
ii vagrant-libvirt 0.11.2-1

Nevertheless, it seems `vagrant box prune` did correctly its job...

Thanks!

Philippe.