Open ghost opened 8 years ago
instead of sudo ruby xxx.rb
please run rvmsudo ruby xxx.rb
.
Check out https://rvm.io/integration/sudo for a detailed explanation. sudo
does not pass the session to the script which is why rvmsudo
is needed. Please try that and let me know if it works for you.
I don't know how to use RvmSudo
On Jun 15, 2016, at 1:21 PM, Zshawn Syed notifications@github.com wrote:
instead of sudo ruby xxx.rb please run rvmsudo ruby xxx.rb.
Check out https://rvm.io/integration/sudo for a detailed explanation. sudo does not pass the session to the script which is why rvmsudo is needed. Please try that and let me know if it works for you.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Well, its pretty simple:
rvm install 2.1.0
or if you want latest, rvm install 2.3.0
.rvmsudo ruby xxx.rb
Let me know if your script works after doing the above. It is crucial to run the script via rvmsudo
.
That is simpler than I expected but do I have to reinstall ruby? I have it installed already and it took me forever to re update everything.
I don't believe so, if you wanted to use the system ruby or whichever you have installed already. In that case, simply try running step 1 and step 3.
@riolibrary Did you get your project working?
No :disappointed:
@zsyed91 I tried to run:
rvmsudo ruby xxx.rb
Please help, I have been with this project for a couple months now and would like to finish it
from the few line you posted I can understand that you run with a linux permission issue, which is not specific to PiPiper.
Rasbian requires that gpio are accessed by an user with root privileges (which is not really true with jessy based raspian, but for clarity we will stick to that assomption)
@riolibrary, could you copy/paste an extensive backtrace showing your bug. Also we need to know which ruby you installed and how you did it.
@riolibrary did you ever get this issue resolved? If so, what was the fix?
If not can we try a few things?
sudo -i
which will drop you to a root shell, then as root, execute your ruby xxxx.rb
command.sudo -E ruby xxxx.rb
, the -E
flag tells sudo to "preserve environment". As @zsyed91 points out, it's likely an environment issue. Since you're not using RVM to manage Ruby, I don't think rvmsudo
is the solution though. (Though, if I may ask, why aren't you using RVM?)the user that is invoking sudo must have export rvmsudo_secure_path=0
, and your comment about a secure path error, I would wager that this is not set before running rvmsudo
. Did you set this?Finally, as @elmatou points out, we'll need some more logging to better help you debug. If you can post a full backtrace of your errors it would be immensely helpful.
After doing Sudo ruby xxxx.rb /usr/uibl ruibylgews/1.9.1/ (Errno: :EBUSY) e Device or resource busy /sys/class/gpio/export r from piper-2.0.0/u b:65:in export from /usr/lib/ piper-2.e.e/uib/pi piper/bca283 b:34:in pin input. piper.2.0.0/uib/pi piper/pin.rb: sin initialize from /usr/lib/ruby/gems/1.9.1/gems/pi piper 2.0.0/uib/pi piper.rb115:in from /usr/lib/ruby/gems/1.9.1/gems/pi piper-2,0.0/uib/pi piper,rb1151in new block in Watch
Not completely correct. Sorry😀