{"action":"created","issue":{"url":"https://api.github.com/repos/pradels/vagrant-libvirt/issues/225","repository_url":"https://api.github.com/repos/pradels/vagrant-libvirt","labels_url":"https://api.github.com/repos/pradels/vagrant-libvirt/issues/225/labels{/name}","comments_url":"https://api.github.com/repos/pradels/vagrant-libvirt/issues/225/comments","events_url":"https://api.github.com/repos/pradels/vagrant-libvirt/issues/225/events","html_url":"https://github.com/pradels/vagrant-libvirt/issues/225","id":42129783,"number":225,"title":"port forwarding times out","user":{"login":"aspiers","id":100738,"avatar_url":"https://avatars.githubusercontent.com/u/100738?v=3","gravatar_id":"","url":"https://api.github.com/users/aspiers","html_url":"https://github.com/aspiers","followers_url":"https://api.github.com/users/aspiers/followers","following_url":"https://api.github.com/users/aspiers/following{/other_user}","gists_url":"https://api.github.com/users/aspiers/gists{/gist_id}","starred_url":"https://api.github.com/users/aspiers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspiers/subscriptions","organizations_url":"https://api.github.com/users/aspiers/orgs","repos_url":"https://api.github.com/users/aspiers/repos","events_url":"https://api.github.com/users/aspiers/events{/privacy}","received_events_url":"https://api.github.com/users/aspiers/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-09-06T23:22:00Z","updated_at":"2016-04-25T12:15:00Z","closed_at":"2016-04-25T12:15:00Z","body":"ssh port forwarding doesn't work if the `Vagrantfile` sets `connect_via_ssh` to `true`.\r\n\r\n[`lib/vagrant-libvirt/action/forward_ports.rb`](https://github.com/pradels/vagrant-libvirt/blob/64c40ffee6c93be406d83488bdbdf9d67472f072/lib/vagrant-libvirt/action/forward_ports.rb#L100) has the following code:\r\n\r\n    options += \" -o ProxyCommand=\\\"#{ssh_info[:proxy_command]}\\\"\" if machine.provider_config.connect_via_ssh\r\n\r\nand [`lib/vagrant-libvirt/action/read_ssh_info.rb`](https://github.com/pradels/vagrant-libvirt/blob/64c40ffee6c93be406d83488bdbdf9d67472f072/lib/vagrant-libvirt/action/read_ssh_info.rb#L51) has:\r\n\r\n    ssh_info[:proxy_command] = \"ssh '#{machine.provider_config.host}' -l '#{machine.provider_config.username}' nc %h %p\" if machine.provider_config.connect_via_ssh\r\n\r\nresulting in an `ssh` command like this:\r\n\r\n    ssh -o User=vagrant -o Port=22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o ForwardX11=no -o IdentityFile=/home/adam/.vagrant.d/insecure_private_key -o ProxyCommand=\"ssh 'localhost' -l 'root' nc %h %p\" -v -L \"localhost:3000:192.168.124.10:3000\" -N 192.168.101.190\r\n\r\nIt seems that the\r\n\r\n    -o ProxyCommand=\"ssh 'localhost' -l 'root' nc %h %p\"\r\n\r\ncauses some kind of timeout, because I hacked the plugin to log to a file:\r\n\r\n          spawn(ssh_cmd, [:out, :err] => ['/tmp/vagrant-libvirt-forwarding.log', 'w'])\r\n\r\nadded `-v` to the ssh option list, and got:\r\n\r\n```\r\n2014/09/06 Sun 23:02:33 OpenSSH_6.2p2, OpenSSL 1.0.1i 6 Aug 2014\r\n2014/09/06 Sun 23:02:33 debug1: Reading configuration data /home/adam/.ssh/config\r\n2014/09/06 Sun 23:02:33 debug1: /home/adam/.ssh/config line 148: Applying options for 192.168.*\r\n2014/09/06 Sun 23:02:33 debug1: /home/adam/.ssh/config line 152: Applying options for *\r\n2014/09/06 Sun 23:02:33 debug1: Reading configuration data /etc/ssh/ssh_config\r\n2014/09/06 Sun 23:02:33 debug1: /etc/ssh/ssh_config line 20: Applying options for *\r\n2014/09/06 Sun 23:02:33 debug1: Control socket \"/home/adam/.ssh/master-vagrant@192.168.101.190:22\" does not exist\r\n2014/09/06 Sun 23:02:33 debug1: Executing proxy command: exec ssh 'localhost' -l 'root' nc 192.168.101.190 22\r\n2014/09/06 Sun 23:02:33 debug1: identity file /home/adam/.vagrant.d/insecure_private_key type -1\r\n2014/09/06 Sun 23:02:33 debug1: identity file /home/adam/.vagrant.d/insecure_private_key-cert type -1\r\n2014/09/06 Sun 23:02:33 debug1: Enabling compatibility mode for protocol 2.0\r\n2014/09/06 Sun 23:02:33 debug1: Local version string SSH-2.0-OpenSSH_6.2\r\n2014/09/06 Sun 23:02:33 debug1: permanently_drop_suid: 1000\r\n2014/09/06 Sun 23:02:33 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2\r\n2014/09/06 Sun 23:02:33 debug1: match: OpenSSH_6.2 pat OpenSSH*\r\n2014/09/06 Sun 23:02:33 debug1: SSH2_MSG_KEXINIT sent\r\n2014/09/06 Sun 23:02:33 debug1: SSH2_MSG_KEXINIT received\r\n2014/09/06 Sun 23:02:33 debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none\r\n2014/09/06 Sun 23:02:33 debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none\r\n2014/09/06 Sun 23:02:33 debug1: sending SSH2_MSG_KEX_ECDH_INIT\r\n2014/09/06 Sun 23:02:33 debug1: expecting SSH2_MSG_KEX_ECDH_REPLY\r\n2014/09/06 Sun 23:02:33 debug1: Server host key: ECDSA 8c:36:16:73:3b:5c:e6:52:01:6d:00:19:00:15:6f:c7\r\n2014/09/06 Sun 23:02:33 Warning: Permanently added '192.168.101.190' (ECDSA) to the list of known hosts.\r\n2014/09/06 Sun 23:02:33 debug1: ssh_ecdsa_verify: signature correct\r\n2014/09/06 Sun 23:02:33 debug1: SSH2_MSG_NEWKEYS sent\r\n2014/09/06 Sun 23:02:33 debug1: expecting SSH2_MSG_NEWKEYS\r\n2014/09/06 Sun 23:02:33 debug1: SSH2_MSG_NEWKEYS received\r\n2014/09/06 Sun 23:02:33 debug1: Roaming not allowed by server\r\n2014/09/06 Sun 23:02:33 debug1: SSH2_MSG_SERVICE_REQUEST sent\r\n2014/09/06 Sun 23:02:33 debug1: SSH2_MSG_SERVICE_ACCEPT received\r\n2014/09/06 Sun 23:02:33 debug1: Authentications that can continue: publickey,keyboard-interactive\r\n2014/09/06 Sun 23:02:33 debug1: Next authentication method: publickey\r\n2014/09/06 Sun 23:02:33 debug1: Offering RSA public key: /home/adam/.ssh/id_rsa\r\n2014/09/06 Sun 23:02:33 debug1: Authentications that can continue: publickey,keyboard-interactive\r\n2014/09/06 Sun 23:02:33 debug1: Trying private key: /home/adam/.vagrant.d/insecure_private_key\r\n2014/09/06 Sun 23:02:33 debug1: read PEM private key done: type RSA\r\n2014/09/06 Sun 23:02:33 debug1: Authentication succeeded (publickey).\r\n2014/09/06 Sun 23:02:33 Authenticated to 192.168.101.190 (via proxy).\r\n2014/09/06 Sun 23:02:33 debug1: Local connections to localhost:3000 forwarded to remote address 192.168.124.10:3000\r\n2014/09/06 Sun 23:02:33 debug1: Local forwarding listening on ::1 port 3000.\r\n2014/09/06 Sun 23:02:33 debug1: channel 0: new [port listener]\r\n2014/09/06 Sun 23:02:33 debug1: Local forwarding listening on 127.0.0.1 port 3000.\r\n2014/09/06 Sun 23:02:33 debug1: channel 1: new [port listener]\r\n2014/09/06 Sun 23:02:33 debug1: Requesting no-more-sessions@openssh.com\r\n2014/09/06 Sun 23:02:33 debug1: Entering interactive session.\r\n2014/09/06 Sun 23:02:35 Write failed: Broken pipe\r\n```\r\n\r\nThe `ssh` process dies as soon as it gets `SIGPIPE`, after which there is no port forwarding.\r\n\r\nI don't really understand what the proxy is supposed to do, so I can't suggest a good solution, but I'm guessing it would have to involve changing keepalive timeouts, or actually sending keepalives, or something."},"comment":{"url":"https://api.github.com/repos/pradels/vagrant-libvirt/issues/comments/214289313","html_url":"https://github.com/pradels/vagrant-libvirt/issues/225#issuecomment-214289313","issue_url":"https://api.github.com/repos/pradels/vagrant-libvirt/issues/225","id":214289313,"user":{"login":"infernix","id":162537,"avatar_url":"https://avatars.githubusercontent.com/u/162537?v=3","gravatar_id":"","url":"https://api.github.com/users/infernix","html_url":"https://github.com/infernix","followers_url":"https://api.github.com/users/infernix/followers","following_url":"https://api.github.com/users/infernix/following{/other_user}","gists_url":"https://api.github.com/users/infernix/gists{/gist_id}","starred_url":"https://api.github.com/users/infernix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infernix/subscriptions","organizations_url":"https://api.github.com/users/infernix/orgs","repos_url":"https://api.github.com/users/infernix/repos","events_url":"https://api.github.com/users/infernix/events{/privacy}","received_events_url":"https://api.github.com/users/infernix/received_events","type":"User","site_admin":false},"created_at":"2016-04-25T12:15:00Z","updated_at":"2016-04-25T12:15:00Z","body":"Looking at this, I don't see an obvious bug here anymore, and there was a fix pushed for the output redirection as well.  Last commenter mentioned that everything does work as expected.\r\n\r\nI'm therefore closing this; if this is still broken feel free to reopen or post a new issue."}}