Remote SDK with Vagrant + RVM -> No gems listed ("Nothing to show")

I see from other threads that as of Jan 2016 RVM was not supported in Vagrant Remote SDK context, is it supported now?

I am running a freshly installed RubyMine 2016.3 on Mac OS Sierra, and Vagrant with Ubuntu + RVM. 

RubyMine 2016.3
Build #RM-163.7743.60, built on November 28, 2016
JRE: 1.8.0_112-release-408-b2 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

What I am experiencing is that the connection to Vagrant seems to work well, but no gems are fetched, despite the fact that the process completes successfully and I can see the remote SDK in the list under "Remote-rvm:ruby-2.2.5-p319" (vagrant://<dir>)".

Additionally, it seems not possible to remove the Remote SDK from the list - it seems to be removed, but on next program restart reappears again, so that every attempted addition remote SDK is listed there now (mine has ten "Remote-rvm:..." entries there now).

Relevant idea.log portion:

>> 


2016-12-11 12:56:00,805 [12945878] INFO - ns.plugins.remotesdk.RSyncUtil - rsync version: rsync version 2.6.9 protocol version 29
2016-12-11 12:56:07,270 [12952343] INFO - ns.plugins.remotesdk.RSyncUtil - rsync version: rsync version 2.6.9 protocol version 29
2016-12-11 12:56:12,292 [12957365] INFO - e.RemoteSdkCredentialsProducer - Updating credentials for VagrantBasedCredentialsHolder{myVagrantFolder='<dir>', myMachineName='null'}
2016-12-11 12:56:12,293 [12957366] INFO - e.RemoteSdkCredentialsProducer - Credentials for VagrantBasedCredentialsHolder{myVagrantFolder='<dir>', myMachineName='null'} found in cache.
2016-12-11 12:56:12,373 [12957446] INFO - e.RemoteSdkCredentialsProducer - Credentials for VagrantBasedCredentialsHolder{myVagrantFolder='<dir>', myMachineName='null'} found in cache.
2016-12-11 12:56:12,389 [12957462] INFO - esdk.transport.JschExecProcess - Executing ssh command: env "JETBRAINS_REMOTE_RUN"="1" "ANSICON"="" "LANG"="en_US.UTF-8" "PATH"="/usr/local/bin:$PATH" "RM_INFO"="RM-163.7743.60" /home/deploy/.rvm/rubies/ruby-2.2.5/bin/ruby -v for ubuntu@127.0.0.1:2222
2016-12-11 12:56:12,523 [12957596] INFO - esdk.transport.JschExecProcess - Executing ssh command: env "JETBRAINS_REMOTE_RUN"="1" "ANSICON"="" "LANG"="en_US.UTF-8" "PATH"="/usr/local/bin:$PATH" "RM_INFO"="RM-163.7743.60" /home/deploy/.rvm/rubies/ruby-2.2.5/bin/ruby -e "print(defined?(RUBY_PATCHLEVEL) ? RUBY_PATCHLEVEL : 0)" for ubuntu@127.0.0.1:2222
2016-12-11 12:56:12,641 [12957714] INFO - e.RemoteSdkCredentialsProducer - Credentials for VagrantBasedCredentialsHolder{myVagrantFolder='<dir>', myMachineName='null'} found in cache.
2016-12-11 12:56:12,659 [12957732] INFO - esdk.transport.JschExecProcess - Executing ssh command: env "JETBRAINS_REMOTE_RUN"="1" "ANSICON"="" "LANG"="en_US.UTF-8" "PATH"="/usr/local/bin:$PATH" "RM_INFO"="RM-163.7743.60" /home/deploy/.rvm/rubies/ruby-2.2.5/bin/ruby -e "print(defined?(RUBY_PATCHLEVEL) ? RUBY_PATCHLEVEL : 0)" for ubuntu@127.0.0.1:2222
2016-12-11 12:56:12,791 [12957864] INFO - esdk.transport.JschExecProcess - Executing ssh command: env "JETBRAINS_REMOTE_RUN"="1" "ANSICON"="" "LANG"="en_US.UTF-8" "PATH"="/usr/local/bin:$PATH" "RM_INFO"="RM-163.7743.60" /home/deploy/.rvm/rubies/ruby-2.2.5/bin/ruby -e "print RUBY_VERSION" for ubuntu@127.0.0.1:2222
2016-12-11 12:56:12,922 [12957995] INFO - yCreateRemoteInterpreterDialog - initializing Remote-rvm:ruby-2.2.5-p319: ver.2.2.5p319 ( revision 54774) p319 (vagrant://<dir>/home/deploy/.rvm/rubies/ruby-2.2.5/bin/ruby)
2016-12-11 12:56:12,922 [12957995] INFO - e.RemoteSdkCredentialsProducer - Credentials for VagrantBasedCredentialsHolder{myVagrantFolder='<dir>', myMachineName='null'} found in cache.
2016-12-11 12:56:12,922 [12957995] INFO - ruby.remote.RubyRemoteTransfer - Uploading helpers
2016-12-11 12:56:12,929 [12958002] INFO - ns.plugins.remotesdk.RSyncUtil - rsync version: rsync version 2.6.9 protocol version 29
2016-12-11 12:56:19,984 [12965057] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:56:19,985 [12965058] INFO - ruby.remote.RubyRemoteTransfer - Helpers uploaded
2016-12-11 12:56:19,985 [12965058] INFO - yCreateRemoteInterpreterDialog - localGemsBinPath=/Users/maxr/Library/Caches/RubyMine2016.3/ruby_stubs/-1628550532/368371468, remoteGemsBinPath=/home/deploy/.rvm/rubies/ruby-2.2.5/bin
2016-12-11 12:56:19,986 [12965059] INFO - e.RemoteSdkCredentialsProducer - Credentials for VagrantBasedCredentialsHolder{myVagrantFolder='<dir>', myMachineName='null'} found in cache.
2016-12-11 12:56:20,009 [12965082] INFO - esdk.transport.JschExecProcess - Executing ssh command: env "JETBRAINS_REMOTE_RUN"="1" "ANSICON"="" "LANG"="en_US.UTF-8" "PATH"="/usr/local/bin:$PATH" "RM_INFO"="RM-163.7743.60" /home/deploy/.rvm/rubies/ruby-2.2.5/bin/ruby -v for ubuntu@127.0.0.1:2222
2016-12-11 12:56:20,144 [12965217] INFO - esdk.transport.JschExecProcess - Executing ssh command: env "JETBRAINS_REMOTE_RUN"="1" "ANSICON"="" "LANG"="en_US.UTF-8" "PATH"="/usr/local/bin:$PATH" "RM_INFO"="RM-163.7743.60" /home/deploy/.rvm/rubies/ruby-2.2.5/bin/ruby -e "print(defined?(RUBY_PATCHLEVEL) ? RUBY_PATCHLEVEL : 0)" for ubuntu@127.0.0.1:2222
2016-12-11 12:56:20,261 [12965334] INFO - yCreateRemoteInterpreterDialog - localPath=/Users/maxr/Library/Caches/RubyMine2016.3/ruby_stubs/-1628550532/1876376776/bin, remotePath=/home/deploy/.rvm/gems/ruby-2.2.5/bin
2016-12-11 12:56:20,261 [12965334] INFO - yCreateRemoteInterpreterDialog - localPath=/Users/maxr/Library/Caches/RubyMine2016.3/ruby_stubs/-1628550532/1876376776/gems, remotePath=/home/deploy/.rvm/gems/ruby-2.2.5/gems
2016-12-11 12:56:20,261 [12965334] INFO - yCreateRemoteInterpreterDialog - localPath=/Users/maxr/Library/Caches/RubyMine2016.3/ruby_stubs/-1628550532/1876376776/specifications, remotePath=/home/deploy/.rvm/gems/ruby-2.2.5/specifications
2016-12-11 12:56:20,261 [12965334] INFO - yCreateRemoteInterpreterDialog - localPath=/Users/maxr/Library/Caches/RubyMine2016.3/ruby_stubs/-1628550532/1876376776/bundler, remotePath=/home/deploy/.rvm/gems/ruby-2.2.5/bundler
2016-12-11 12:56:20,261 [12965334] INFO - yCreateRemoteInterpreterDialog - localPath=/Users/maxr/Library/Caches/RubyMine2016.3/ruby_stubs/-1628550532/1043342875/bin, remotePath=/home/deploy/.rvm/gems/ruby-2.2.5@global/bin
2016-12-11 12:56:20,261 [12965334] INFO - yCreateRemoteInterpreterDialog - localPath=/Users/maxr/Library/Caches/RubyMine2016.3/ruby_stubs/-1628550532/1043342875/gems, remotePath=/home/deploy/.rvm/gems/ruby-2.2.5@global/gems
2016-12-11 12:56:20,261 [12965334] INFO - yCreateRemoteInterpreterDialog - localPath=/Users/maxr/Library/Caches/RubyMine2016.3/ruby_stubs/-1628550532/1043342875/specifications, remotePath=/home/deploy/.rvm/gems/ruby-2.2.5@global/specifications
2016-12-11 12:56:20,261 [12965334] INFO - yCreateRemoteInterpreterDialog - localPath=/Users/maxr/Library/Caches/RubyMine2016.3/ruby_stubs/-1628550532/1043342875/bundler, remotePath=/home/deploy/.rvm/gems/ruby-2.2.5@global/bundler
2016-12-11 12:56:20,261 [12965334] INFO - ruby.remote.RubyRemoteTransfer - Updating gems' local copy
2016-12-11 12:56:20,270 [12965343] INFO - ns.plugins.remotesdk.RSyncUtil - rsync version: rsync version 2.6.9 protocol version 29
2016-12-11 12:56:20,279 [12965352] INFO - ns.plugins.remotesdk.RSyncUtil - rsync version: rsync version 2.6.9 protocol version 29
2016-12-11 12:56:25,747 [12970820] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:56:32,733 [12977806] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:56:38,612 [12983685] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:56:45,231 [12990304] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:56:51,663 [12996736] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:56:57,360 [13002433] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:57:03,270 [13008343] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:57:08,318 [13013391] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:57:15,026 [13020099] INFO - ns.plugins.remotesdk.RSyncUtil - RSync exited with code: 12
2016-12-11 12:57:15,026 [13020099] INFO - ruby.remote.RubyRemoteTransfer - Gems copied.
2016-12-11 12:57:15,027 [13020100] INFO - yCreateRemoteInterpreterDialog - Remote-rvm:ruby-2.2.5-p319: ver.2.2.5p319 ( revision 54774) p319 (vagrant://<dir>/home/deploy/.rvm/rubies/ruby-2.2.5/bin/ruby) initialized
2016-12-11 12:57:15,067 [13020140] INFO - pl.ProjectRootManagerComponent - project roots have changed
2016-12-11 12:57:15,232 [13020305] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 18ms; general responsiveness: ok; EDT responsiveness: ok
2016-12-11 12:57:15,235 [13020308] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 2ms; general responsiveness: ok; EDT responsiveness: ok

>>

 

 

9 comments
Comment actions Permalink

The problem was with rsync failure, as you can see in the log above it exited with code 12 (and sometimes with 255 as well). After enabling DEBUG level logs for idea.log and replaying the rsync commands from there, the problem narrowed down to the vagrant ssh-config not being applied (or at least not correctly). My vagrant is configured to use a custom key, vagrant ssh-config returns the following:

Host default
HostName 127.0.0.1
User ubuntu
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile <dir>/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL

In any case, the fix for me at the moment was to simply add my default id_rsa.pub key from .ssh dir to .~/ssh/authorized_keys file in the guest OS's ssh user's home (/home/ubuntu in my case). After this everything started working beautifully.

 

2
Comment actions Permalink

Thank you very much. I had exactly the same problem and it worked perfectly.

0
Comment actions Permalink

I have a similiar problem connecting to docker, but i don´t know how enable the DEBUG log for rsync on idea.log
I search about the debug log configuration option, but im new using rubymine.

¿Can i ask you the command to enable DEBUG log por rsync? 
Thank you 

0
Comment actions Permalink

Took me another 30 mins to find it again :D It was mentioned here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206868445-how-to-trace-the-intelliJ-build-process-?page=1#community_comment_206390505

Try opening your bin/log.xml (for me on Mac OS Sierra it's /Applications/RubyMine.app/Contents/bin/log.xml), and at the bottom change <priority value="INFO"/> to "DEBUG". Then restart RubyMine.

 

0
Comment actions Permalink

Thank your for answer. Fortunately im in the same OS
My problem was with the SSH commands that execute rsync to retrieve the gems. 
It seems that the session that use rsync for download the gems doesn't add the keys used by RubyMine to connect via SSH.
So, i had to add 

ssh-add -A 2>/dev/null;

on my .bash_profile and everything works. 


Remember restart RubyGem to re connect to the container and retrieve the gems

0
Comment actions Permalink

Update to my saga - debugging still didn't work properly for me (it showed Stack Frame is not available for most frames). Finally the problem was that the user configured to be the ssh user in vagrant was not the same user as the app/rvm user in vagrant. This really confused RubyMine. I created a new Remote SDK based on SSH credentials of the app/rvm user and that worked much better.

Another small gotcha - when mapping local/remote paths, do not use soft links as remote path.

0
Comment actions Permalink

Switching away from the vagrant option in the remote sdk to the pure ssh connection fixed it for me (had the same rsync errors). But I had to restart the IDE and make sure the host is not in the ~/.ssh/known_hosts with a wrong fingerprint. Was the case in both 2016.3 and 2017.1 EAP. Not sure if this has to do with the new GemsetUI of 2016.3 in general. To bad this is currently not working correclty. I love this feauture. This should get a ticket (or multipled detailed ones). I would appreciate to help fix this problem.

0
Comment actions Permalink

I've added the vagrant ssh config to ~/.ssh/config

vagrant ssh-config | sed 's/^Host default/Host 127.0.0.1/' >> ~/.ssh/config

 

After that all gems in the virtual machine are properly listed at Ruby SDK and Gems.

Unfortunately, Rails introspection is still not working at all on an up-to-date Macos. On my personal Linux machine it's working fine. Does anyone have an idea why this could be? Do I have to configure Rails support somewhere specific (highlighting level is set up)?

0
Comment actions Permalink

I had a similiar problem. Solved by disabling rsync in Rubymine Registry. Look here

https://www.jetbrains.com/help/ruby/2017.1/faster-gems-downloading-with-rsync.html 

When it's starts downloading gems - cancel, if you don't need local copys )

0

Please sign in to leave a comment.