kernel_require.rb:55:in `require': cannot load such file -- fog (LoadError : Unable to execute the ruby script as sudo user.

509 views
Skip to first unread message

sreenivas narayan

unread,
Feb 8, 2017, 9:47:44 AM2/8/17
to ruby-fog
Hello Guys,

I an using a ruby script which uses fog and json for restarting ec2 instance. While executing it as root it is working. The script is executed using ansible playbook.

===
TASK [Executing restart-bash script] *******************************************
fatal: [13.55.124.190 -> localhost]: FAILED! => {"changed": true, "cmd": "/bin/sh /restart-bash.sh", "delta": "0:00:00.346201", "end": "2017-02-07 21:23:05.266766", "failed": true, "rc": 1, "start": "2017-02-07 21:23:04.920565", "stderr": "/usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- fog (LoadError)\n\tfrom /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'\n\tfrom /restart.rb:5:in `<main>'", "stdout": "", "stdout_lines": [], "warnings": []}
        to retry, use: --limit @main.retry
===

Thanks
Sreenivas

geemus (Wesley Beary)

unread,
Feb 8, 2017, 10:22:40 AM2/8/17
to ruby...@googlegroups.com
Is it possible that it was installed as root and is now run as non-root (such that permissions don't allow fog to be loaded)? Otherwise I'm not sure from this what might be awry.
wes

--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Frederick Cheung

unread,
Feb 8, 2017, 10:40:07 AM2/8/17
to ruby...@googlegroups.com, geemus (Wesley Beary)
Another one would be if root isn't setup to use rvm, and so fog was installed for a different ruby

Fred
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+u...@googlegroups.com.

sreenivas narayan

unread,
Feb 18, 2017, 11:36:56 AM2/18/17
to ruby-fog, gee...@gmail.com
Hello Guys,

I have installed ruby as a user. Still getting same error. 

---

 FAILED! => {"changed": true, "cmd": "/bin/sh /tmp/ansible/restart-saas-backup/files/restart-bash.sh", "delta": "0:00:00.006070", "end": "2017-02-18 08:31:10.772133", "failed": true, "rc": 127, "start": "2017-02-18 08:31:10.766063", "stderr": "restart-bash.sh: line 7: /usr/local/rvm/rubies/ruby-2.1.0/bin/ruby: No such file or directory", "stdout": "", "stdout_lines": [], "warnings": []}
        to retry, use: --limit @main.retry

----




On Wednesday, 8 February 2017 21:10:07 UTC+5:30, Frederick Cheung wrote:
Another one would be if root isn't setup to use rvm, and so fog was installed for a different ruby

Fred

On 8 February 2017 at 15:22:40, geemus (Wesley Beary) (gee...@gmail.com) wrote:

Is it possible that it was installed as root and is now run as non-root (such that permissions don't allow fog to be loaded)? Otherwise I'm not sure from this what might be awry.
wes
On Tue, Feb 7, 2017 at 11:34 PM, sreenivas narayan <narayansr...@gmail.com> wrote:
Hello Guys,

I an using a ruby script which uses fog and json for restarting ec2 instance. While executing it as root it is working. The script is executed using ansible playbook.

===
TASK [Executing restart-bash script] *******************************************
fatal: [13.55.124.190 -> localhost]: FAILED! => {"changed": true, "cmd": "/bin/sh /restart-bash.sh", "delta": "0:00:00.346201", "end": "2017-02-07 21:23:05.266766", "failed": true, "rc": 1, "start": "2017-02-07 21:23:04.920565", "stderr": "/usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- fog (LoadError)\n\tfrom /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'\n\tfrom /restart.rb:5:in `<main>'", "stdout": "", "stdout_lines": [], "warnings": []}
        to retry, use: --limit @main.retry
===

Thanks
Sreenivas
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sreenivas narayan

unread,
Feb 18, 2017, 11:37:40 AM2/18/17
to ruby-fog, gee...@gmail.com
Also the user has sudo full access
Reply all
Reply to author
Forward
0 new messages