Bug 60560 - Xamarin Agent: Unable to generate SSH keys for the user
Summary: Xamarin Agent: Unable to generate SSH keys for the user
Status: VERIFIED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: XMA ()
Version: 4.8.0 (15.5)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 15.6
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-11-07 21:16 UTC by Cristiano
Modified: 2018-01-29 21:36 UTC (History)
8 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Cristiano 2017-11-07 21:16:39 UTC
Relying on the logs seems to me that the error "Unable to generate SSH keys for the user" occurred during setup of the Xamarin Agent in Visual Studio 2017 (Windows side) is due to the presence of a space in my Mac's home path (please note the space in "Home HD"):

Xamarin.Messaging.Ssh.SshCommandRunner|Warning|0|Failed to execute 'ssh-keygen -b 2048 -t rsa -f /Volumes/Home HD/Users/username/Library/Caches/Xamarin/XMA/Keys/aa87a6c8-b875-42ac-9e0f-000b005ff000 -q -N "000717e2-0000-0000-b400-2277648ab940"': ExitStatus = 1
Xamarin.Messaging.Ssh.SshCommandRunner|Warning|0|Too many arguments.
usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa]
                  [-N new_passphrase] [-C comment] [-f output_keyfile]
       ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
       ssh-keygen -i [-m key_format] [-f input_keyfile]
       ssh-keygen -e [-m key_format] [-f input_keyfile]
       ssh-keygen -y [-f input_keyfile]
       ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
       ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
       ssh-keygen -B [-f input_keyfile]
       ssh-keygen -D pkcs11
       ssh-keygen -F hostname [-f known_hosts_file] [-l]
       ssh-keygen -H [-f known_hosts_file]
       ssh-keygen -R hostname [-f known_hosts_file]
       ssh-keygen -r hostname [-f input_keyfile] [-g]
       ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
       ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
                  [-j start_line] [-K checkpt] [-W generator]
       ssh-keygen -s ca_key -I certificate_identity [-h] [-n principals]
                  [-O option] [-V validity_interval] [-z serial_number] file ...
       ssh-keygen -L [-f input_keyfile]
       ssh-keygen -A
       ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
                  file ...
       ssh-keygen -Q -f krl_file file ...

Xamarin.Messaging.Integration.State.DisconnectedState|Error|0|Unable to generate SSH keys for the user.


Executing the same command via PuTTY I got the same error message:

Too many arguments.
usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa]
                  [-N new_passphrase] [-C comment] [-f output_keyfile]
       ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
       ssh-keygen -i [-m key_format] [-f input_keyfile]
       ssh-keygen -e [-m key_format] [-f input_keyfile]
       ssh-keygen -y [-f input_keyfile]
       ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
       ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
       ssh-keygen -B [-f input_keyfile]
       ssh-keygen -D pkcs11
       ssh-keygen -F hostname [-f known_hosts_file] [-l]
       ssh-keygen -H [-f known_hosts_file]
       ssh-keygen -R hostname [-f known_hosts_file]
       ssh-keygen -r hostname [-f input_keyfile] [-g]
       ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
       ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
                  [-j start_line] [-K checkpt] [-W generator]
       ssh-keygen -s ca_key -I certificate_identity [-h] [-n principals]
                  [-O option] [-V validity_interval] [-z serial_number] file ...
       ssh-keygen -L [-f input_keyfile]
       ssh-keygen -A
       ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
                  file ...
       ssh-keygen -Q -f krl_file file ...



Suggested solution: add "" after -f parameter:
ssh-keygen -b 2048 -t rsa -f "/Volumes/Home HD/Users/username/Library/Caches/Xamarin/XMA/Keys/aa87a6c8-b875-42ac-9e0f-000b005ff000" -q -N "000717e2-0000-0000-b400-2277648ab940"

The previous command is correcty executed on PuTTY.
Comment 1 David Karlaš 2017-11-08 13:48:49 UTC
Xamarin Agent is part of Visual Studio Extensions, hence moving to that product
Comment 3 Jimmy [MSFT] 2018-01-05 17:32:45 UTC
Fixed in 15.6 Preview 2: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/513525
Comment 4 Ben Beckley 2018-01-29 21:36:12 UTC
We've verified the fix for the work item that Jimmy linked in comment 3.

Changing the status to reflect this.