Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.55k stars 849 forks source link

Bug: Keep running into echo; printf $SSH_AUTH_SOCK error #2672

Closed DianaLaa closed 11 months ago

DianaLaa commented 1 year ago

Are you using the latest stable or develop branch version of VVV?

Yes (stable)

Is it a new VVV, or an existing VVV that used to work?

New fresh install

Did you use a CustomFile?

No (default)

Whats the problem?

I just did a fresh install. No problems, but now suddenly I keep running into this error

==> default: [vagrant-goodhosts] Checking for host entries
==> default: [vagrant-goodhosts] Finished processing
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

echo; printf $SSH_AUTH_SOCK

Stdout from the command:

Stderr from the command:

printf: usage: printf [-v var] format [arguments]

I've rebooted my laptop, but to no avail.

Running vagrant provision also results in an error:

C:/HashiCorp/Vagrant/embedded/gems/gems/net-scp-4.0.0/lib/net/scp.rb:398:in `awa
it_response_state': \x01scp: /home/vagrant/version: Read-only file system (Net::
SCP::Error)

(An hour ago I had a Customfile but I deleted that because it was also giving me the Read-only file system error, but right now I have no Customfile and I still get this error. What gives?)

How do we reproduce it?

Wish I knew.

What is the output of vagrant status

$ vagrant status
__ __ __ __
\ V\ V\ V / v3.11.2 Ruby:3.1.3, Path:"C:/Users/Diana/WP-CPCM/VVV"
 \_/\_/\_/  git::stable(3b367ce6)

Platform: mingw32 windows  missingWinAdminPriv  vagrant-goodhosts vagrant-vbgues
t monochrome-terminal shared_db_folder_disabled
Vagrant: v2.3.6, virtualbox: v7.0.8

Docs:       https://varyingvagrantvagrants.org/
Contribute: https://github.com/varying-vagrant-vagrants/vvv
Dashboard:  http://vvv.test

Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

Which Operating System are you using?

Microsoft Windows

Which provider are you using?

VirtualBox 7

welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the issue template and include your OS/Vagrant/VVV versions! Don't forget you can get support in the VVV slack at https://varyingvagrantvagrants.org/docs/en-US/slack/

VVV
VVV Slack Workspace
Join the VVV Slack Workspace
DianaLaa commented 1 year ago

Oh yeah, and vagrant halt gives me

$ vagrant halt
==> default: Running action triggers before halt ...
==> default: Running trigger: VVV Pre-Halt...
==> default: Trigger run failed
==> default: ☺scp: /tmp/vagrant-shell: Read-only file system
tomjn commented 1 year ago

Microsoft Windows

This is the critical information

==> default: ☺scp: /tmp/vagrant-shell: Read-only file system

yup if it can't SSH in then all sorts of stuff will be broken by default, VVV doesn't have a chance to even run provisioners


I'm assuming that because you mentioned a customfile ( 😱 😬 ) that this isn't your first VVV install, but, I suspect this is the first time you've used the specific command prompt you used.

That's because this kind of message heavily implies that there is no SSH Agent present:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

echo; printf $SSH_AUTH_SOCK

Oddly enough the best documentation available for this problem is on the official github docs. Vagrant needs to SSH into the VM, but Windows doesn't support Linux sockets so instead it has code to let it use a simulator like Msysgit or cygwin. Installing git bash, git for windows, or any of the official git on windows installers sets this up automatically and most people don't even realise it's a thing or have to do anything. That's why git is listed in the required software for Windows users.

However, if you use an unsupported command prompt or a weird command prompt, or skipped all of that and never installed git and used a zip file, or only used git inside WSL, then no SSH Agent is available that vagrant knows how to use, and you get messages like this.

tomjn commented 1 year ago

This doc is probably what you want:

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/using-ssh-agent-forwarding#your-local-ssh-agent-must-be-running

Remember to use an elevated administrator prompt ( without it host file modification won't work for most people, and symlinks will be broken in folders )

GitHub Docs
Using SSH agent forwarding - GitHub Docs
To simplify deploying to a server, you can set up SSH agent forwarding to securely use local SSH keys.
tomjn commented 1 year ago

Also note that if you had said yes to the customfile question it would have meant instantly closing the issue as wontfix, you cannot ask for help here if you use customfile, it is forbidden. customfile == forfeit all support.

DianaLaa commented 1 year ago

Can you explain why it worked before I created a Customfile and now after I delete the Customfile it does not work? This is my first VVV installation (well, except two years ago). I have git installed.

tomjn commented 1 year ago

Can you explain why it worked before I created a Customfile and now after I delete the Customfile it does not work? This is my first VVV installation (well, except two years ago). I have git installed.

This has nothing to do with your Customfile, it is coincidental

DianaLaa commented 1 year ago

Sorry, I need a more thorough answer than "You don't have SSH" because an hour ago it worked.

DianaLaa commented 1 year ago

I have the default setup. The changes I made:

These are the only things I've been trying to do today, to set up a WordPress development environment. Does that give any leads as to what's causing the hangup?

tomjn commented 1 year ago

I do not know why the SSH agent was no longer present, but the github document I linked to should have contained commands that start it again resolving the issue.

As for why it happened, the cause could be any number of things that are unrelated to VVV, Windows updates, package managers, installers, launching a different type of command prompt by accident, or bad code in a customfile.

added a Customfile to create a shared folder to wp-content/plugins/my-plugin

This is a bad idea, overlapping shares can cause weirdness in VirtualBox. Try forcing it off in the VirtualBox admin, but as I said there are good reasons we do not offer support to people who use the customfile feature, that feature is explicitly there only for people who are comfortable and experienced with vagrant and ruby, people who could rebuild VVV from scratch if they had the time.

Sorry, I need a more thorough answer than "You don't have SSH" because an hour ago it worked.

I do not appreciate the hostile tone, please read our code of conduct. I'm not an employee, or paid support staff, I volunteer my time like others for an open source community project.

tomjn commented 1 year ago

From the splash screen we can infer that the command prompt was likely gitbash, but that it was not started using an elevated administrator prompt:

Platform: mingw32 windows missingWinAdminPriv vagrant-goodhosts vagrant-vbgues t monochrome-terminal shared_db_folder_disabled

monochrome-terminal also implies it's a wrapped cmd.exe rather than the newer Windows Terminal app

tomjn commented 1 year ago

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases?platform=windows#auto-launching-ssh-agent-on-git-for-windows

GitHub Docs
Working with SSH key passphrases - GitHub Docs
You can secure your SSH keys and configure an authentication agent so that you won't have to reenter your passphrase every time you use your SSH keys.
DianaLaa commented 1 year ago

After multiple tries to reboot my laptop, delete the VM and running vagrant halt in various orders, VVV starts fine this morning.

The word "thorough" was misplaced, you wrote a lot already, it just didn't give me an actionable next step that applied to my setup (within my understanding of the situation). At some point you wrote "no SSH Agent present" and "or skipped all of that and never installed git". Given that it worked fine an hour ago and I spent quite some time downloading all the requirements, this made me conclude "no, that's surely not it, I have git installed and it worked, so I must have SSH Agent, it must be something else".

Given that this morning it worked, I'm sure you're right given the error, that the SSH Agent crashed or something.

I don't know VVV, only used it once two years ago. I mostly use any terminal that is at hand (git bash is great for me due to visual impairment, the colors help me see where I am).

tomjn commented 1 year ago

Did you try the commands in the github doc I linked to?

DianaLaa commented 11 months ago

Thanks. I used the following commands: eval "$(ssh-agent -s)" kill -9 <PID>