Discussion:
kernel_require.rb:55:in `require': cannot load such file -- fog (LoadError : Unable to execute the ruby script as sudo user.
sreenivas narayan
2017-02-08 05:34:44 UTC
Permalink
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
geemus (Wesley Beary)
2017-02-08 15:22:38 UTC
Permalink
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 <
Post by sreenivas narayan
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] ******************************
*************
"/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
[]}
===
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
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Frederick Cheung
2017-02-08 15:40:04 UTC
Permalink
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) (***@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 <***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
sreenivas narayan
2017-02-18 16:36:56 UTC
Permalink
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

----
Post by Frederick Cheung
Another one would be if root isn't setup to use rvm, and so fog was
installed for a different ruby
Fred
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
Post by sreenivas narayan
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]
*******************************************
"/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
"/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
[], "warnings": []}
===
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
For more options, visit https://groups.google.com/d/optout.
--
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
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
sreenivas narayan
2017-02-18 16:37:40 UTC
Permalink
Also the user has sudo full access
Post by sreenivas narayan
Hello Guys,
I have installed ruby as a user. Still getting same error.
---
FAILED! => {"changed": true, "cmd": "/bin/sh
"0:00:00.006070", "end": "2017-02-18 08:31:10.772133", "failed": true,
"restart-bash.sh: line 7: /usr/local/rvm/rubies/ruby-2.1.0/bin/ruby: No
such file or directory", "stdout": "", "stdout_lines": [], "warnings": []}
----
Post by Frederick Cheung
Another one would be if root isn't setup to use rvm, and so fog was
installed for a different ruby
Fred
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 <
Post by sreenivas narayan
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]
*******************************************
"/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
"/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
[], "warnings": []}
===
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
For more options, visit https://groups.google.com/d/optout.
--
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
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...