vagrant
vagrant copied to clipboard
`vagrant autocomplete` fails after update
Vagrant version
2.2.10 -> 2.2.14
Host operating system
linux (Lubuntu 18.04)
What happened
In vagrant 2.2.10 I installed autocomplete with the command
vagrant autocomplete install -b
After this I upgraded to version 2.2.14.
And then opening a new terminal lead to the following error:
bash: /opt/vagrant/embedded/gems/2.2.10/gems/vagrant-2.2.10/contrib/bash/completion.sh: No such file or directory
Indeed in the file .bashrc There was the line:
. /opt/vagrant/embedded/gems/2.2.10/gems/vagrant-2.2.10/contrib/bash/completion.sh
re-installing autocomplete with the new version did not update this line. Manually removing this line and then running
vagrant autocomplete install -b
did install the new version, and removed the error.
However it does not look like autocompletion is doing anything, nor can I find the command in the documentation on the website.
I stumbled on the command with vagrant -h
Steps to reproduce
- vagrant autocomplete install -b
- update vagrant to a new version
- open a new bash terminal
If you want to solve the problem manually, just edit ~/.bashrc to modify correct path.
Running vagrant autocomplete --debug install
you can see
INFO install_shell_config: Searching for config in home /home/ashar
INFO install_shell_config: Found config file /home/ashar/.bashrc
INFO install_shell_config: Found completion already installed in /home/ashar/.bashrc
INFO interface: info: Autocomplete installed at paths:
-
- /home/ashar/.bashrc
removing the lines from the ~/.bashrc
and running it again the correct version is added
The install
command should update the line to match the current version, otherwise ... it's pretty useless.
I can get better results from the following "1-liner":
vv="$(vagrant --version | awk '{print $NF }')" echo ". /opt/vagrant/embedded/gems/${vv}/gems/vagrant-${vv}/contrib/bash/completion.sh" | sudo tee /etc/bash_completion.d/vagrant
Issue persists as of March, 2024. I'm replacing the vagrant version number in .bashrc with an asterisk (*) - it will probably fix the issue permanently.