I've installed the GraphicsMagick
and the gem on the local machine which runs the rails server, and it worked well. However, on the dev server, the environment is setup using Passenger
and Apache
. I've installed the GraphicsMagick
and did a bundle install
. It did install the gem successfully.
However, when I access the site, I am getting the following error:
There was an error while trying to load the gem 'graphicsmagick'.
Gem Load Error is: Permission denied @ rb_sysopen - mkmf.log
Backtrace for gem load error is:
/home/ubuntu/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/mkmf.rb:308:in `initialize'
/home/ubuntu/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/mkmf.rb:308:in `open'
/home/ubuntu/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/mkmf.rb:308:in `log_open'
/home/ubuntu/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/mkmf.rb:317:in `open'
/home/ubuntu/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
/home/ubuntu/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
/home/ubuntu/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/mkmf.rb:1574:in `find_executable'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/graphicsmagick-1.0.5/lib/graphicsmagick.rb:8:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `require'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'
/home/ubuntu/AdvanceX/backend/config/application.rb:7:in `<top (required)>'
/home/ubuntu/AdvanceX/backend/config/environment.rb:2:in `require'
/home/ubuntu/AdvanceX/backend/config/environment.rb:2:in `<top (required)>'
config.ru:3:in `require'
config.ru:3:in `block in <main>'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
Bundler Error Backtrace:
(Bundler::GemRequireError)
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'
/home/ubuntu/AdvanceX/backend/config/application.rb:7:in `<top (required)>'
/home/ubuntu/AdvanceX/backend/config/environment.rb:2:in `require'
/home/ubuntu/AdvanceX/backend/config/environment.rb:2:in `<top (required)>'
config.ru:3:in `require'
config.ru:3:in `block in <main>'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
/home/ubuntu/.rvm/gems/ruby-2.3.3/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'
Any idea why this is happening?
The problem was that the user running the app didn't have sufficient permission
to run find_executable
nor write access to create the mkmf.log
log file.
Adding a usergroup
with sufficient access to the user solved the issue.