I can't connect to Mac with Xamarin Mac Agent from Visual Studio 2015
I can't connect to Mac with Xamarin Mac Agent from Visual Studio 2015
I'm continuing my adventure with Xamarin.
I'm developing an Xamarin Forms application with a Portable Class Libraries (PCL).
I have compiled and debugged my application by Android, but now, I'm interested to run the application in iOS to test in this platform.
I have a problem with the connection between my PC and the Mac.
I have a PC (Windows 8.1) with Visual Studio Community 2015 with Xamarin tools installed.
In my Mac Mini, I have installed OS X (v10.11.3), XCode (v7.2) and Xamarin Studio. I have logged in with my Xamarin account.
In the two machines I have the same Xamarin version.
I have followed the Xamarin walkthrough.
On Visual Studio I open the Xamarin Mac Agent. It finds my Mac Mini. Then it asks me the Mac credentials (user and password).
The login works at this point.
Then, in the solution, I set the iOS project as the startup project. I clean the solution, I build again and start the compile/debug process (F5).
In this point, the output retrieves a message:
1> Connecting to Mac server Macs-Mac-mini.local...
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets(54,5): warning : Could not authenticate the user using the existing ssh keys
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets(54,5): error : Unable to connect to Address='Macs-Mac-mini.local' with User='macmini
I have used Putty (SSH Client) to check with my user/password if I'm able to connect to Mac, and I have had success.
Into /Users/macmini2/.ssh/authorized_keys file (Mac machine) each time that I use the Xamarin Mac Agent, Visual Studio adds a new key entry (it adds the same repeated).
I see that perhaps the problem is related with ssh keys. Why I have this problem? What am I doing wrong?
A thing that I have tested was openning the Xamarin project directly in Mac with Xamarin Studio, build it and run the simulator. It works.
I have seen other similar question, but I think that it doesn't have the same problem.
EDIT:
More specific information about the error when I try to compile/debug:
Could not authenticate the user using the existing ssh keys Xamarin.Messaging.VisualStudio.MessagingAuthenticationException: Could not authenticate the user using the existing ssh keys ---> Renci.SshNet.Common.SshAuthenticationException: Permission denied (publickey). en Renci.SshNet.ClientAuthentication.Authenticate(IConnectionInfoInternal connectionInfo, ISession session) en Renci.SshNet.ConnectionInfo.Authenticate(ISession session) en Renci.SshNet.Session.Connect() en Renci.SshNet.BaseClient.Connect() en Xamarin.Messaging.VisualStudio.MessagingService.d__70.MoveNext() --- Fin del seguimiento de la pila de la excepción interna ---
EDIT 2:
I have revised the troubleshooting Xamarin page, specifically that it says "Unable to authenticate with SSH keys. Please try to log in with credentials first".
I have run:
chmod og-w "$HOME" grep sshd /var/log/system.log > "$HOME/Desktop/sshd.log" cd Desktop cat sshd.log
And the content of the file is:
Apr 18 09:23:28 Macs-Mac-mini sshd[769]: Authentication refused: bad ownership or modes for directory /Users/macmini2/.ssh Apr 18 09:25:27 Macs-Mac-mini com.apple.xpc.launchd[1] (com.openssh.sshd.EE9A94ED-????-....-????-77254934B300[769]): Service exited with abnormal code: 1 Apr 18 09:59:39 Macs-Mac-mini sshd[1036]: Accepted keyboard-interactive/pam for macmini2 from 192.168.54.14 port 60413 ssh2 Apr 18 09:59:39 Macs-Mac-mini sshd: macmini2 [priv][1036]: USER_PROCESS: 1040 ttys000
But now I don't know what I have to do to solve it.
Answer by valdetero for I can't connect to Mac with Xamarin Mac Agent from Visual Studio 2015
Did you turn on remote login and that is the user/login that is currently logged into the machine? Also, have you tried connecting directly to the IP address instead of the DNS name?
I am on a client's network (different domain than mine) and my VS would never connect via the computer name. I always had to type in the IP address. Also, watch the out put for "Xamarin" in the Output panel/window and see if it gives any more helpful information.
Answer by Marakai for I can't connect to Mac with Xamarin Mac Agent from Visual Studio 2015
Xamarin has a Troubleshooting page with large focus on SSH issues:
Specifically
Log File Location
Mac ? ~/Library/Logs/Xamarin-[MAJOR.MINOR] Windows ? %LOCALAPPDATA%\Xamarin\Logs
The log files can be located by browsing to Help > Xamarin > Zip Logs in Visual Studio.
"Unable to authenticate with SSH keys. Please try to log in with credentials first"
Known cause:
SSH security restriction ? This message most often means that one of the files or directories in the fully qualified path of $HOME/.ssh/authorized_keys on the Mac has write permissions enabled for other or group members. Common fix: Run chmod og-w "$HOME" in a Terminal command prompt on the Mac. For details about which particular file or directory is causing the problem, run grep sshd /var/log/system.log > "$HOME/Desktop/sshd.log" in Terminal, and then open the sshd.log file from your Desktop and look for "Authentication refused: bad ownership or modes".
Furthermore there is this section, which does not directly match the error you are seeing but goes into some detail on SSH configuration and diagnosis:
"Couldn't connect to MacBuildHost.local. Please try again."
Reported causes:
Bug ? A few users have seen this error message when attempting to log in to the build host using an Active Directory domain user account. Bug ? Some users have seen this error when attempting to connect to the build host by double-clicking the name of the Mac in the connection dialog. Possible workaround: Manually add the Mac using the IP address. Bug #35971 ? Some users have run across this error when using a wireless network connection between the Mac build host and Windows. Possible workaround: Move both computers to a wired network connection. Bug #36642 ? On Xamarin 4.0, this message will appear anytime the $HOME/.bashrc file on the Mac contains an error. (Starting with Xamarin 4.1, errors in the .bashrc file will no longer affect the connection process.) Workaround: Move the .bashrc file to a backup location (or delete it if you know you don't need it). Limitation ? This error can appear if the Mac build host is connected to a router that has no access to the internet (or if the Mac is using a DNS server that times out when asked for the reverse-DNS lookup of the Windows computer). Visual Studio will take roughly 30 seconds to retrieve the SSH fingerprint and eventually fail to connect. Possible workaround: Add "UseDNS no" to the sshd_config file. Be sure to read about this SSH setting before changing it. See for example http://unix.stackexchange.com/questions/56941/what-is-the-point-of-sshd-usedns-option. The following steps describe one way to change the setting. You will need to be logged in to an administrator account on the Mac to complete the steps. Confirm the location of the sshd_config file by running ls /etc/ssh/sshd_config and ls /etc/sshd_config in a Terminal command prompt. For all of the remaining steps, be sure to use the location that does not return "No such file or directory". Run cp /etc/ssh/sshd_config "$HOME/Desktop/" in Terminal to copy the file to your desktop. Open the file from your Desktop in a text editor. For example you can run open -a TextEdit "$HOME/Desktop/sshd_config" in Terminal. Add the following line at the bottom of the file: UseDNS no Remove any lines that say UseDNS yes to make sure the new setting takes effect. Save the file. Run sudo cp "$HOME/Desktop/sshd_config" /etc/ssh/sshd_config in Terminal to copy the edited file back into place. Enter your password if prompted. Disable and re-enable Remote Login under System Preferences > Sharing > Remote Login to restart the SSH server.
Answer by Dmytro Bondarenko for I can't connect to Mac with Xamarin Mac Agent from Visual Studio 2015
You have to try delete everything from
%localappdata%\Xamarin\MonoTouch.
It helped me, I had the same (or similar) problem today.
Answer by stivex for I can't connect to Mac with Xamarin Mac Agent from Visual Studio 2015
I have found the solution about my problem. I have done the following steps:
- In my Windows: I have removed the content from "%localappdata%\Xamarin\MonoTouch."
- In Mac terminal: Remove the authorized_keys Mac file ("rm /Users/macmini2/.ssh/authorized_keys" in my case)
- In Mac terminal: chmod g-w /Users/macmini2/
- In Mac terminal: chmod 700 /Users/macmini2/.ssh/
- In Mac terminal: Create a empty file: /Users/macmini2/.ssh/authorized_keys (with vim, for example)
- In Mac terminal: chmod 600 /Users/macmini2/.ssh/authorized_keys
- On Visual Studio: Login with Xamarin Mac Agent
- On Visual Studio: Run the application with [Debug] - [iPhoneSimulator] - [iPhone 5 iOS 8.1]
- And finally, the simulator runs on Mac computer.
This link helped me.
Answer by brheal for I can't connect to Mac with Xamarin Mac Agent from Visual Studio 2015
For what it's worth I just solved this issue by checking the logs as noted above and in the Xamarin Troubleshooting docs. It turned out to be mismatched iOS versions. Once I updated the Mac version it worked.
Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72
All your hard about curating this informative post on Xamarin Developer advice on I can't connect to Mac with Xamarin Mac Agent from Visual Studio 2015 is much appreciated.
ReplyDelete