# virsh no connect to any host



## cahimira (Mar 11, 2013)

I have a problem with "virsh" in FreeBSD 9.0 and 9.1 (all ports updated). When I try to connect to a remote host via SSH, I get this error:

`$  virsh -c [url=qemu+ssh://root@]qemu+ssh://root@[/url][IP-ADDRESS]:[PORT]/system`

```
error: failed to connect to the hypervisor
error: End of file while reading data: : Input/output error
```
The hypervisor daemon (libvirtd) and SSH daemon are running on the remote host. I can connect from Linux without any problems.

Suggestions?

Thank you.


----------



## Carpetsmoker (Mar 12, 2013)

Do the logs on the target system mention anything?

You can run sshd with more logging by increasing LogLevel in /etc/ssh/sshd_config.


----------



## cahimira (Mar 14, 2013)

Hello,

here is the log:


```
Mar 13 20:49:09 localhost sshd[17254]: debug1: Forked child 17298.
Mar 13 20:49:09 localhost sshd[17298]: Set /proc/self/oom_score_adj to 0
Mar 13 20:49:09 localhost sshd[17298]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Mar 13 20:49:09 localhost sshd[17298]: debug1: inetd sockets after dupping: 3, 3
Mar 13 20:49:09 localhost sshd[17298]: Connection from XX.XX.XX.XX port 42922
Mar 13 20:49:09 localhost sshd[17298]: debug1: Client protocol version 2.0; client software version OpenSSH_5.8p2_hpn13v11 FreeBSD-20110503
Mar 13 20:49:09 localhost sshd[17298]: debug1: match: OpenSSH_5.8p2_hpn13v11 FreeBSD-20110503 pat OpenSSH*
Mar 13 20:49:09 localhost sshd[17298]: debug1: Enabling compatibility mode for protocol 2.0
Mar 13 20:49:09 localhost sshd[17298]: debug1: Local version string SSH-2.0-OpenSSH_5.3
Mar 13 20:49:09 localhost sshd[17299]: debug1: permanently_set_uid: 74/74
Mar 13 20:49:09 localhost sshd[17299]: debug1: list_hostkey_types: ssh-rsa,ssh-dss
Mar 13 20:49:09 localhost sshd[17299]: debug1: SSH2_MSG_KEXINIT sent
Mar 13 20:49:09 localhost sshd[17299]: debug1: SSH2_MSG_KEXINIT received
Mar 13 20:49:09 localhost sshd[17299]: debug1: kex: client->server aes128-ctr hmac-md5 none
Mar 13 20:49:09 localhost sshd[17299]: debug1: kex: server->client aes128-ctr hmac-md5 none
Mar 13 20:49:09 localhost sshd[17299]: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
Mar 13 20:49:09 localhost sshd[17299]: debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
Mar 13 20:49:09 localhost sshd[17299]: debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
Mar 13 20:49:09 localhost sshd[17299]: debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
Mar 13 20:49:09 localhost sshd[17299]: debug1: SSH2_MSG_NEWKEYS sent
Mar 13 20:49:09 localhost sshd[17299]: debug1: expecting SSH2_MSG_NEWKEYS
Mar 13 20:49:09 localhost sshd[17299]: debug1: SSH2_MSG_NEWKEYS received
Mar 13 20:49:09 localhost sshd[17299]: debug1: KEX done
Mar 13 20:49:10 localhost sshd[17299]: debug1: userauth-request for user root service ssh-connection method none
Mar 13 20:49:10 localhost sshd[17299]: debug1: attempt 0 failures 0
[B]Mar 13 20:49:10 localhost sshd[17298]: reverse mapping checking getaddrinfo for XX.XX.XX.XX [XX.XX.XX.XX] failed - POSSIBLE BREAK-IN ATTEMPT![/B]
Mar 13 20:49:10 localhost sshd[17298]: debug1: PAM: initializing for "root"
Mar 13 20:49:10 localhost sshd[17298]: debug1: PAM: setting PAM_RHOST to "XX.XX.XX.XX"
Mar 13 20:49:10 localhost sshd[17298]: debug1: PAM: setting PAM_TTY to "ssh"
Mar 13 20:49:12 localhost sshd[17299]: debug1: userauth-request for user root service ssh-connection method password
Mar 13 20:49:12 localhost sshd[17299]: debug1: attempt 1 failures 0
[B]Mar 13 20:49:12 localhost sshd[17298]: debug1: PAM: password authentication accepted for root[/B]
Mar 13 20:49:12 localhost sshd[17298]: debug1: do_pam_account: called
[B]Mar 13 20:49:12 localhost sshd[17298]: Accepted password for root from XX.XX.XX.XX port 42922 ssh2
Mar 13 20:49:12 localhost sshd[17298]: debug1: monitor_child_preauth: root has been authenticated by privileged process[/B]
Mar 13 20:49:12 localhost sshd[17298]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Mar 13 20:49:12 localhost sshd[17298]: debug1: ssh_gssapi_storecreds: Not a GSSAPI mechanism
Mar 13 20:49:12 localhost sshd[17298]: debug1: restore_uid: 0/0
Mar 13 20:49:12 localhost sshd[17298]: debug1: SELinux support enabled
Mar 13 20:49:12 localhost sshd[17298]: debug1: PAM: establishing credentials
Mar 13 20:49:12 localhost sshd[17298]: pam_unix(sshd:session): session opened for user root by (uid=0)
Mar 13 20:49:12 localhost sshd[17298]: debug1: Entering interactive session for SSH2.
Mar 13 20:49:12 localhost sshd[17298]: debug1: server_init_dispatch_20
Mar 13 20:49:12 localhost sshd[17298]: debug1: server_input_channel_open: ctype session rchan 0 win 2097152 max 32768
Mar 13 20:49:12 localhost sshd[17298]: debug1: input_session_request
Mar 13 20:49:12 localhost sshd[17298]: debug1: channel 0: new [server-session]
Mar 13 20:49:12 localhost sshd[17298]: debug1: session_new: session 0
Mar 13 20:49:12 localhost sshd[17298]: debug1: session_open: channel 0
Mar 13 20:49:12 localhost sshd[17298]: debug1: session_open: session 0: link with channel 0
Mar 13 20:49:12 localhost sshd[17298]: debug1: server_input_channel_open: confirm session
Mar 13 20:49:12 localhost sshd[17298]: debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0
Mar 13 20:49:12 localhost sshd[17298]: debug1: server_input_channel_req: channel 0 request exec reply 1
Mar 13 20:49:12 localhost sshd[17298]: debug1: session_by_channel: session 0 channel 0
Mar 13 20:49:12 localhost sshd[17298]: debug1: session_input_channel_req: session 0 req exec
Mar 13 20:49:12 localhost sshd[17303]: debug1: PAM: reinitializing credentials
Mar 13 20:49:12 localhost sshd[17303]: debug1: permanently_set_uid: 0/0
[B]Mar 13 20:49:12 localhost sshd[17298]: debug1: Received SIGCHLD.[/B]
Mar 13 20:49:12 localhost sshd[17298]: debug1: session_by_pid: pid 17303
Mar 13 20:49:12 localhost sshd[17298]: debug1: session_exit_message: session 0 channel 0 pid 17303
Mar 13 20:49:12 localhost sshd[17298]: debug1: session_exit_message: release channel 0
[B]Mar 13 20:49:12 localhost sshd[17298]: Received disconnect from XX.XX.XX.XX: 11: disconnected by user[/B]
Mar 13 20:49:12 localhost sshd[17298]: debug1: do_cleanup
Mar 13 20:49:12 localhost sshd[17298]: debug1: PAM: cleanup
Mar 13 20:49:12 localhost sshd[17298]: debug1: PAM: closing session
Mar 13 20:49:12 localhost sshd[17298]: pam_unix(sshd:session): session closed for user root
Mar 13 20:49:12 localhost sshd[17298]: debug1: PAM: deleting credentials
```


----------



## cahimira (Mar 14, 2013)

But I can login in shell without problems using default FreeBSD SSH client:


```
Mar 13 20:56:13 localhost sshd[17254]: debug1: Forked child 17375.
Mar 13 20:56:13 localhost sshd[17375]: Set /proc/self/oom_score_adj to 0
Mar 13 20:56:13 localhost sshd[17375]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Mar 13 20:56:13 localhost sshd[17375]: debug1: inetd sockets after dupping: 3, 3
Mar 13 20:56:13 localhost sshd[17375]: Connection from XX.XX.XX.XX port 42958
Mar 13 20:56:13 localhost sshd[17375]: debug1: Client protocol version 2.0; client software version OpenSSH_5.8p2_hpn13v11 FreeBSD-20110503
Mar 13 20:56:13 localhost sshd[17375]: debug1: match: OpenSSH_5.8p2_hpn13v11 FreeBSD-20110503 pat OpenSSH*
Mar 13 20:56:13 localhost sshd[17375]: debug1: Enabling compatibility mode for protocol 2.0
Mar 13 20:56:13 localhost sshd[17375]: debug1: Local version string SSH-2.0-OpenSSH_5.3
Mar 13 20:56:13 localhost sshd[17376]: debug1: permanently_set_uid: 74/74
Mar 13 20:56:13 localhost sshd[17376]: debug1: list_hostkey_types: ssh-rsa,ssh-dss
Mar 13 20:56:13 localhost sshd[17376]: debug1: SSH2_MSG_KEXINIT sent
Mar 13 20:56:13 localhost sshd[17376]: debug1: SSH2_MSG_KEXINIT received
Mar 13 20:56:13 localhost sshd[17376]: debug1: kex: client->server aes128-ctr hmac-md5 none
Mar 13 20:56:13 localhost sshd[17376]: debug1: kex: server->client aes128-ctr hmac-md5 none
Mar 13 20:56:13 localhost sshd[17376]: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
Mar 13 20:56:13 localhost sshd[17376]: debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
Mar 13 20:56:13 localhost sshd[17376]: debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
Mar 13 20:56:14 localhost sshd[17376]: debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
Mar 13 20:56:14 localhost sshd[17376]: debug1: SSH2_MSG_NEWKEYS sent
Mar 13 20:56:14 localhost sshd[17376]: debug1: expecting SSH2_MSG_NEWKEYS
Mar 13 20:56:14 localhost sshd[17376]: debug1: SSH2_MSG_NEWKEYS received
Mar 13 20:56:14 localhost sshd[17376]: debug1: KEX done
Mar 13 20:56:14 localhost sshd[17376]: debug1: userauth-request for user root service ssh-connection method none
Mar 13 20:56:14 localhost sshd[17376]: debug1: attempt 0 failures 0
Mar 13 20:56:14 localhost sshd[17375]: reverse mapping checking getaddrinfo for XX.XX.XX.XX [XX.XX.XX.XX] failed - POSSIBLE BREAK-IN ATTEMPT!
Mar 13 20:56:14 localhost sshd[17375]: debug1: PAM: initializing for "root"
Mar 13 20:56:14 localhost sshd[17375]: debug1: PAM: setting PAM_RHOST to "XX.XX.XX.XX"
Mar 13 20:56:14 localhost sshd[17375]: debug1: PAM: setting PAM_TTY to "ssh"
Mar 13 20:56:21 localhost sshd[17376]: debug1: userauth-request for user root service ssh-connection method password
Mar 13 20:56:21 localhost sshd[17376]: debug1: attempt 2 failures 1
Mar 13 20:56:21 localhost sshd[17375]: debug1: PAM: password authentication accepted for root
Mar 13 20:56:21 localhost sshd[17375]: debug1: do_pam_account: called
[B]Mar 13 20:56:21 localhost sshd[17375]: Accepted password for root from XX.XX.XX.XX port 42958 ssh2[/B]
Mar 13 20:56:21 localhost sshd[17375]: debug1: monitor_child_preauth: root has been authenticated by privileged process
Mar 13 20:56:21 localhost sshd[17375]: debug1: temporarily_use_uid: 0/0 (e=0/0)
Mar 13 20:56:21 localhost sshd[17375]: debug1: ssh_gssapi_storecreds: Not a GSSAPI mechanism
Mar 13 20:56:21 localhost sshd[17375]: debug1: restore_uid: 0/0
Mar 13 20:56:21 localhost sshd[17375]: debug1: SELinux support enabled
Mar 13 20:56:21 localhost sshd[17375]: debug1: PAM: establishing credentials
Mar 13 20:56:21 localhost sshd[17375]: pam_unix(sshd:session): session opened for user root by (uid=0)
Mar 13 20:56:21 localhost sshd[17375]: debug1: Entering interactive session for SSH2.
Mar 13 20:56:21 localhost sshd[17375]: debug1: server_init_dispatch_20
Mar 13 20:56:21 localhost sshd[17375]: debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384
Mar 13 20:56:21 localhost sshd[17375]: debug1: input_session_request
Mar 13 20:56:21 localhost sshd[17375]: debug1: channel 0: new [server-session]
Mar 13 20:56:21 localhost sshd[17375]: debug1: session_new: session 0
Mar 13 20:56:21 localhost sshd[17375]: debug1: session_open: channel 0
Mar 13 20:56:21 localhost sshd[17375]: debug1: session_open: session 0: link with channel 0
Mar 13 20:56:21 localhost sshd[17375]: debug1: server_input_channel_open: confirm session
Mar 13 20:56:21 localhost sshd[17375]: debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0
Mar 13 20:56:21 localhost sshd[17375]: debug1: server_input_channel_req: channel 0 request pty-req reply 1
Mar 13 20:56:21 localhost sshd[17375]: debug1: session_by_channel: session 0 channel 0
Mar 13 20:56:21 localhost sshd[17375]: debug1: session_input_channel_req: session 0 req pty-req
Mar 13 20:56:21 localhost sshd[17375]: debug1: Allocating pty.
Mar 13 20:56:21 localhost sshd[17375]: debug1: session_pty_req: session 0 alloc /dev/pts/5
Mar 13 20:56:21 localhost sshd[17375]: debug1: Ignoring unsupported tty mode opcode 11 (0xb)
Mar 13 20:56:21 localhost sshd[17375]: debug1: Ignoring unsupported tty mode opcode 17 (0x11)
Mar 13 20:56:21 localhost sshd[17375]: debug1: server_input_channel_req: channel 0 request shell reply 1
Mar 13 20:56:21 localhost sshd[17375]: debug1: session_by_channel: session 0 channel 0
Mar 13 20:56:21 localhost sshd[17375]: debug1: session_input_channel_req: session 0 req shell
Mar 13 20:56:21 localhost sshd[17382]: debug1: Setting controlling tty using TIOCSCTTY.
Mar 13 20:56:21 localhost sshd[17382]: debug1: PAM: reinitializing credentials
Mar 13 20:56:21 localhost sshd[17382]: debug1: permanently_set_uid: 0/0
```


----------



## serverhamster (Mar 17, 2013)

I believe libvirt does not have network support in FreeBSD yet.


----------

