edx fullstack installation on a remote server using vagrant & virtualbox - ssh

and thank you for reading my question.
I would like to install an edX platform on a remote server, using the method explained here (with virtualbox and vagrant)
To do so, I am connecting to the remote machine through ssh (port: 22).
The remote server is running on CentOS 6.
Virtual box 4.3.2 and vagrant 1.7.2 have been installed successfully on the remote machine, and the Vagrantfile has been retrieved. You can find the vagrant file here
The problem arises when running vagrant up.
The virtual machine is fetched and added but
The guest machine entered an invalid state while waiting for it to boot. Valid states are 'starting, running'. The machine is in the 'poweroff' state. Please verify everything is configured properly and try again.
By looking around I found that it means that the CPU does not support VT-X technology. I tried a workaround changing the vagrant file to only use one cpu.
CPU_COUNT = 1
The procedure then gets further but there comes a second problem. I cannot connect through ssh to this virtual machine.
*==> default: Preparing network interfaces based on configuration...**
** default: Adapter 1: nat**
** default: Adapter 2: hostonly**
**==> default: Forwarding ports...**
** default: 22 => 2222 (adapter 1)**
**==> default: Running 'pre-boot' VM customizations...**
**==> default: Booting VM...**
**==> default: Waiting for machine to boot. This may take a few minutes...**
** default: SSH address: 127.0.0.1:2222**
** default: SSH username: vagrant**
** default: SSH auth method: private key**
** default: Warning: Connection timeout. Retrying...**
** default: Warning: Connection timeout. Retrying...**
** default: Warning: Connection timeout. Retrying...**
** default: Warning: Connection timeout. Retrying...**
** default: Warning: Connection timeout. Retrying...**
** default: Warning: Connection timeout. Retrying...*
So multiple questions:
If I cannot connect, it can mean that the machine hasn't booted up, so the problem can come from using only one CPU instead of two ?
The problem might come from the port 2222 not being open. If so, why can't I connect to the machine directly through ssh on 192.168.33.10, as defined in the vagranfile ? Does vagrant need this initial ssh connection to actually set up the ip inside of the machine ?
I thought this would be the virtual machine's ip.
**config.vm.network :private_network, ip: "192.168.33.10"**
How could I see what the problem is on the machine that I want to boot up, being in remote ? (can I have GUI for that virtual machine running on a remote server ?)
Note: When I am doing the fullstack installation on my machine and not on the remote, everything is working perfectly.

Hi I had the same issue.
Option 1
I added v.gui = true as follows:
................................
config.vm.provider :virtualbox do |v, override|
v.gui=true
end
................................
Just after "vagrant up --provider=virtualbox". I can see the gui of VirtualBox for a second, but it closes at once.
Option 2
goto BIOS configuration --
Turn on VT-x/AMD-V hardware acceleration

Related

Vagrant Timed out while waiting for the machine to boot

I am new Vagrant. My current environment is Ubuntu -> running on Virtual Box -> on a Mac book.
I have successfully installed the Virtualbox and Vagrant packages on my Ubuntu install. I set my repo and started my build (vagrant up). After image is successfully copied I have step in my vagrantfile to connect via SSH to the VM.. It just hangs and ultimately times out.
See error below
==> default: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/trusty64'
default: URL: https://vagrantcloud.com/ubuntu/trusty64
==> default: Adding box 'ubuntu/trusty64' (v20190514.0.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20190514.0.0/providers/virtualbox.box
==> default: Successfully added box 'ubuntu/trusty64' (v20190514.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: postgres_default_1588691813886_34109
==> default: Clearing any previously set forwarded ports...
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:
https://www.virtualbox.org/manual/ch04.html#sharedfolders
This option can be disabled globally with an environment variable:
VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
or on a per folder basis within the Vagrantfile:
config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
#<Thread:0x00005618d3a47468#/usr/share/rubygems-integration/all/gems/vagrant-2.0.2/lib/vagrant/batch_action.rb:71 run> terminated with exception (report_on_exception is true):
....
....
....
Timed out while waiting for the machine to boot. This means that (Vagrant::Errors::VMBootTimeout)
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
Vagrantfile
# -*- mode: ruby -*-
# # vi: set ft=ruby :
IMAGE_NAME = "bento/ubuntu-18.04"
N = 1
Vagrant.configure("2") do |config|
config.vm.box = IMAGE_NAME
config.vm.provision "shell", path: "provision/vagrant_provision.sh", privileged: true
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 1
end
# Nodes
(1..N).each do |number|
config.vm.define "node-#{number}" do |node|
node.vm.network "private_network", ip: "192.168.50.21#{number}"
node.vm.hostname = "node-#{number}"
node.vm.synced_folder "scripts/", "/scripts"
end
end
end
Issue was related to using Vagrant/VirtualBox under an Ubuntu VM that was already running VirtualBox on a Mac. When I installed Vagrant/VirtualBox on the Mac natively I had no issues.

Custom Vagrant SSH in Windows

I am trying to setup a new linux project using vagrant. I want to be able to ssh into the vagrant box with putty because it has copy paste capabilities. This is what I have done so far:
Navigated to the projects destination
In the command prompt typed
vagrant init
I changed the following in the Vagrantfile:
config.vm.box = "base"
to
config.vm.box = "ubuntu/xenial64"
I then added the following lines into the Vagrantfile:
config.vm.network "private_network", ip: "192.168.10.12"
config.ssh.username = "test"
config.ssh.password = "password"
I saved the Vagrantfile
Then in the command prompt I typed
vagrant up
This what comes up in the command prompt:
==> default: Importing base box 'ubuntu/xenial64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: A newer version of the box 'ubuntu/xenial64' is available! You currently
==> default: have version '20170822.0.0'. The latest is version '20170919.0.0'. Run
==> default: `vagrant box update` to update.
==> default: Setting the name of the VM: geoserver_default_1505948268591_35426
==> default: Fixed port collision for 22 => 2222. Now on port 2201.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2201 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2201
default: SSH username: test
default: SSH auth method: password
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Authentication failure. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test#127.0.0.1's password:password
test#127.0.0.1's password:password
default: Warning: Authentication failure. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test#127.0.0.1's password:
test#127.0.0.1's password:
default: Warning: Authentication failure. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test#127.0.0.1's password:vagrant
test#127.0.0.1's password:vagrant
... I want a few minutes
default: Warning: Authentication failure. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test#127.0.0.1's password: default: Warning: Connection timeout. Retrying...
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
test#127.0.0.1's password:Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
I try and connect to the machine through putty with the following setting and I get a Network error: Connection timed out:
Host Name: 192.168.10.12
Port 2201
Connection Type: SSH
I try and connect to the machine through putty with the following setting and I get connect to the machine but I am prompted for a username and password:
Host Name: 127.0.0.1
Port 2201
Connection Type: SSH
The username/password combination I try is:
login as: test
password: password
I get an Access denied
login as: ubuntu
password: vagrant
I get an Access denied
How do I setup vagrant so that I can ssh in with putty?
Thank you for any and all help!
There's no test user in the VM so you cannot login with this user, you would first have to create a test user account with the password and then you will be able to connect.
The ubuntu password for this box is 95bf98670a543bcd7bdd576c. You will find this information in the box's Vagrantfile, on Mac its located under ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170116.1.0/virtualbox/Vagrantfile
You can just remove username/password information from your Vagrantfile and you will login automatically when running vagrant ssh

Unable to use vagrant ssh on a custom box

I have successfully created a custom Vagrant box, based on the official ubuntu/xenial64 Vagrant box, but I get this message when I attempt to use vagrant ssh:
==> default: The machine you're attempting to SSH into is configured to use
==> default: password-based authentication. Vagrant can't script entering the
==> default: password for you. If you're prompted for a password, please enter
==> default: the same password you have configured in the Vagrantfile.
The only change to the box is to provision it with NginX. I then use...
vagrant package --vagrantfile <path_to_vagrantfile> --output nginx.box
... where <path_to_vagrantfile> is, in my case, /home/blackslate/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170822.0.0/virtualbox/Vagrantfile. I follow this with:
vagrant box add nginx nginx.box
I then create a new directory and use vagrant init nginx to create a new instance of the box. The whole process is described in this question.
When I use vagrant up, all appears to be running as expected:
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'nginx'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: Custom_default_1503826905856_10643
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: ubuntu
default: SSH auth method: password
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /home/blackslate/repos/Vagrant/Custom
However, vagrant ssh provokes the message at the beginning of this question. When I try to ssh in manually, using "ubuntu" as the ssh user and "vagrant" as the password, I get this:
ssh ubuntu#127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:PSnauymZfKi1HIRIKfez5wAnpPFJW9h3eC+TzxiiIWA.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.
ubuntu#127.0.0.1's password:
Permission denied, please try again.
ubuntu#127.0.0.1's password:
I get a similar result if I try ssh vagrant#127.0.0.1:
ssh vagrant#127.0.0.1
vagrant#127.0.0.1's password:
Permission denied, please try again.
vagrant#127.0.0.1's password:
The same is true if I open the VirtualBox GUI and talk to the VM directly.
I have tried following the instructions here, but I'm guessing that this refers to an older version of Vagrant.
I am hoping that I will be able to make changes at the package stage, so that when I distribute the custom Vagrant box to other developers, vagrant ssh just works, with no need to massage any files beforehand.
Try using the Oracle Virtual Box Manager to log in directly console instead of with ssh. Thereupon may edit the sshd config file and allow the passoword authentication. Restart SSHD service.

Cannot ssh into newly created vagrant box

Just created a new vagrant box with minimal centos 7.
I followed this guide. https://blog.engineyard.com/2014/building-a-vagrant-box
Also I have everything in place as mentioned in official vagrant guides here and here
However when I try to do vagrant up. It timeouts when trying to ssh into the box.
What might be causing this?
My network adapter in the VM is NAT.
I tried to set private network ip
config.vm.network "private_network", ip: "192.168.50.4"
I was able to ssh using this ip and vagrant as username and password. I wonder why vagrant is not able to ssh?
Here is the output of vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'my'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: my_box_default_1475351710988_24744
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
And after a long time it gives this error.
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
ssh keys set using the following commands
mkdir -p /home/vagrant/.ssh
chmod 0700 /home/vagrant/.ssh
wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh
There was a bug in 1.8.5 that can explain this.
can you please upgrade to 1.8.6 ?
Have you tried using
vagrant ssh
This might help someone.
Try running ip addr command and if the network interface has no IP address assigned to it then you need to set ONBOOT to yes.
[root#localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
Then change ONBOOT=no to ONBOOT=yes
Restart the machine and run ip addr to make sure that network is started properly and an IP address is assigned to the network interface.

Set a box with vagrant (virtualBox)

Based on the official doc, I've tried to install Vagrant with the " hashicorp/precise32" box. I've added the box with :
vagrant box add hashicorp/precise32
and change the configuration file :
config.vm.box = "hashicorp/precise32"
When trying to start the virtual environement, I get :
C:\Users\xxxx\Documents\vagrant_getting_started>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'hashicorp/precise32' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.
If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.
As suggested, I've opened the VirtualBox GUI and tried to manually start it:
Does someone know how to solve it ?
Thank you
Looks like there's a known similar issue with latest VirtualBox version (4.3.14):
https://forums.virtualbox.org/viewtopic.php?f=6&t=62615
I bet that you're running that version, if so downgrading to 4.3.12 should solve your problem.