The git user is unable to execute bundle during GitLab installation - bash

I am trying to install GitLab on a Debian Wheezy and experiencing an issue I don't understand.
Following the install guide for version 5.0:
step 1: was run as explained
step 2: I used rvm (multi-user install) instead (ruby-1.9.3-p392)
steps 3 to 5: were run as explained (MySQL chosen)
step 6: everything works fine until the "Install Gems" section, where I get the following error:
/home/git/gitlab$ sudo -u git -H bundle install --deployment --without development test postgres
sudo: unable to execute /usr/local/bin/bundle: No such file or directory
I run this as my normal user (in the sudo and rvm groups), and the git user is not a sudoer.
I think that the line sudo gem install bundler, in step 2, does not grant the git user to execute bundle properly, but I don't know how to fix this.
I probably did something wrong but cannot figure out what it is, as I tried to respect the standard instructions as close as possible.
Any clue about this? Thanks, I am losing hope...
For information, I have written to the GitLab mailing-list about this problem but did not get any answer. Moreover, last time I asked something similar on ServerFault, I have been advised to post on StackOverflow instead... hence this question :)

When I do $ which bundle, I get /usr/local/rvm/gems/ruby-1.9.3-p392/bin/bundle.
The git user has been created with the --disabled-login flag and thus I cannot login as git to run bundle.
When I do $ sudo -u git bundle, I get
sudo: unable to execute /usr/local/bin/bundle: No such file or directory
That means git user has not /usr/local/rvm/gems/ruby-1.9.3-p392/bin in its PATH, and you cannot modify its .profile or .bashrc because of the --disabled-login flag.
It seems that running sudo -i -u git bundle instead of sudo -u git bundle does the trick
That is the safest route, and will execute the command as git, but will simulate first an initial login, using the PATH defined in .profile and .bashrc of user root.
See "How does sudo search the path for executable?" for more.

On my local machine after upgrade from 6.4 to 7.7 I had such issue.
The compilation of ruby was made under root account.
So need permissions to read compiled ruby and installed bundle.
chmod ugo+rx /usr/local/bin/bundle
chmod -R ugo+rX /usr/local/lib/ruby/
In production mode You could be more strict.

Related

solana install on Ubuntu - where is it installed to?

I tried to follow steps both
a. https://docs.solana.com/cli/install-solana-cli-tools
(base) xxx#xxx:~/dev/nft/metaplex/metaplex/js/packages/cli$ sudo sh -c "$(curl -sSfL https://release.solana.com/v1.8.1/install)"
[sudo] password for xxx:
downloading v1.8.1 installer
Install is up to date.
1.8.1 is the latest compatible release
Please update your PATH environment variable to include the solana programs:
PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
I updated $PATH, but no joy. I got no installation error but command prompt can't find solana.
b. I then also tried steps here
https://snapcraft.io/install/solana/ubuntu#install
(base) xxx#xxx:~/.local/share$ sudo snap install solana --beta --devmode
solana (beta) 0+git.ca12fac from Michael Vines (mvines) installed
(base) xxx#xxx~/.local/share$ solana --version
solana: command not found
Where was solana installed to actually? I can't find it.
Typically, the setup script that you ran in the first step installs the solana CLI in $HOME/.local/share/solana/install/active_release/bin/ and then adds it to your PATH in $HOME/.profile.
As an easy fix, you can logout and log back in to pick up the change.
I think the issue comes from that you updated the $PATH variable in wrong location.
In many cases, we have two options /home/[username]/.bashrc and /home/[username]/.profile to update the $PATH variable.
When I was installing solana tool suite, I updated the /home/[username]/.profile.
In other word, I inserted export PATH="/home/[username]/.local/share/solana/install/active_release/bin:$PATH" at the end of .profile.
And it worked.
I think you should try this way if you didn't yet.
About the options of terminals(bash, etc) and $PATH variable, I recommend to take a look at Where is PATH variable set in Ubuntu?

"You don't have [PATH ]in your PATH, gem executables will not run." while using "gem install --user-install bundler"

I was trying to install jekyll in my Mac and got the warning as following:
WARNING: You don't have /Users/Carrot/.gem/ruby/2.3.0/bin in
your PATH, gem executables will not run.
I checked through gem list and it shows it is installed; and I can find the jekyll through the path "/Users/Carrot/.gem/ruby/2.3.0/bin". I read a post which seems like my situation. I would like to know if it's a must to go through sudo? I now prefer to uninstall everything (since it also installed sass and bunch of things at the same time) and go through homebrew. How can I do the uninstallation?
Many thanks!
For those who have problems with #lamech-desai answer, (actually, when they do Desai's commands, it apparently works temporarily for them).
So you can easily do these:
open ~/.bshrc if you would like to use bash or ~/.zshrc if your are using zsh or etc...
$ sudo nano .bashrc ## bash users
$ sudo nano .zshrc ## zsh users
then copy and past these two lines of code at the end of the .*rc file:
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
export PATH="$PATH:$GEM_HOME/bin"
then simply press ctrl+s and ctrl+x. This will save the changes to .bashrc but you won't see them immediately - directly on your next shell login with your current user. One way to see the changes immediately is to switch user to root with su root and then switch back to your previous user with su <username> - and voila, your .bashrc will be reloaded. You can also check this with echo $PATH.
Thanks to #lamech-desai for great answer
If you are using arch linux just use the commands below in your terminal
[user~]$ export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
[user~]$ export PATH="$PATH:$GEM_HOME/bin"
[user~]$ gem list
[user~]$ gem update
You need to add the directory to your PATH environment variable
https://askubuntu.com/questions/406643/warning-you-dont-have-a-directory-in-your-path-gem-executables-will-not-run
If you are on a Mac like me, you need to add the PATH to the PATH environmental variable. You can do it with export command:
export PATH="/Users/Carrot/.gem/ruby/2.3.0/bin:$PATH"
If you wanna know more about this process, here is a blog post about this: Adding a Path to the Linux PATH Variable
Probably a bit odd to answer my own question but I did finally fix it somehow like a blind fly. I hope to write down the experience maybe who else is totally like me as a absolute beginner with everything wouldn't get struggling overnight.
Stage 1: from gem to homebrew (failed)
At the beginning, I did remove items that install in gem item-by-item, then I install brew-gem to do it. At some stage, it work for jekyll but not my theme. It kept popping out I didn't install a package that the theme needs even I installed it manually. So in the end, I remove everything related to jekyll from homebrew.
Stage 2: back to gem (very long path but finally made it)
I later found a page tell step-by-step to install jekyll. I am using OSX 10.13 (High Sierra) that cause me the permission problem. So I just granted access with this line:
sudo chown -R $(whoami) /usr/local/*
The * is a must or it won't work. I did the same to the ruby part
sudo chown -R $(whoami) /Library/Ruby/Gems/2.3.0/*
After that I install jekyll and bundler carefully following the instruction. And install the packages that the theme needs manually through gem install, which you can find at the Gemfile. I got the problem of jekyll-sitemap similar as this, I followed the method to install pygment.rb through gem install pygments.rb. And now my site is locally work.

Unable to Install postgresql on my mac os x machine via homebrew

I was trying to install the postgres through terminal on mac os. I used homebrew to install the postgres.
During the install I got following error
"Error: The brew link step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man3/SPI_connect.3"
I also got error regarding initdb
"initdb: file "/usr/local/share/postgresql/postgres.bki" does not exist
This might mean you have a corrupted installation or identified
the wrong directory with the invocation option -L.
Warning: The post-install step did not complete successfully
You can try again using brew postinstall postgresql"
After the install I am not able to run any of postgres commands. I would really appreciate any help as I am new to postgres. Please, provide little explanation.
Thank You!
Not sure if this solution is the best, but so far this is the only one.
Note: I did this on a macOS environment
I have chowned the directory I wasn't allowed to write. (chown -R user/usr/local/lib/pkgconfig)
/usr/local/lib/pkgconfig` (assumed that dir should be mine anyway - since it's within /usr/local)
I ran
brew link postgres - so the links required are there
Then initdb /usr/local/var/postgres -E utf8 worked perfectly.
Running brew postinstall postgres --debug gives:
Errno::EACCES: Permission denied # dir_s_mkdir - /usr/local/var/postgres
Creating the directory manually and setting the right group worked:
cd /usr/local/var
sudo mkdir postgres
sudo chown <user> postgres
sudo chgrp admin postgres/

meteorite error Cloning Mac

This is the error I keep getting when I try to run meteorite
$ mrt
Stand back while Meteorite does its thing
✓ router
tag: https://github.com/tmeasday/meteor-router.git#v0.5.3
/usr/local/lib/node_modules/meteorite/lib/sources/git.js:108
throw "There was a problem cloning repo: " + self.url;
^
There was a problem cloning repo: https://github.com/tmeasday/meteor-router.git
I've tried sudo -H npm install -g meteorite
I've installed and reinstalled it a bunch of times
I have git installed, I have Xcode installed, I have Homebrew installed and I have meteor.
All of those work.
This is my $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
This is which Git
/usr/local/bin/git
This is which mrt
/usr/local/bin/mrt
Not sure if this is relevant but I have two drives in my Mac one that has the user folder and the other that has system files.
Any help? I'm a unix newb so please be very clear on solutions. Thanks
Found the Error, make sure the Volume name has no SPACES. Mine had a few spaces and Meteorite git.js doesn't account for that. Just rename the Volume with no SPACES and it should work.
try running it as root:
$ sudo mrt
I always have to do this when using Meteorite to bundle on remote machines.
You might also need to create a symbolic link on mrt..
$ ln -s /usr/local/bin/mrt /usr/bin/mrt
It might be solved already, but I had the same error.
It turned out that Apple wanted me to agree on Terms, which I found out after running:
git --version
I had to run this as a administrator
sudo git --version
And agree upon the long list of Apple Terms. Afterwards my meteorite (and GIT for that matter) was running like a charm again.

Trying to install git on OSX: cannont exec 'git-credential-osxkeychain': Permission denied`

I'm attempting to install Git on my new MBP and am following the documentation # https://help.github.com/articles/set-up-git.
I seem to have hit a snag at the point where it says : If you do not have the helper, you can download it and copy it to /usr/local/bin
I navigated to /usr/local/bin in terminal and did a sudo wget [link to osxkeychain]. When I try to do a git config --global credential.helper osxkeychain I get a fatal: cannont exec 'git-credential-osxkeychain': Permission denied.
What did I do wrong?
Thanks!
Tre
Download the git-credential-osxkeychain file to your desktop(!).
Open the Terminal application.
Type in the following:
sudo cp ~/Desktop/git-credential-osxkeychain /usr/local/bin/git-credential-osxkeychain
sudo chmod 755 /usr/local/bin/git-credential-osxkeychain
sudo git config --global credential.helper osxkeychain
Test it with:
sudo git credential-osxkeychain
See the sudo prefix? It seems to be required for the credential stuff... It should now output Usage: git credential-osxkeychain <get|store|erase>
Make the downloaded file executable:
chmod 755 git-credential-osxkeychain
Homebrew's git package sets this up; just:
brew install git
and you're away.
Tried sudo?
/usr/bin is protected. Or you could try downloading git executables somewhere on your laptop and add that location to your PATH.
One of the common mistakes made by people starting on git is that they have the wrong executable for the operating system.
Please make sure that when you go to git help setup page you click on the right link
for example the following link has MAC | WINDOWS | LINUX | ALL options in the top of the page which is small enough to be ignored by many.
https://help.github.com/articles/set-up-git
This has happened to many of my team member to install osx for ubuntu and end up getting the error mentioned above

Resources