Reputation: 1830
I was trying to start up my vagrant machine, so I navigated to the folder where my vagrantfile is, and used:
vagrant up && vagrant ssh
but I got the following error message:
The VirtualBox VM was created with a user that doesn't match the current user running Vagrant. VirtualBox requires that the same user be used to manage the VM that was created. Please re-run Vagrant with that user. This is not a Vagrant issue.
The UID used to create the VM was: 0 Your UID is: 501
I also tried with sudo, but that didn't work either.
Do I need to switch UID's? And how would I do this?
Upvotes: 136
Views: 73951
Reputation: 1668
I faced the same problem. I deleted in .vagrant directory inside the directory where Vagrantfile was present. Then it worked.
Upvotes: 1
Reputation: 1
I encountered the same issue but it's because I cloned an exercise file from a GitHub repo. I found the issue being the .vagrant file included in the repository.
What worked for me is deleting the .vagrant directory and rerun vagrant up
Upvotes: 0
Reputation: 7515
I have Multi-Machine vagrant file. I have checked the creator_uid
and it is 0
but still unable to load. So I have deleted creator_uid
file for all the Multi-Machine and it worked. Path should be .vagrant\machines\<machine_name>\virtualbox
Upvotes: 0
Reputation: 21
I had the same problem I had forgotten to place sudo
before vagrant up
, you just have to execute sudo vagrant up
in the folder of your vagrant file.
Upvotes: 0
Reputation: 171
I've faced the same situation, but I have a multi-machine Vagrantfile.
To replace the old uid (1001) by the new one (1000) I've used the following command:
for i in $(find . -type f -iname "creator_uid" ) ; do echo 1000 > $i ; done
Upvotes: 0
Reputation: 31
Remove the content of .vagrant hidden dir in the current working dir and re-run vagrant up command. Error, because of copy / backup of Vagranfile /s from one system to another system. user id's mismath to the Vagrant to bring up the environment.. hope it helps cheers..!! :)) if u don't wish to delete that folder u can update uid of current user in file in the hidden dir of current working dir, i.e .vagrant/machines/jenkins/virtualbox$ vim creator_uid
Upvotes: 0
Reputation: 1152
Just to add on to Fred's https://stackoverflow.com/a/32256848/2065804 answer.
Make sure you changed the correct VM's machine. For example, my VM name is NOT default but rather called homestead-7.
So the path to the correct one is:
.vagrant/machines/homestead-7/virtualbox/creator_uid
and not:
.vagrant/machines/default/virtualbox/creator_uid
This error happened to me when I changed my Mac to another Mac.
Upvotes: 0
Reputation: 41
just change user ID here .vagrant/machines/default/virtualbox/creator_uid
Upvotes: 4
Reputation: 21
It's possible you ran the command: sudo vagrant up
This would mean as your regular user you are unable to see or even delete the /.vagrant
folder and files.
If so, simply run: sudo vagrant destroy -f
Then you should be able to run (as your normal user account): vagrant up
Upvotes: 2
Reputation: 2706
I ran into the same problem today.
I edited my UID by opening the file .vagrant/machines/default/virtualbox/creator_uid
and changing the 501 to a 0.
After I saved the file, the command vagrant up worked like a champ.
NB: the .vagrant
folder is in the same directory as your Vagrantfile, where you ran vagrant up
Upvotes: 269
Reputation: 1
I had the same problem after I got a new computer. Instead of of copying all files from my old computer, I had to check out the vagrant projects again from the git repository. After that, vagrant up
worked fine.
Upvotes: 0
Reputation: 2307
I ran into the same issue, but in my case it was because I had ran vagrant up
under sudo
, and when I came back to it later I'd forgotten.
Silly mistake, but I'm sure it's not the first time it's happened someone :)
Upvotes: 8
Reputation: 81
I tried changing the id in .vagrant\machines\default\virtualbox\creator_uid and that did not work for me but deleting the file, creator_uid did the trick.
Upvotes: 8
Reputation: 7985
Ran into this problem in a slightly different situation. The issue was that ".vagrant" was checked into the git repo, and the committer was running under a different UID than I was.
Solution: add .vagrant to .gitignore.
Upvotes: 37
Reputation: 415
According to the VirtualBox User Manual:
As a security measure, the Linux implementation of internal networking only allows VMs running under the same user ID to establish an internal network.
In other words, you have to switch to root (UID 0
) to run it.
Upvotes: 1