SSH connection refused while setting up example site from GitHub repo

Hello folks,

This is first time testing out the Roots stack and as far as I can tell, it looks promising for my use case. I planned to test it out and everything went surprisingly normal up until the very end. Here’s the brief info what I was trying to do.

I’m try to setup my environment on Windows 10 via WSL 2. I followed the guide on the official site and was able to install most of the dependencies and VM setup. The last leg in this exercise is making connection to the VirtualBox VM via ssh, that’s when things go south.

    $ vagrant up
    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Checking if box 'bento/ubuntu-18.04' version '202012.21.0' 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: 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: vagrant
        default: SSH auth method: private key
        default: Warning: Connection refused. Retrying...
        default: Warning: Connection refused. Retrying...
    ^C==> default: Waiting for cleanup before exiting...
    Vagrant exited after cleanup due to external interrupt.

If I try connecting simply via the ssh command from WSL terminal,
$ ssh -p 2222 vagrant@127.0.0.1
It still says “refused to connect”. I tried using the WSL IP from Control Panel to connect via ssh but that didn’t work either.

However, I’m able to login if I do same with Powershell.

So I’m rounding it off to some Firewall settings I may have missed. Right now, I’m running out of ideas and definitely not a network guy so any help is appreciated. Let me know if you guys need more info to better understand the problem I maybe facing.

Hello,

Have the same issue, solution for me: convert WSL2 to WSL1,
you can do this: wsl --set-version <distro_name> <version>
After this, I re-init trellis for the project, and all work fine.

Concerning WSL 2 and firewall/packets across networks, could this help?

Wow, I never thought of it that way. Although I prefer to keep using WSL2, I’ll give it a try.

Yes, I think the answer has to do something with networking. I’ll give it a try.

In the meantime, I found a vagrant plugin that’ll ease the job if anyone’s stumbled here in future. It’s called VirtualboxWSL2 and available at https://github.com/Karandash8/virtualbox_WSL2

Under the hood, it may be doing exactly the same as the stackoverflow solution you’ve mentioned.

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.