I tried
to spin up a CentOS 7 VM. Below is my settings
Vagrant File
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "zabbix1" do |zabbix1|
zabbix1.vm.box = "centos/7"
zabbix1.vm.hostname = "zabbix1"
zabbix1.ssh.insert_key = false
zabbix1.vm.network :private_network, ip: "10.11.12.55"
zabbix1.ssh.private_key_path = "~/.ssh/id_rsa"
zabbix1.ssh.forward_agent = true
end
end
Result
vagrant reload
==> zabbix1: Attempting graceful shutdown of VM...
zabbix1: Guest communication could not be established! This is usually because
zabbix1: SSH is not running, the authentication information was changed,
zabbix1: or some other networking issue. Vagrant will force halt, if
zabbix1: capable.
==> zabbix1: Forcing shutdown of VM...
==> zabbix1: Checking if box 'centos/7' is up to date...
==> zabbix1: Clearing any previously set forwarded ports...
==> zabbix1: Fixed port collision for 22 => 2222. Now on port 2204.
==> zabbix1: Clearing any previously set network interfaces...
==> zabbix1: Preparing network interfaces based on configuration...
zabbix1: Adapter 1: nat
zabbix1: Adapter 2: hostonly
==> zabbix1: Forwarding ports...
zabbix1: 22 (guest) => 2204 (host) (adapter 1)
==> zabbix1: Booting VM...
==> zabbix1: Waiting for machine to boot. This may take a few minutes...
zabbix1: SSH address: 127.0.0.1:2204
zabbix1: SSH username: vagrant
zabbix1: SSH auth method: private key
zabbix1: Warning: Remote connection disconnect. Retrying...
zabbix1: Warning: Remote connection disconnect. Retrying...
zabbix1: Warning: Remote connection disconnect. Retrying...
zabbix1: Warning: Authentication failure. Retrying...
zabbix1: Warning: Authentication failure. Retrying...
zabbix1: Warning: Authentication failure. Retrying...
zabbix1: Warning: Authentication failure. Retrying...
zabbix1: Warning: Authentication failure. Retrying...
zabbix1: Warning: Authentication failure. Retrying...
vagrant ssh-config
Host zabbix1
HostName 127.0.0.1
User vagrant
Port 2204
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/bheng/.ssh/id_rsa
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
What did I do wrong ? What did I miss ?
I had the same issue with the same box and the way I fixed it was to log into the VM from VirtualBox (vagrant/vagrant as username/password) and change the permission of .ssh/authorized_keys
chmod 0600 .ssh/authorized_keys
Do that after you run vagrant up (while the error repeats) and the VM is up and you will see vagrant up will complete successfully and you will be able to ssh into the VM from vagrant ssh
Private networks can be configured manually or with the VirtualBox built-in DHCP server. This works for me.
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "zabbix1" do |zabbix1|
zabbix1.vm.box = "centos/7"
zabbix1.vm.hostname = "zabbix1"
zabbix1.ssh.insert_key = false
zabbix1.vm.network :private_network, type: "dhcp"
end
end
Next you have to use vagrant destory and vagrant up.
Related
I installed remote-ssh plugin in my VSCode in an Ubuntu machine and I got a problem connecting to the remote server. The password prompt didn't appear and I couldn't enter my ssh passphrase and I suspect that's why the connection failed. Any advice? Thanks
[21:29:18.094] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-43be30dd59b7e1cc43e3ac15496de2994552e19d.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","34635","-o","ConnectTimeout=15","pipeline-azure-2.nplan.io"],"dataFilePath":"/home/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-pipeline-azure-2.nplan.io-c3f126316369cd610563c75b1b1725e0679adfb3-0.65.7/data.json"}
[21:29:18.094] Local server env: {"DISPLAY":":0","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/snap/code/70/usr/share/code/code","VSCODE_SSH_ASKPASS_MAIN":"/home/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-4ae6bcfc1164348347c6920b3ec572ba3eba795f.sock"}
[21:29:18.105] Spawned 239369
[21:29:18.301] > local-server-1> Spawned ssh, pid=239378
[21:29:18.305] stderr> OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f 31 Mar 2020
[21:29:23.099] stderr> debug1: Server host key: ssh-rsa SHA256:BJdFW33L3iusC5rckbrC9WmH7+dx5W1mC6VkyAsCFbs
[21:29:33.762] stderr> No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
[21:29:33.762] stderr>
[21:29:33.762] stderr>
[21:29:35.107] Terminating local server
[21:29:35.111] Resolver error: Error: Connecting with SSH timed out
at Function.Timeout (/home/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:64785)
at Timeout._onTimeout (/home/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:264709)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
[21:29:35.124] ------
I just deleted the .vscode-server folder on the server and voila!
Credits to: https://github.com/microsoft/vscode-remote-release/issues/3856#issuecomment-710733921
[12:03:55.917] Log Level: 2
[12:03:55.919] remote-ssh#0.61.0
[12:03:55.919] darwin x64
[12:03:55.921] SSH Resolver called for "ssh-remote+192.168.0.108", attempt 1
[12:03:55.921] "remote.SSH.useLocalServer": true
[12:03:55.921] "remote.SSH.sshPath": ssh
[12:03:55.921] "remote.SSH.sshConfigurationFile": /Users/apple/.ssh/config
[12:03:55.922] "remote.SSH.useFlock": true
[12:03:55.922] "remote.SSH.lockfilesInTmp": true
[12:03:55.922] "remote.SSH.localServerDownload": auto
[12:03:55.922] "remote.SSH.remoteServerListenOnSocket": false
[12:03:55.922] "remote.SSH.showLoginTerminal": true
[12:03:55.922] "remote.SSH.maxReconnectionAttempts": 9007199254740991
[12:03:55.923] SSH Resolver called for host: 192.168.0.108
[12:03:55.923] Setting up SSH remote "192.168.0.108"
[12:03:55.926] Acquiring local install lock:
/var/folders/8g/jfn_yxnn63j718q8_f2fkrw00000gn/T/vscode-remote-ssh-192.168.0.108-
install.lock
[12:03:55.948] Looking for existing server data file at /Users/apple/Library/Application
Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-192.168.0.108-
940b5f4bb5fa47866a54529ed759d95d09ee80be-0.61.0/data.json
[12:03:55.952] Using commit id "940b5f4bb5fa47866a54529ed759d95d09ee80be" and quality
"stable" for server
[12:03:55.971] Install and start server if needed
[12:03:55.982] Checking ssh with "ssh -V"
[12:03:56.032] > OpenSSH_7.9p1, LibreSSL 2.7.3
[12:03:56.035] Using SSH config file "/Users/apple/.ssh/config"
[12:03:56.036] askpass server listening on
/var/folders/8g/jfn_yxnn63j718q8_f2fkrw00000gn/T/vscode-ssh-askpass-
a053265c1873c60f803ede861fc6322c4ed520cd.sock
[12:03:56.037] Spawning local server with
{"ipcHandlePath":"/var/folders/8g/jfn_yxnn63j718q8_f2fkrw00000gn/T/vscode-ssh-askpass-
220be0bb451b619d8ebcba60f7b13b9801f559f3.sock","sshCommand":"ssh","sshArgs":["-v","-T","-
D","50504","-o","ConnectTimeout=15","-
F","/Users/apple/.ssh/config","192.168.0.108"],"dataFilePath":"/Users/apple/Library/Application
Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-192.168.0.108-
940b5f4bb5fa47866a54529ed759d95d09ee80be-0.61.0/data.json"}
[12:03:56.037] Local server env:
{"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/apple/.vscode/extensions/ms-
vscode-remote.remote-ssh-0.61.0/out/local-
server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Users/apple/Desktop/Visual Studio
Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper.
(Renderer)","VSCODE_SSH_ASKPASS_MAIN":"/Users/apple/.vscode/extensions/ms-vscode-
remote.remote-ssh-0.61.0/out/askpass-
ssh-askpass-a053265c1873c60f803ede861fc6322c4ed520cd.sock"}
[12:03:56.041] Spawned 3077
[12:03:56.217] > local-server> Spawned ssh: 3078
[12:03:56.241] stderr> OpenSSH_7.9p1, LibreSSL 2.7.3
[12:03:56.266] stderr> Connection reset by 192.168.0.108 port 22
[12:03:56.268] > local-server> ssh child died, shutting down
[12:03:56.275] Local server exit: 0
[12:03:56.275] Received install output: OpenSSH_7.9p1, LibreSSL 2.7.3
Connection reset by 192.168.0.108 port 22
[12:03:56.276] Stopped parsing output early. Remaining text: OpenSSH_7.9p1, LibreSSL
2.7.3Connection reset by 192.168.0.108 port 22
[12:03:56.276] Failed to parse remote port from server output
[12:03:56.283] Resolver error: Error:
at Function.Create (/Users/apple/.vscode/extensions/ms-vscode-remote.remote-ssh-
0.61.0/out/extension.js:1:82322)
at Object.t.handleInstallOutput (/Users/apple/.vscode/extensions/ms-vscode-
remote.remote-ssh-0.61.0/out/extension.js:1:78935)
at Object.t.tryInstallWithLocalServer (/Users/apple/.vscode/extensions/ms-vscode-
remote.remote-ssh-0.61.0/out/extension.js:127:102434)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async /Users/apple/.vscode/extensions/ms-vscode-remote.remote-ssh-
0.61.0/out/extension.js:127:104499
at async Object.t.withShowDetailsEvent (/Users/apple/.vscode/extensions/ms-vscode-
remote.remote-ssh-0.61.0/out/extension.js:127:110308)
at async /Users/apple/.vscode/extensions/ms-vscode-remote.remote-ssh-
0.61.0/out/extension.js:127:100987
at async S (/Users/apple/.vscode/extensions/ms-vscode-remote.remote-ssh-
0.61.0/out/extension.js:127:97777)
at async Object.t.resolveWithLocalServer (/Users/apple/.vscode/extensions/ms-vscode-
remote.remote-ssh-`0.61.0`/out/extension.js:127:100636)
at async Object.t.resolve (/Users/apple/.vscode/extensions/ms-vscode-remote.remote-ssh-
0.61.0/out/extension.js:127:108250)
at async /Users/apple/.vscode/extensions/ms-vscode-remote.remote-ssh-
0.61.0/out/extension.js:127:129627
[12:03:56.289] ------
A little background...my certificate is a LetsEncrypt.org SSL certificate issued with Certbot. I'm running Nginx 1.12.2, and I'm able to properly access my website using https:// so I believe that portion is configured properly. My web server is running Ubuntu 16.04 and MongoDB 3.6.3.
I have tried many configurations and while I can connect to my MongoDB just fine using Compass (the official MongoDB GUI) without the SSL option, attempts to connect with SSL result in a Could not connect to MongoDB on the provided host and port error message. Running mongo -ssl --sslPEMKeyFile /etc/ssl/mongo.pem on my server results in the following error:
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
2018-06-12T16:51:10.756+0000 E NETWORK [thread1] SSL peer certificate validation failed: unable to get local issuer certificate
2018-06-12T16:51:10.757+0000 E QUERY [thread1] Error: socket exception [CONNECT_ERROR] for SSL peer certificate validation failed: unable to get local issuer certificate :
connect#src/mongo/shell/mongo.js:251:13
#(connect):1:6
exception: connect failed
My /var/log/mongodb/mongod.log shows the following which corresponds to the error above:
2018-06-12T16:51:10.755+0000 I NETWORK [listener] connection accepted from 127.0.0.1:47792 #8 (2 connections now open)
2018-06-12T16:51:10.757+0000 I NETWORK [conn8] end connection 127.0.0.1:47792 (1 connection now open)
My /etc/mongod.conf contains the following (I've commented out the CAFile parameter as I've read this is optional for now [source: https://stackoverflow.com/a/33926129/2969615 ]; note that I get mongo.pem: OK when running the openssl verify -CAfile /etc/ca.pem /etc/mongo.pem command, so I believe mongo.pem is properly set up):
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
ssl:
mode: allowSSL
PEMKeyFile: /etc/ssl/mongo.pem
# CAFile: /etc/ssl/ca.pem
I've created my mongo.pem file by referring to the following: https://serverfault.com/a/878457 ...I have tried the certificate in the instructions as well as both X3 intermediate certificates available at https://letsencrypt.org/certificates/ to no avail.
Any help would be greatly appreciated.
Very late to the party, but just in case it does help someone. I am running mongodb inside docker with the official image from mongo and compass from another docker image.
For the server I use:
docker run -it --name data.domain.com --network docker_network -v /path/to/ssl:/ssl:ro -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=pass mongo --tlsMode requireTLS --tlsCertificateKeyFile /ssl/fullchain-key.pem --tlsCAFile /etc/ssl/certs/ISRG_Root_X1.pem
fullchain-key.pem is 'cat fullchain.pem privkey.pem > fullchain-key.pem'
docker name or server name must match certificate name
For Compass I use:
The server has it's own certificate and compass as well.
folders are not getting synced
q1: where should i clone my project ? in host or guestmachine so that sync works.
q2: vagrant up doesnt show shared folder mouted.
vagrantfile:
config.vm.synced_folder "ionic-projects/", "/home/vagrant/ionic-projects"
vagrant up
==> default: Attempting graceful shutdown of VM...
default: Guest communication could not be established! This is usually because
default: SSH is not running, the authentication information was changed,
default: or some other networking issue. Vagrant will force halt, if
default: capable.
==> default: Forcing shutdown of VM...
==> default: Checking if box 'drifty/ionic-android' 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: 8100 (guest) => 8100 (host) (adapter 1)
default: 35729 (guest) => 35729 (host) (adapter 1)
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: vagrant
EDIT: had a private key issue now the shared folders are mouted .
but still sync fails
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Mounting shared folders...
default: /vagrant => /home/nithin/Documents/Kappian/app
==> default: Machine already provisioned. Run vagrant provision or use the --provision
==> default: flag to force provisioning. Provisioners marked to run always will still run.
The main issue was with private key
1.setting these in vagrant file will resolve auto mount issue of shared folders.
username:vagrant
password:vagrant
auth method will be changed to password.
2.see that proper permission is given for the shared folder.
I am doing this as part of the Ambari setup. followed the steps for quick start with Ambari and Vagrant.
I am using this CentOS 6.4 image:
https://github.com/u39kun/ambari-vagrant/blob/master/centos6.4/Vagrantfile
I did this on Google Cloud from RHEL 7.2 host and with VirtualBox 5, but went to install, as suggested, CentOS 6.4 guests.
I successfully installed and configured the pre-requisities (with tweaking required to make vbox 5 work on RHEL 7.2).
When I try to bring up 6 hosts, I see the timeouts where machines are not coming up.
Host machine I am running on is fast - 32 cores, 64 GB RAM, 500 GB SSD ...
Does anyone know what might be the issue?
Is there some firewall I need to turn off, etc.?
[<myuser>#ambari-host-rhel7 centos6.4]$ ./up.sh 6
Bringing machine 'c6401' up with 'virtualbox' provider...
==> c6401: Box 'centos6.4' could not be found. Attempting to find and install... c6401: Box Provider: virtualbox c6401: Box Version: >= 0
==> c6401: Box file was not detected as metadata. Adding it directly...
==> c6401: Adding box 'centos6.4' (v0) for provider: virtualbox c6401: Downloading: http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box
==> c6401: Box download is resuming from prior download progress
==> c6401: Successfully added box 'centos6.4' (v0) for 'virtualbox'!
==> c6401: Importing base box 'centos6.4'...
==> c6401: Matching MAC address for NAT networking...
==> c6401: Setting the name of the VM: centos64_c6401_1456171923223_2329
==> c6401: Clearing any previously set network interfaces...
==> c6401: Preparing network interfaces based on configuration... c6401: Adapter 1: nat c6401: Adapter 2: hostonly
==> c6401: Forwarding ports... c6401: 22 (guest) => 2222 (host) (adapter 1)
==> c6401: Running 'pre-boot' VM customizations...
==> c6401: Booting VM...
==> c6401: Waiting for machine to boot. This may take a few minutes... c6401: SSH address: 127.0.0.1:2222 c6401: SSH username: vagrant c6401: SSH auth method: private key
Timed out while waiting for the machine to boot. This means thatVagrant was unable to communicate with the guest machine withinthe configured ("config.vm.boot_timeout" value) time period.If you look above, you should be able to see the error(s) thatVagrant had when attempting to connect to the machine. These errorsare usually good hints as to what may be wrong.If you're using a custom box, make sure that networking is properlyworking and you're able to connect to the machine. It is a commonproblem 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 increasethe timeout ("config.vm.boot_timeout") value.
As a final step I get this summary error:
There was an error while executing `VBoxManage`, a CLI used by Vagrantfor controlling VirtualBox.
The command and stderr is shown below.
Command: ["import", "/home/<me>/.vagrant.d/boxes/centos6.4/0/virtualbox/box.ovf", "--vsys", "0", "--vmname", "CentOS-6.4-x86_64_1456173504674_45962", "--vsys", "0", "--unit", "9", "--disk", "/home/<me>/VirtualBox VMs/CentOS-6.4-x86_64_1456173504674_45962/box-disk1.vmdk"]
Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting /home/<me>/.vagrant.d/boxes/centos6.4/0/virtualbox/box.ovf...OK.0%...
Progress state: VBOX_E_FILE_ERRORVBoxManage: error: Appliance import failedVBoxManage: error: Could not create the imported medium '/home/<me>/VirtualBox VMs/CentOS-6.4-x86_64_1456173504674_45962/box-disk1.vmdk'.
VBoxManage: error: VMDK: cannot write allocated data block in '/home/<me>/VirtualBox VMs/CentOS-6.4-x86_64_1456173504674_45962/box-disk1.vmdk' (VERR_DISK_FULL)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component ApplianceWrap, interface IAppliance
VBoxManage: error: Context: "RTEXITCODE handleImportAppliance(HandlerArg*)" at line 877 of file VBoxManageAppliance.cpp
Any ideas what might be going on?
Do you still have free space on your drive ?
Generally VERR_DISK_FULL indicates that the hard drive is full, it cannot provision enough space for the vdi files.