Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errno::EACCES: Permission denied when installing gems via gitlab

I'm trying to setup gitlab and thus install some gems from another user account using sudo, but I'm constantly getting Permission denied error.

sudo -u gitlab -H bundle install --deployment --without development test postgres

> Using ... ( a lot of successful gems there )
> Using pygments.rb (0.3.2) from https://github.com/gitlabhq/pygments.rb.git (at master) 
> Errno::EACCES: Permission denied - pygments.rb-0.3.2.gem
> An error occurred while installing pygments.rb (0.3.2), and Bundler cannot continue.
> Make sure that `gem install pygments.rb -v '0.3.2'` succeeds before bundling.\



sudo -u gitlab -H gem install pygments.rb -v '0.3.2'

> Successfully installed pygments.rb-0.3.2
> 1 gem installed
> Installing ri documentation for pygments.rb-0.3.2...
> Installing RDoc documentation for pygments.rb-0.3.2...
# no matter how many times I run this command, I always get the same output
# as if the gem installation doesn't stick 


# I've tried to chmod
chmod 777 -R /usr/local/lib/ruby



# then Again
sudo -u gitlab -H bundle install --deployment --without development test postgres
# same result, Errno::EACCES: Permission denied - pygments.rb-0.3.2.gem
like image 611
Alex Avatar asked Dec 25 '12 15:12

Alex


2 Answers

I did the following and got things working.

I changed the permission for the Gemfile. i.e. chmod 755 Gemfile

Then I did a sudo bundle install. This got things working and all the gems got installed. I could then start my app by rails server

like image 164
A1aks Avatar answered Oct 21 '22 12:10

A1aks


This is a permissions bug in ruby-2.0.0-p195 rvm with bundle install

are you using rvm? did you try chmod with sudo?

chmod 755 (or 777) ~/.rvm/gems/ruby-2.0.0-p195/build_info/

like image 32
msroot Avatar answered Oct 21 '22 12:10

msroot