Permission denied # dir_s_mkdir (Errno::EACCES) - on application run - ruby-on-rails

I have a ruby web app configured, with all the gems installed etc. It runs fine through my apache server, but now I have to debug something (which I'm still figuring out) and I need to run the rails server -b (ip) -p (port) command.
However I get the following outcome:
=> Booting Thin
=> Rails 4.0.12 application starting in development on http://192.168.39.163:3004
=> Run 'rails server -h' for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:252:in 'mkdir': Permission denied # dir_s_mkdir - /home/vicky/vanerum/tmp/pids (Errno::EACCES)
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:252:in 'fu_mkdir'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:224:in `reverse_each'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:210:in `each'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands/server.rb:71:in `block in start'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands/server.rb:70:in `each'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands/server.rb:70:in `start'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands.rb:71:in `tap'
from /home/vicky/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.0.12/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I've changed ~/.rbenv's owner to myself, I've tried setting the permissions to 775 on that folder. It keeps giving me this error. Any more ideas?

Create a folder in /home/vicky/vanerum/ with name tmp.
For a case, create a folder pids in /home/vicky/vanerum/tmp.
I assume the problem in thin server, it not able to create folder.

Related

Unicorn start up issue

I cant figure out whats wrong with Unicorn, it doesnt want to start up. Any help is appreciated
ubuntu#ip-172-31-15-195:~/www/tf/current$ RAILS_ENV=production bundle exec unicorn_rails -c config/unicorn.rb -D
bundler: failed to load command: unicorn_rails (/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/bin/unicorn_rails)
Errno::EEXIST: File exists # dir_s_mkdir - tmp/pids
/usr/local/lib/ruby/2.3.0/fileutils.rb:254:in `mkdir'
/usr/local/lib/ruby/2.3.0/fileutils.rb:254:in `fu_mkdir'
/usr/local/lib/ruby/2.3.0/fileutils.rb:228:in `block (2 levels) in mkdir_p'
/usr/local/lib/ruby/2.3.0/fileutils.rb:226:in `reverse_each'
/usr/local/lib/ruby/2.3.0/fileutils.rb:226:in `block in mkdir_p'
/usr/local/lib/ruby/2.3.0/fileutils.rb:211:in `each'
/usr/local/lib/ruby/2.3.0/fileutils.rb:211:in `mkdir_p'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/bin/unicorn_rails:202:in `block in <top (required)>'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/lib/unicorn/configurator.rb:80:in `reload'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/lib/unicorn/configurator.rb:65:in `initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:76:in `new'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb:76:in `initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/bin/unicorn_rails:209:in `new'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/gems/unicorn-5.0.1/bin/unicorn_rails:209:in `<top (required)>'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/bin/unicorn_rails:22:in `load'
/home/ubuntu/www/tf/shared/bundle/ruby/2.3.0/bin/unicorn_rails:22:in `<top (required)>'
master failed to start, check stderr log for details
You have symbolic link ~www/tf/current/tmp/pids present but its target directory ~www/tf/shared/pids/ doesn't exist so the link is broken. unicorn is attempting to create tmp/pids directory in the ~www/tf/current/ but the symbolic link which already exists causes failure.
To fix this you need to create ~www/tf/shared/pids/ directory with appropriate ownership and permissions.

While running the server in rails with ubuntu os am getting the following error in my local machine?

=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:245:in mkdir': File exists - /home/rank/rails/chethan/specslot/tmp/pids (Errno::EEXIST)
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:245:infu_mkdir'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:219:in block (2 levels) in mkdir_p'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:217:inreverse_each'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:217:in block in mkdir_p'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:203:ineach'
from /home/rank/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/fileutils.rb:203:in mkdir_p'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands/server.rb:71:inblock in start'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands/server.rb:70:in each'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands/server.rb:70:instart'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands.rb:78:in block in <top (required)>'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands.rb:73:intap'
from /home/rank/.rvm/gems/ruby-2.0.0-p643/gems/railties-4.0.0/lib/rails/commands.rb:73:in <top (required)>'
from bin/rails:4:inrequire'
from bin/rails:4:in `'
Looks like there's another copy of rails server running.
remove /home/rank/rails/chethan/specslot/tmp/pids and try to start server again. Looks like you had emergency shut down your machine recently

Phussion Passenger fails

recently my app stacked and I tried to make some checks.
I run such command through console:
passenger-config --detect-apache2
Got this error.
Detecting configuration file location...
--> /etc/httpd/conf/httpd.conf
Detecting error log file...
/home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache.rb:241:in `initialize': No such file or directory - /etc/httpd/conf/httpd.conf (Errno::ENOENT)
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache.rb:241:in `open'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache.rb:241:in `httpd_actual_error_log'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info.rb:115:in `httpd_actual_error_log'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:148:in `block in detect_one'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:226:in `add_result'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:118:in `detect_one'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:112:in `block in detect_all'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:111:in `each'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/platform_info/apache_detector.rb:111:in `detect_all'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/config/about_command.rb:140:in `run'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/lib/phusion_passenger/config/main.rb:60:in `run!'
from /home3/ecotec11/ruby/gems/gems/passenger-4.0.37/bin/passenger-config:37:in `<top (required)>'
from /home3/ecotec11/ruby/gems/bin/passenger-config:23:in `load'
from /home3/ecotec11/ruby/gems/bin/passenger-config:23:in `<main>'
ecotec11#ecotechno.lv [~/rails_apps/darbs]#

rails - running production mode locally = No such file to load - config/environment

I am trying to run locally in production mode with:
$ RAILS_ENV=production rails s
But I get:
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/li
b/active_support/dependencies.rb:306:in `rescue in depend_on': No such file
to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../con
fig/environment (LoadError)
I can create a brand new rails 3.1.8 app and do RAILS_ENV=production rails server and I don't get this problem.
I can also do rails s and that runs the server fine in development mode without error.
I can also do RAILS_ENV=development rails s and that runs the server fine in development mode without error.
fwiw, my app was originally a rails 2.3 app so perhaps I am missing something that's been added or changed in rails ?
I do have the config directory with an environment.rb file. Perhaps the way it's being referenced is wrong somehow?
I added config.assets.enabled = true to config/application.rb but it didn't help (didn't expect it to as that is asset compilation, but it was a difference I found!).
Full Trace:
durrantm#Castle2012:~/Dropnot/webs/rails_apps/linker/config/environments (v3.1.8_with_assets)
$ RAILS_ENV=production rails s
=> Booting WEBrick
=> Rails 3.1.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:306:in `rescue in depend_on': No such file to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../config/environment (LoadError)
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:301:in `depend_on'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:214:in `require_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:417:in `block (2 levels) in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `block in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application/finisher.rb:51:in `block in <module:Finisher>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `instance_exec'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `run'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application.rb:96:in `initialize!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config/environment.rb:5:in `<top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `block in require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:4:in `block in <main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `new'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `<main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `parse_file'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:200:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:46:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:301:in `wrapped_app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:252:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:70:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:54:in `block in <top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `tap'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Changed a few things. One of the main ones were to enable static assets locally in config/environments/production.rb when trying to run it locally (only) and revert that before pushing to a production web server. I didn't know that.
seems like your old assets directory lived in other place (maybe in public) and now it is in app/assets, but it doesn't know about it and some files try to load environment.rb. just double check assets dir.

Error while starting WEBrick server using rails

I have an existing application with database ready I have made all the changes in database.yml and did bundle install when I am trying to do rails s to start the WEBrick server I am getting the following error
/usr/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': File exists - /home/username/appname/app/releases/20120831125545/tmp (Errno::EEXIST)
from /usr/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'
from /usr/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `each'
from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands/server.rb:62:in `block in start'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands/server.rb:61:in `each'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands/server.rb:61:in `start'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands.rb:27:in `tap'
from /home/username/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.10/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Am I missing some step , Do I have to re run the migration (I have the database ready with me with data in it)
any help?
Apparently the tmp directory Rails uses for session store is already present. Try deleting the /tmp folder in your release directory.

Resources