Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant box: can't login with password from VirtualBox GUI

I am learning to use Vagrant, and I tried to boot a Vagrant machine (an ubuntu/trusty64 built in the recommended way "vagrant init ubuntu/trusty64; vagrant up") from inside the VirtualBox GUI (double clicking the icon of the Vagrant machine). But I cannot login: no username, no password.

Do I need to add a specific provision, or there is another easier way to do this?

Thank you.

like image 426
MastroGeppetto Avatar asked Oct 23 '14 09:10

MastroGeppetto


People also ask

Does vagrant support GUI?

gui to true. The next time you start the VM with vagrant up, it will open a VirtualBox 3 Page 4 CS168 Using the Vagrant VM Fall 2019 window and start the VM in GUI mode. Note that the VM may take a few minutes to boot the first time you start in this mode.

What is the root password for vagrant?

Root Password: "vagrant"


1 Answers

UPDATE after clarification of question

You should be able to login as

user: vagrant password: vagrant  

This is a convention described in the base box creation documentation:

Also, even though Vagrant uses key-based authentication by default, it is a general convention to set the password for the "vagrant" user to "vagrant". This lets people login as that user manually if they need to.

If you have a box where the password for the vagrant user is not set (or you just don't know it) you can do the following:

me@somebox$ vagrant ssh vagrant@vagrant-ubuntu-trusty-64:~$ sudo passwd vagrant  Enter new UNIX password: <type invisible new password here> Retype new UNIX password: <re-type invisible new password here> passwd: password updated successfully 

Now you can login e.g. through the VirtualBox GUI.

Original answer (basically explaining that you should not have to do the above)

The basic idea is, that you do not have to use the Virtual machine providers tools for anything to work with vagrant. So as soon as you think you have to use the VirtualBox GUI you are doing something wrong.

Just try in terminal (or in cmd.exe if you are on windows):

me@somebox$ vagrant init ubuntu/trusty64 me@somebox$ vagrant up me@somebox$ vagrant ssh vagrant@vagrant-ubuntu-trusty-64:~$ 

If everything works you should be on the command line inside your new machine logged in as the user vagrant.

like image 183
Oliver Bestwalter Avatar answered Sep 16 '22 17:09

Oliver Bestwalter