Custom Dokku/Heroku buildpack can't install gems(Permission denied) - ruby

When my custom buildpack runs it always fails to install gems manually(gem install foo) because it does not have access to the /var/lib/gems directory.
Error being thrown:
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems
Is there something I have to setup so my buildpack can install gems like this?
Information:
- Server => Ubuntu 14.04 DigitalOcean Dokku image(Latest)
- Custom Buildpack => Noah-Huppert/buildpack-rack

Try this:
sudo chown -R $USER "/var/lib/gems" or
chmod -R 0777 /var/lib/gems
if you're comfortable with giving all users on the box read/write permissions.

Related

permission #rb_sysopen error during install of the searchkick gem for my ruby on rails application

I am installing the searchkick gem to enable search capacilities on my application, but when running brew services start opensearch to start opensearch I get the following error: Error: Permission denied # rb_sysopen - /Users//Library/LaunchAgents/homebrew.mxcl.opensearch.plist.
I have tried this line of code: sudo chown -R "$*<My-Username>*":admin /Library/LaunchAgents/ (source), but it did not work.
Could someone help me with this?
I am using a mac with an intel processor (i5)
sudo chmod a+rw /Users/USERNAME/Library/LaunchAgents fixed the issue for me!
Source of code

Gitlab-Runner doesn't have sudo access on OSX

I have installed gitlab-runner on a new OSX device. My runner is register and launch correctly.
But when i start a job, I have this error
sudo gem install fastlane
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
What can I do avoid this error and let gitlab-runner have sudo access to execute anything ?
Most probably you granted the sudo permission to your gitlab-runner user, but you did not remove the password restriction for sudo for the gitlab-runner user. Here you can find how to do it.
However I would not recommend using sudo. You could use Bundler and then install fastlane with bundler for this project and not globally.
gem install bundler -> you will get a Gemfile for the current directory (root of the project)
put gem "fastlane" into the Gemfile
install it with bundle install (you can run this command with your gitlab-runner user in jobs)
For running fastlane lanes use: bundle exec fastlane <name_of_the_lane>.

Jetstream laravel on ubuntu 20.04

how can I create laravel project with jetstream on ubuntu 20.04. On their official page I need to run this command:
composer require laravel/jetstream
Before this I configured environment for laravel and got installed laravel installer globally. After I run this command to get jetstream it says:
[ErrorException] file_put_contents(./composer.json): failed to open stream: Permission denied
I have tried something like:
sudo chown -R $USER ~/.composer/
and
sudo chown -R user ~/.composer/
But then I get this:
No such file or directory
Did you try running it wirh root rights?
sudo composer require laravel/jetstream

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
Lain suggested to try to install the bundles into another sub directory. When that worked out, it became clear the problem was about permissions in the current directory.
Executing chown -R gitlab:gitlab . has solved the problem.
In the gitlab installation guide there is a gem install command preceding our story that was ran as root and probably the gemfile or some other file had permissions change during that.
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/
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
Make sure your Gemfile.lock is owned by the user running the command
Although Alex's answer is correct,this worked for me as well
sudo chown -R git:git /path/to/external/volume
I'm using Digital Ocean's Gitlab Image

How do I resolve a permission error installing a custom built gem?

I'm attempting to build my first ruby gem and all seemed to go well until I attempted to install the gem. I'm using RVM so no need for 'sudo gem install' here.
First I attempted to do the following:
jim:~/Desktop/spectest \ [git:master]
→ rake manifest
(in /Users/jim/Desktop/spectest)
Cleaning
- pkg
rm -rf pkg
Building Manifest
Manifest
README
Rakefile
bin/buildcss
...
jim:~/Desktop/spectest \ [git:master]
→ rake install
(in /Users/jim/Desktop/spectest)
Cleaning
Gemspec generated
mkdir -p pkg
mkdir -p pkg/css-reader-0.1.0
rm -f pkg/css-reader-0.1.0/Manifest
...
cd pkg
tar zcvf css-reader-0.1.0.tar.gz css-reader-0.1.0
a css-reader-0.1.0
a css-reader-0.1.0/bin
...
cd -
WARNING: description and summary are identical
Successfully built RubyGem
Name: css-reader
Version: 0.1.0
File: css-reader-0.1.0.gem
mv css-reader-0.1.0.gem pkg/css-reader-0.1.0.gem
Private key not found; gem will not be signed.
Targeting "ruby" platform.
Password:
Sorry, try again.
Password:
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d css-reader`
Successfully installed css-reader-0.1.0
1 gem installed
Installing ri documentation for css-reader-0.1.0...
Updating class cache with 3288 classes...
Installing RDoc documentation for css-reader-0.1.0...
Ok - so I wasn't certain why I got the Gem::InstallError here. Is there a log ruby gems keeps that I can find more details regarding the error? Either way I attempted to try installing the .gem package directly:
gem install pkg/css-reader-0.1.0.gem
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/jim/.rvm/gems/ruby-1.9.2-preview1/gems/css-reader-0.1.0/Manifest
And I get a bit more feedback. This time it looks like a permissions error with the Manifest file. So I attempted to chmod 777 the Manifest file and repeat the process all over again but I keep getting the error. Seems like a novice mistake somewhere on my behalf. Any advice is appreciated!
It is possible at some stage that you had something run with sudo which messed up your permisisons. Have you tried chown -R jim ~/.rvm
I solved the problem changing the ~/.gem permissions:
sudo chown user ~/.gem -R
right on. solved a similar problem. i had ~/.gem directory locked down for some reason while switching between sudo and such. Thanks!

Resources