I'm trying to connect to my vagrant MySQL server using MySQL workbench. It shows some error as shown in the image.
The workbench error log is pasted below.
17:34:50 [INF][ SSH tunnel]: Existing SSH tunnel not found, opening new one
17:34:50 [INF][ SSH tunnel]: Opening SSH tunnel to 127.0.0.1:2222
17:34:50 [ERR][ sshtunnel.py]: Traceback (most recent call last):
File "/usr/share/mysql-workbench/sshtunnel.py", line 231, in _connect_ssh
look_for_keys=has_key, allow_agent=has_key)
File "/usr/lib/python2.7/dist-packages/paramiko/client.py", line 337, in connect
self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys)
File "/usr/lib/python2.7/dist-packages/paramiko/client.py", line 528, in _auth
raise saved_exception
AuthenticationException: Authentication failed.
17:34:50 [ERR][ SSH tunnel]: Authentication error opening SSH tunnel: Authentication error. Please check that your username and password are correct and try again.
vagrant up command output is pasted below
==> 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 => 6216 (adapter 1)
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: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
The command vagrant ssh works fine in terminal. What am I doing wrong here?
If you run vagrant ssh-config it will show which key it is using. It does not normally use the .vagrant.d/insecure_private_key but a key in the project directory like .vagrant/machines/default/virtualbox/private_key.
If you specify that key in the MySQL connection panel you should be able to logon without having to add another key to the vm.
Regarding error you mention in comments:
When using ssh you don't specify port like this
ssh 127.0.0.1:2222
You must use option -p
ssh 127.0.0.1 -p 2222
After some googling, I got it working by adding my ssh public key to vagrant authorized_keys file. Steps Below.
generate ssh keys for your machine
copy your public key from /home/{username}/.ssh/id_rsa.pub file
open vagrant ssh in termial
use some editor to edit /home/vagrant/.ssh/authorized_keys(eg: nano /home/vagrant/.ssh/authorized_keys)
paste your public key to the end of that file and save
done!
Related
I have been using MySql Workbench successfully last week, but this morning, it systematically fails to open a SSH tunnel.
I have checked the logs and found the following:
16:46:47 [INF][ SSH tunnel]: Existing SSH tunnel not found, opening new one
16:46:54 [INF][ SSH tunnel]: Opening SSH tunnel to 192.168.200.254
16:46:55 [ERR][sshtunnel.py:notify_exception_error:235]: Traceback (most recent call last):
File "/usr/share/mysql-workbench/sshtunnel.py", line 303, in _connect_ssh
look_for_keys=has_key, allow_agent=has_key, timeout=SSH_CONNECTION_TIMEOUT)
File "/usr/lib/python2.7/dist-packages/paramiko/client.py", line 325, in connect
t.start_client()
File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 492, in start_client
raise e
ValueError: CTR mode needs counter parameter, not IV
16:46:55 [INF][ SSH tunnel]: TunnelManager.wait_connection authentication error: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
16:46:55 [ERR][ SSH tunnel]: Authentication error opening SSH tunnel: Authentication error, unhandled exception caught in tunnel manager, please refer to logs for details
16:47:00 [INF][ SSH tunnel]: Existing SSH tunnel not found, opening new one
Yet, when I try to connect from a terminal, the SSH connection works fine. Any idea how to solve this issue?
Findings:
It seems like there might be a bug with version 6.3.9. I re-installed MySql Workbench with the following (I am on Ubuntu):
# The following will remove mysql too
sudo apt-get remove --purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get update
# Then reboot your PC
# Re-install MySql Workbench from the Ubuntu software application
I had the same problem yesterday. My solution was remove Workbench and its dependencies and install it again. I use Ubuntu 16.04 and Workbench 6.3.6.
I have been trying Windows Containers on windows server 2016 TP5. Suddenly I started getting error while running a container with port maping option -p 80:80
c:\>docker run -it -p 80:80 microsoft/iis cmd
docker: Error response from daemon: failed to create endpoint sharp_brahmagupta on network nat: HNS failed with error : Failed to create endpoint.
I made sure that no other container is running and port 80 on host machine is not being used by any other service.
Did anyone face same issue?
After searching around I stunbled upon this issue on github. This seemed to be a known issue with Windows containers on Windows server TP5.
Then thanks to this forum, I found the solution
You can check active static port mapping with below command
C:\>powershell
PS C:\>Get-NetNatStaticMapping
StaticMappingID : 3
NatName : Hda6caca4-06ec-4251-8a98-1fe0b4c5af88
Protocol : TCP
RemoteExternalIPAddressPrefix : 0.0.0.0/0
ExternalIPAddress : 0.0.0.0
ExternalPort : 80
InternalIPAddress : 172.31.181.4
InternalPort : 80
InternalRoutingDomainId : {00000000-0000-0000-0000-000000000000}
Active : True
From above output it seemed that even though container was removed the static port mapping was not removed and was still active.
But I removed it with below command.
PS C:\> Get-NetNatStaticMapping | ? ExternalPort -eq 80 | Remove-NetNatStaticMapping
Then simply rebooted the system and the error was gone.
For me these steps solved the problem:
Stop-Service docker
Get-ContainerNetwork | Remove-ContainerNetwork
Get-NetNat | Remove-NetNat
Get-VMSwitch | Remove-VMSwitch
Start-Service docker
(suggested by JMesser81 at:https://github.com/Microsoft/Virtualization-Documentation/issues/273)
I had similar error.
$ docker --version
Docker version 1.13.0-rc3, build 4d92237
$ docker-compose -f .\docker-compose.windows.yml up
Starting musicstore_db_1
ERROR: for db Cannot start service db: {"message":"failed to create endpoint musicstore_db_1 on network nat: HNS failed with error : Unspecified error"}
ERROR: Encountered errors while bringing up the project.
Static mapping removal did not work, only network removal helped:
Get-ContainerNetwork -Name nat | Remove-ContainerNetwork
Execute the command in PowerShell as administrator, then restart Docker.
Update:
Use CleanupContainerHostNetworking.ps1 script to resolve Docker 17 networking issues.
.\CleanupContainerHostNetworking.ps1 -Cleanup -ForceDeleteAllSwitches
I had a docker and docker-compose which were already working on Centos.
I did the following changes to make it work on windows server 2016:
Stop the docker service, remove nat, start the docker service.
ps>stop-service docker
ps>Get-ContainerNetwork | Remove-ContainerNetwork -Force -ea SilentlyContinue
ps>start-service docker
Configure network in your docker-compose.yml
version: '3.7'
networks:
default:
external:
name: nat
That's It!
I'm trying to install mysql server on a vagrant vm with puppet ,I've added this line on the Vagrant file
config.vm.provision "puppet"
in the same Vagrantfile folder I've created the manifests folder and inside it folder it's default.pp with this content
class { '::mysql::server':
root_password => 'root',
remove_default_accounts => false,
override_options => $override_options
}
mysql::db { 'wordpress':
user => 'wordpress',
password => '12345',
host => 'localhost',
grant => ['ALL'],
}
But I get this error message when I execute vagrant provision
==> default: Running provisioner: puppet...
==> default: Running Puppet with default.pp...
==> default: stdin: is not a tty
==> default: Warning: Setting templatedir is deprecated. See http://links.puppetlabs.com/env-settings-deprecations
==> default: (at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in `issue_deprecation_warning')
==> default: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class ::mysql::server at /tmp/vagrant-puppet/manifests-a11d1078b1b1f2e3bdea27312f6ba513/default.pp:5 on node vagrant-ubuntu-trusty-64.hitronhub.home
==> default: Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class ::mysql::server at /tmp/vagrant-puppet/manifests-a11d1078b1b1f2e3bdea27312f6ba513/default.pp:5 on node vagrant-ubuntu-trusty-64.hitronhub.home
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
puppetlabs-mysql is a puppet module, which means it is not included with the base puppet executable. To use it, you'll need to do a few things:
Create a modules directory in your project for holding puppet modules
Use puppet module install --modulepath modules puppetlabs-mysql to install the MySQL module into the modules directory
Configure module_path for the puppet provisioner in your Vagrantfile
What is the fastest method to reload vagrant after changing a provisioning script ?
I am actually copying the file "mysql.sql" to the guest machine, in "Vagrant":
config.vm.provision "file", source: "mysql.sql", destination: "mysql.sql"
and call it from "bootstrap.sh":
mysql -h localhost -u root -proot < /home/vagrant/mysql.sql
I used to use:
vagrant destroy
vagrant up
vagrant provision
vagrant ssh
I tried to see if:
vagrant reload
will do the same thing, but I am not sure about this, since my modifications happens on the .sql file and not in the Vagrant file.
You can run vagrant reload --provision to run your provisioner.
Provision
On the first vagrant up that creates the environment, provisioning is run. If the environment was already created and the up is just resuming a machine or booting it up, they won't run unless the --provision flag is explicitly provided.
When vagrant provision is used on a running environment.
When vagrant reload --provision is called. The --provision flag must be present to force provisioning.
P.S. A bug was fix in Vagrant 1.7.2, if you have a error during vagrant reload --provision, you car rm .vagrant/machines/default/virtualbox/synced_folders and after run vagrant provision.
I've installed the copssh on a windows 2008 server and then I tried to clone a reposity on the server through ssh. But no matter how hard I tried I couldn't fix this error i got. here is the log:
C:\Users\Admin>hg clone ssh://ehsan#rafsanjani.ir
The authenticity of host 'rafsanjani.ir (96.31.90.174)' can't be established.
RSA key fingerprint is 41:a8:41:21:61:1a:67:2c:e8:44:99:6c:63:e7:06:73.
Are you sure you want to continue connecting (yes/no)? yes
ehsan#rafsanjani.ir's password:
remote: Could not create directory '/home/Administrator/.ssh'.
remote: Failed to add the host to the list of known hosts (/home/Administrator/.ssh/known_hosts).
remote: /bin/bash: Permission denied
abort: no suitable response from remote hg!
I tried to login with administrator but i get the same error message. Also i changed the permission of the folder located in C:\Program Files (x86)\ICW\home\administrator so that ehsan has the full access to this folder.
also when I connect to the server with putty and use this command:
cd /home/administrator/.ssh
echo test>test
file test will create! so it seems that I have the permission to this folder!
this is log when i try to clone with administrator account:
C:\Users\Admin>hg clone ssh://administrator#rafsanjani.ir
The authenticity of host 'rafsanjani.ir (96.31.90.174)' can't be established.
RSA key fingerprint is 41:a8:41:21:61:1a:67:2c:e8:44:99:6c:63:e7:06:73.
Are you sure you want to continue connecting (yes/no)? yes
administrator#rafsanjani.ir's password:
remote: Could not create directory '/home/Administrator/.ssh'.
remote: Failed to add the host to the list of known hosts (/home/Administrator/.ssh/known_hosts).
remote: bash: hg: command not found
abort: no suitable response from remote hg!
The latest versions of copssh/cwrsync use cygwin 1.7 and require a HOME environment variable. So just add a HOME=%HOMEDRIVE%%HOMEPATH% variable and it should work right away. It did for me :)