Add Bash completion to Vagrant?


I just migrated my main workstation from OpenSUSE Tumbleweed to Rocky Linux 8.6 + KDE.

One of the tools I’m using almost daily is Vagrant in combination with VirtualBox, for teaching and testing purposes. The vagrant package is provided by the third-party Hashicorp repository for RHEL 8.

Under OpenSUSE I had Bash autocompletion for all the vagrant commands. This doesn’t seem to work under Rocky Linux.

Anyone here using Vagrant under Rocky Linux with Bash completion ?



It looks like this vagrant command should get you there: vagrant autocomplete install --bash … If there are other shells you want to include, you can add them after bash, i.e., --zsh

1 Like

The command doesn’t work, but I investigated what’s going on under the hood. It adds a one-liner to ~/.bashrc to source the file under /opt/vagrant, but it gets the path wrong. I did a simple find /opt -name and corrected the entry accordingly:

source /opt/vagrant/embedded/gems/2.3.1/gems/vagrant-2.3.1/contrib/bash/

Reloaded my session, and now Bash completion works like a charm.

Thanks very much !

You are very welcome!