Search code examples
python-3.xvagrantubuntu-18.04

Command 'vagrant' not found


I am re-installing vagrant on my local machine unsuccessfully. Initially, I had vagrant downloaded, installed and running well, but decided to uninstall it. My uninstall was as follows:

$ rm -rf /opt/vagrant
$ rm -f /usr/bin/vagrant

Checking for vagrant by running $ which vagrant, I could not find it meaning it was successfully uninstalled.

To re-install it, I implement the steps below but I keep getting the message Command 'vagrant' not found, but can be installed with: sudo apt install vagrant:

Installing a virtualbox

I install virtualbox before installing vagrant:

$ sudo apt install virtualbox
$ which virtualbox

Installing Vagrant: Option 1

$ sudo apt install vagrant

This is the result I get:

Reading package lists... Done Building dependency tree
Reading state information... Done vagrant is already the newest version (1:2.2.10).

The following packages were automatically installed and are no longer required:

augeas-lenses bsdtar cpu-checker cryptsetup cryptsetup-bin db-util db5.3-util dmeventd extlinux fonts-lato hfsplus ibverbs-providers icoutils ipxe-qemu ipxe-qemu-256k-compat-efi-roms ldmtool libafflib0v5 libarchive-tools libaugeas0 libbfio1 libcacard0 libconfig9 libdate-manip-perl libdevmapper-event1.02.1 libewf2 libfdt1 libguestfs-hfsplus libguestfs-perl libguestfs-reiserfs libguestfs-tools libguestfs-xfs libguestfs0 libhfsp0 libhivex0 libibverbs1 libintl-perl libintl-xs-perl libiscsi7 libldm-1.0-0 liblvm2app2.2 liblvm2cmd2.02 libnl-route-3-200 librados2 librbd1 librdmacm1 libruby2.5 libsodium-dev libspice-server1 libstring-shellquote-perl libsys-virt-perl libsystemd0:i386 libtsk13 libudev1:i386 libusbredirparser1 libvirt0 libwin-hivex-perl libxen-4.9 libxenstore3.0 lsscsi lvm2 msr-tools nfs-kernel-server osinfo-db pkg-config qemu-block-extra qemu-system-common qemu-system-x86 qemu-utils rake ruby ruby-bcrypt-pbkdf ruby-blankslate ruby-builder ruby-childprocess ruby-did-you-mean ruby-domain-name ruby-erubis ruby-excon ruby-ffi ruby-fog-core ruby-fog-json ruby-fog-libvirt ruby-fog-xml ruby-formatador ruby-http-cookie ruby-i18n ruby-json ruby-libvirt ruby-listen ruby-log4r ruby-mime-types ruby-mime-types-data ruby-minitest ruby-multi-json ruby-net-scp ruby-net-sftp ruby-net-ssh ruby-net-telnet ruby-netrc ruby-nokogiri ruby-oj ruby-pkg-config ruby-power-assert ruby-rb-inotify ruby-rbnacl ruby-rest-client ruby-sqlite3 ruby-test-unit ruby-unf ruby-unf-ext ruby2.5 rubygems-integration scrub seabios sgabios sleuthkit supermin vagrant-libvirt zerofree

Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 105 not upgraded.

To check whether vagrant has been installed, I run:

$ vagrant --version

And the result is:

Command 'vagrant' not found, but can be installed with:
sudo apt install vagrant

Installing Vagrant: Option 2:

I first checked for the latest version of vagrant on the vagrants downloads page, then downloaded and installed it by running these commands:

$ sudo apt update
$ curl -O https://releases.hashicorp.com/vagrant/2.2.10/vagrant_2.2.10_x86_64.deb
$ sudo apt install ./vagrant_2.2.10_x86_64.deb

The result I get is the same as that of option 1 above. I have checked online for similar problems and their possible solutions like this example and most suggestions point to the PATH. However, nothing is forthcoming.

I have reviewed the documentation among other articles on how to properly install vagrant such as this but the Command 'vagrant' not found still persists. What could be the issue? At this point, moving forward with using vagrant is completely stalled.

I can tell that vagrant is not installed when I run:

$ which vagrant

Solution

  • As you just removed the files instead of using apt-get or dpkg to uninstall the package, the package management is not aware of your manual removal, and so apt-get and dpkg still think the newest version is already installed, and so do nothing.

    apt-get --reinstall install vagrant

    should solve this.