Vagrant corrupted index file C:\Users\USERNAME\.vagrant.d/data/machine-index/index

Virtual MachineVagrantWindows 8.1

Virtual Machine Problem Overview


My Windows 8.1 just crashed. Now I have some files on my dist that are corrupted. This includes my vagrant machine index (Not shure if the naming is right but I know that it is this file -> C:\Users\USERNAME.vagrant.d/data/machine-index/index).

So There is a lot of binary or hexdecimal stuff in there (Again not shure because I don't deal with this stuff usualy so correct me if I'm wrong!) And Vagrant spits out the following message if I try to start everything after boot.

vagrant up returns this

The machine index which stores all required information about
running Vagrant environments has become corrupt. This is usually
caused by external tampering of the Vagrant data folder.

Vagrant cannot manage any Vagrant environments if the index is
corrupt. Please attempt to manually correct it. If you are unable
to manually correct it, then remove the data file at the path below.
This will leave all existing Vagrant environments "orphaned" and
they'll have to be destroyed manually.

Path: C:/Users/Username/.vagrant.d/data/machine-index/index

Virtual Machine Solutions


Solution 1 - Virtual Machine

Same thing happened to me. So I just deleted the index file and the .lock file from the machine-index folder to get Vagrant working again.

Solution 2 - Virtual Machine

When using Vagrant 2.2.5 in Windows 10, I had to navigate to /Users/{yourname}/.vagrant.d/data/machine-index and remove both index and index.lock, so rm index then rm index.lock.

Finally I navigated back to Homestead folder and ran vagrant up.

Solution 3 - Virtual Machine

When accidentally my laptop crashed, I had the same vagrant issue (index) on my first attempt to run vagrant up.

The machine index which stores all required information about
running Vagrant environments has become corrupt. This is usually
caused by external tampering of the Vagrant data folder.

Vagrant cannot manage any Vagrant environments if the index is
corrupt. Please attempt to manually correct it. If you are unable
to manually correct it, then remove the data file at the path below.
This will leave all existing Vagrant environments "orphaned" and
they'll have to be destroyed manually.

Path: C:/Users/{user}/.vagrant.d/data/machine-index/index

Unfortunately my issue was not solved by deleting the index and index.lock files as the most voted up answer told. I rebooted my vm using virtualbox GUI (used as VM provider) and shown up the following message.

Entering emergency mode. Exit the shell to continue.
Type "journalctl" to view system logs.
You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot
after mounting them and attach it to a bug report.

I realised that crash produced errors on VM's FS. So after searching and investigation I overcame that issue by executing the command below.

xfs_repair -v -L /dev/dm-0

Environment info: OS windows10, virtual-box 6.1, vagrant 2.2.7 and vm-os centos7

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionThomas VenturiniView Question on Stackoverflow
Solution 1 - Virtual MachineJukka PuranenView Answer on Stackoverflow
Solution 2 - Virtual MachinevictorfView Answer on Stackoverflow
Solution 3 - Virtual Machinenikos-bobView Answer on Stackoverflow