vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

`vagrant autocomplete` fails after update

Open eniel opened this issue 4 years ago • 3 comments

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

  1. vagrant autocomplete install -b
  2. update vagrant to a new version
  3. open a new bash terminal

eniel avatar Dec 03 '20 14:12 eniel

If you want to solve the problem manually, just edit ~/.bashrc to modify correct path. image image

logerrors avatar May 19 '21 09:05 logerrors

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

AsharLohmar avatar Jul 31 '21 10:07 AsharLohmar

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.

Ignacy-s avatar Mar 13 '24 17:03 Ignacy-s