Error when launching AppScale Instances: /usr/bin/ruby: bad interpreter: No such file or directory - ruby

I am trying to launch some AppScale Instances. When I try to execute
/bin/appscale-run-instances
I get an error like this:
-bash: bin/appscale-run-instances: /usr/bin/ruby: bad interpreter: No such file or directory
The Image that I'm trying to run is a KVM image (I'm trying to create a Virtual cluster).
What does this error mean? Is there something wrong with my Ruby installation?

this means that one of these things is happening:
You have a broken Ruby installation
You have more than one Ruby installation
Your installation has not been configured properly.
To identify if this is the first case, you can run ruby and see if you get any response.
If you don't, your installation is broken and you need to reinstall it. If you do, you then run which ruby. This should give you the absolute path to your Ruby executable. If this is anything other than /usr/bin/ruby then homebrew (and a bunch of other programs) will not be able to find it.
In case you have not ever tampered with your Ruby installation, you can check to see if /usr/bin/ruby already exists or not: cat /usr/bin/ruby. If you get No such file or directory, then you can easily create a symbolic link to your Ruby installation. Assuming the output of which ruby to by /usr/local/bin/ruby, you create the symbolic link this way: sudo ln -s /usr/local/bin/ruby /usr/bin/rubyand all should be well.
If there is a file at that location, you can run file /usr/bin/ruby to see if it's a real file, a symbolic link, or a curropted file. If it is a symbolic link, your installation should be working, and since it's not, it probably is either a corrupted symlink or it's a bogus file.
You can remedy that by first deleting it (sudo rm /usr/bin/ruby) and then creating a new symlink to the correct location (sudo ln -s /usr/local/bin/ruby /usr/bin/ruby).
If non of the above works, you should consult the homebrew team after a clean install of Xcode and removing any traces of a Ruby installation on your system.

Related

Installed gems are not running

I am trying to install jekyll.
I run gem install bundler jekyll
After installing gems I run bundle init and get
bash: bundle: command not found
How can I fix it?
You can get a gem's directory using gem which. For example:
$ gem which jekyll
/home/username/.rvm/gems/ruby-2.6.4/gems/jekyll-4.0.0/lib/jekyll.rb
Then append the directory to your PATH:
$ export PATH="$PATH:/home/username/.rvm/gems/ruby-2.6.4:"
The reason why you are getting "command not found" after installing gems is because they were installed in a location that your bash shell does not yet know about. The way the computer looks up commands is by looking at the PATH, which is a list of folders where the computer should look for commands, such as bundle. The previous answer is on the right track, but unfortunately, the gem which command will only tell you about locations that are already in your PATH, which might not include the folder where bundler and jekyll were installed.
The location of the gems depends on how you installed Ruby, so without knowing that, I can't tell you what to put in your PATH. What I can tell you is that what you are experiencing is unfortunately very common, but there is a fix. To avoid needless frustration and to help people like you, I wrote a script that will automatically set up a proper Ruby environment for you, including updating your PATH and everything else that is necessary to be able to install gems and use them right away without getting any errors. Check out the links at the bottom of this answer to learn more about my script.
In the meantime, I can make some guesses and see if I can help. If you installed Ruby with Homebrew, then this should fix it:
Run this command:
echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin:$PATH"' >> ~/.bash_profile
And then quit and restart your terminal. Now you should be able to run bundle init.
If you are reading this and you are not the original poster, you might need to replace .bash_profile in the command above with .zshrc depending on which shell you are using. You can tell by looking at the error. If you are using zsh, it will say zsh: bundle: command not found.
You can read more about my script and other ways to fix the "command not found" error in these articles:
https://www.moncefbelyamani.com/troubleshooting-command-not-found-in-the-terminal/
https://www.moncefbelyamani.com/how-to-install-jekyll-on-a-mac-the-easy-way/
https://www.moncefbelyamani.com/the-definitive-guide-to-installing-ruby-gems-on-a-mac/

linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory

I am having a problem about linuxbrew.
bash: /lustre7/home/lustre4/user1/applications/bin/cut: /lustre7/home/lustre4/user1/.linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory
I tried to uninstall linuxbrew using instructions at its website, but somehow it didn't work (because of sudo requirements).
there is linuxbrew directory but I can't remove when I type rm -r linuxbrew it says;
-bash: /lustre7/home/lustre4/user1/applications/bin/rm: /lustre7/home/lustre4/user1/.linuxbrew/lib/ld.so: bad ELF interpreter: No such file or directory
When I tried to install homebrew it says your CPU is not supported. (I tried this before and it worked, but now it is not working.)
I want to solve this problem but I couldn't find any solution. I am not able to run sudo and yum commands because I am not root. I am a user at a linux cluster.
OK. I finally was able to solve this issue.
I am wring in case someone else may have the same issue.
First, this was related to a bash problem. I recently installed a tool that put some variables to both bashrc and bash_profile and altered path of bin directory.
I wasn't able to use system commands such as rm, ls, cat etc. and I wasn't able to run system ruby. Paths of all commands and ruby were in my bin directory under my application directory.
What I did is;
I edited my bash_profile by cancelling the new path that caused conflict between bash_profile and bashrc. This enabled me run system commands.
I uninstalled linuxbrew as described in its website.
I removed linuxbrew from my home directory, and cancelled its path in bash_profile (comment out).
I installed homebrew again and put its path to my bashrc.
Now it is working.
I could uninstall linuxbrew using the procedure I described in here:
How to completely uninstall brew and re-install brew in ubuntu 19.04
-> In short, I just replaced install.sh by uninstall.sh and it worked...
$/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

killproc command not found error in Ubuntu 12.04

I have a redmine script in /etc/init.d/ folder which was working fine before I broke the ruby and rails packages link. Then I played with ruby gems and finally fixed the broken links. Then I tried to restart redmine script, But strangely, I got the below error
sudo service redmine stop
Shutting down redmine: /etc/init.d/redmine: line 49: killproc: command not found
user#studio:~$ sudo service redmine start
Starting redmine: /etc/init.d/redmine: /usr/local/bin/bundle: /usr/local/bin/ruby: bad interpreter: No such file or directory
/etc/init.d/redmine: line 35: echo_failure: command not found
killproc is part of init.d, so there isn't a missing package at play here. If the process isn't found, it won't run, as well.
However, the next line is more of a red flag. It sounds like your redmine installation is looking for ruby in the incorrect location. This may also be the source of the killproc error as it looks like redmine is not starting up properly.
You can get some more information by running which ruby and comparing that to the path that redmine is looking in. Reinstalling redmine may also resolve the path issue automatically since it sounds like you did a reinstall of rails earlier. Good luck.
My question has two answers, telemark already given answer for my 2nd problem ( ie, I had broken ruby links ). I solved path issues by uninstalling all ruby, rails and gem packages and reinstalled using apt repository. using rvm, chruby, etc everything failed when I switch between users. So I thought of going with the system ruby installation, relying on apt. Fortunately brightbox comes to the rescue.
https://www.brightbox.com/blog/2015/01/05/ruby-2-2-0-packages-for-ubuntu/
Using brightbox and apt solved my path issues.
Then, /etc/init.d/functions, this was missing. It says, No such file or directory. I searched in google and found this link
http://www.linuxfromscratch.org/lfs/view/6.4/scripts/apds02.html
I just copy pasted to /etc/init/functions and given execute permission
sudo chmod a+x /etc/init.d/functions
Thats it!.
UPDATE:
I forgot to mention one important thing, some functions like log_end_message, log_progress_message, etc are not available in functions file. So it's better to include . /lib/lsb/init-functions file.

rvm install on rhel6

ok, so i'm coming from a python virtualenv environment, so please bear with me...
i am trying to install rvm on a non-internet visible machine (ie it doesn't have direct outside access). so
curl -L https://get.rvm.io | bash -s stable --ruby
would not work. no problems i thought, i'll just copy the file over from another machine and do a cat that worked, however, because rvm tries to download the source files directly from the web, it again failed....
so i found that if i put the tarballs under ~/.rvm/archives, i can install rvm as a single user (and take up ~200MB of my home space)... however, i want to install for multiuser for production purposes and use .rvm directories in my project. however, my /usr/local is read only (afs mount).... so rvm fails again.
any ideas? i don't particularly like the idea of having a rvm user and group.
I believe you can supply --path=/opt/rvm to the RVM install script to change the location of a multi-user installation.
I don't believe the RVM group can be changed as it relies on that group to operate correctly.
hmm... so i decided to look at the rvm-install script (ie https://get.rvm.io). basically, it was hardcoded to /usr/local/rvm, so i just changed that to /opt/rvm.
i then also had to add a check for the rvm tarball under the get_and_unpack function:
if [ -e ${rvm_archives_path}/${_file} ]
then
true
elif curl -L ${_url} -o ${rvm_archives_path}/${_file}
then download the file at https://github.com/wayneeseguin/rvm/tarball/master into /opt/rvm/archives/wayneeseguin-rvm-master.tgz
that installed rvm fine into /opt/rvm.
however, logging back in will result in -bash: __rvm_add_to_path: command not found. this is because the profile.d script is hard coded to /usr/local/, so doing a find and replace on /etc/profile.d/rvm.sh to /opt/ did the trick.
however, all the files are still group'd to rvm. which is fine, but another group i have to justify to my unix-admin.

Ruby: RVM Install Error "Could not source..."

A reinstall of RVM produced the following errors when done:
WARNING:
Could not source '/Users/developer/.rvm/scripts/base' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/version' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/selector' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/cd' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/cli' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/override_gem' as file does not exist.
RVM will likely not work as expected.
cat: /Users/developer/.rvm/VERSION: No such file or directory
/Users/developer/.rvm/src/rvm/scripts/rvm: line 133: __rvm_conditionally_add_bin_path: command not found
I reinstalled after I wrestled with trying to get RVM to work with Textmate and RVM behavior became strange (reporting it didn't have gemsets it would list) so I ran:
rvm implode
... and then manually removed the executable. Then I ran the install again by scrupulously following the single user instructions from the home site.
After I spotted the errors, I investigated the paths and found that many files in ~/.rvm/scripts/ and ~/.rvm/src/rvm/scripts/ which obviously should be executable did not have execute permissions.
RVM would not run at all so I set the executable bit on all the files in the two directories and that seems to have fixed things. (So far at least.)
Googling, it seems that other people have hit this problem but there seems to be no explanation or resolution. I would like to find out if this is a known issue and whether I should reinstall yet again.
I'm running rvm 1.6.9 on MacOS X 10.6.7
Yep. If you have installed system-wide it is definitely looking for both the system-wide configuration... and some hard-coded user scripts. Which is weird.
quick fix:
ln -nfs /usr/local/rvm /Users/developer/.rvm
it looks like all you need is to create that missing file.
in your terminal type:
touch /Users/developer/.rvm/scripts/version
touch /Users/developer/.rvm/scripts/base
they are warnings, not errors. I've got similar ones on my ubuntu linux box (but not on another, with same RVM version). so, it's not strctly related to OSX.
your RVM installation should work anyway.

Resources