Passenger crashes, hangs at apache start - ruby-on-rails-3

On a fresh installation of Ubuntu, with Ruby/Rails/RVM with Apache via Passenger, apache will come up on a clean reboot, but crash at the first request to the Rails app.
I have done all of this many times before ... except RVM installed in multi-user mode.
It seems like maybe there's some library conflict?
Details below.
64-bit Ubuntu 11.10 installation
created a release user, and group
uninstall the default apache, ruby, passenger (sudo apt-get remove ...)
installed RVM using the system version (multiple users)
installed ruby 1.9.3p194 using RVM (installed as the release user)
add release user to group rvm
ruby and gems are under /usr/local/rvm/ and are all in group rvm and readable
install apache2 and various supporting libraries (sudo apt-get install apache2)
add apache2 user (www-data) to group rvm
install passenger from gem (gem install passenger)
use passenger to make passenger module (passenger-install-apache2-module). No errors.
configure apache to load the correct module (under /usr/local/rvm...)
configure apache to reference the correct PassengerRoot and PassengerRuby
note: this is all without any reference to the Rails app
start apache (sudo apache2ctl start) ... this hangs
Apache error.log shows
[ pid=1303 thr=140033289561952 file=ext/apache2/Hooks.cpp:1389 time=2012-05-07 19:54:15.497 ]: Initializing Phusion Passenger...
[ pid=1303 thr=140033289561952 file=ext/apache2/Hooks.cpp:1664 time=2012-05-07 19:54:15.536 ]: Shutting down Phusion Passenger...
[ pid=1312 thr=140533444790112 file=ext/common/LoggingAgent/Main.cpp:283 time=2012-05-07 19:54:15.537 ]: Logging agent online, listening at unix:/tmp/passenger.1.0.1303/generation-0/logging.socket
In other words, passenger terminates moments after it starts. /var/log/syslog shows a stack dump for PassengerWatchd.
I tried running passenger in standalone mode. Nada.
Any ideas?

For anyone looking, this ended up being an issue for several people, and there are several good workarounds posted on the Passenger Google Group here

Make sure your passenger.conf is using the same version of ruby as in your console.
$ cat /etc/apache2/mods-available/passenger.conf
PassengerRuby /home/ubuntu/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
PassengerRoot /home/ubuntu/.rvm/gems/ruby-1.9.2-p320/gems/passenger-3.0.18
PassengerDefaultUser www-data
Compare the PassengerRuby is the same as:
$ which ruby
/home/ubuntu/.rvm/rubies/ruby-1.9.2-p320/bin/ruby

Related

How to fix HTTPD (Apache) Error 256 on OSX Monterey 12.5

I have a Apache2 installed with Homebrew on a Mac running OSX Monterey. I haven't done LAMP development for a while, so I'm not sure when the error started, but I've recently updated OSX to 12.5. When I returned to working on a LAMP project, my Apache installation stopped working. Running brew services produced the following output: Name Status User File httpd error 256 root ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist mysql started Nizz0k ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist.
Running the stop, start, and restart commands produces "success" output in the terminal, but Apache doesn't work. I can't navigate to my local vhosts, and of course, running brew services still shows an error.
In running apachectl -e error Apache complains about permissions to the error logs
I have tried:
uninstalling and reinstalling HTTPD
The apr-utilities fix.
confirming Mac installed Apache is stopped.
At this point, I think my problem is that there was conflicting information about how to run Apache on Homebrew. Earlier versions apparently required sudo, but running it this was now produces warnings like this:
Warning: Taking root:admin ownership of some httpd paths:
/usr/local/Cellar/httpd/2.4.54/bin
/usr/local/Cellar/httpd/2.4.54/bin/httpd
/usr/local/opt/httpd
/usr/local/opt/httpd/bin
/usr/local/var/homebrew/linked/httpd
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: httpd must be run as non-root to start at user login!
/Library/LaunchDaemons/homebrew.mxcl.httpd.plist: service already bootstrapped
Bootstrap failed: 37: Operation already in progress
Error: Failure while executing; `/bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.httpd.plist` exited with 37.
The issue is even after removing the paths as suggested in the error, a reinstallation brings Root back as the owner.
I do have the same problem with nginx.
Manually unloaded it and then restarting it worked fine.
Try:
sudo launchctl bootout system /Library/LaunchDaemons/homebrew.mxcl.httpd.plist
sudo brew services start httpd

Installing Cobbler on Ubuntu 15.10 seems to break apache, how can I fix this?

I am trying to install Cobbler on a brand new Ubuntu 15.10 virtual box but it is not working. When I run the apt-get install cobbler cobbler-web it seems to break apache completely to the point I can't get it working again.
I see this in the apache error log:
[wsgi:crit] [pid 8112:tid 140273573488512] mod_wsgi (pid=8112): The mod_python module can not be used on conjunction with mod_wsgi 4.0+. Remove the mod_python module from the Apache configuration.
and this in the auth.log:
polkitd(authority=local): Unregistered Authentication Agent for unix-process:8081:54865 (system bus name :1.24, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
I have tried removing the mod_python and wsgi modules but apache still doesn't start up. And I think Cobbler uses them anyways, so I kind of need them.
I have also tried disabling polkitd. I don't find any clues when searching for that weird error message.
I was able to install Cobbler on Ubuntu 14.04 pretty easily and apache works fine.
Here is the basic chain of install commands I used:
apt-get update
apt-get install apache2
apt-get install isc-dhcp-server
apt-get install bind9 bind9utils bind9-doc
apt-get install cobbler cobbler-web debmirror mkisofs
Disable the module by typing sudo a2dismod python
You should then see this:
Module python disabled. To activate the new configuration, you need to
run: service apache2 restart
So type sudo service apache2 restart.
If that doesn't fix it, check the error log for more information by typing
cat /var/log/apache2/error.log.

passenger_apache2 cookbook fails

I attempting to deploy a number of cookbooks to configure Apache2 and Passenger on Ubuntu 14.04. Below is the list of cookbooks I am installing in the order in which they appear in the run_list:
build-essential 2.1.3,
apt 2.6.1,
iptables 0.14.1,
logrotate 1.7.0,
apache2 2.0.0,
vim 1.1.2,
passenger_apache2 2.2.3
I am bootstrapping my vagrant vm from my development workstation and the cookbooks all appear to get installed with no errors, except when it gets to the passenger_apache2 cookbook. I can provide the entire extensive output, but I believe the following is the informative part of the output:
STDERR: [Wed Jan 21 14:05:17.027610 2015] [core:warn] [pid 26648] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
node.vagrantup.com (2)No such file or directory: AH02297: Cannot access directory '/etc/apache2/${APACHE_LOG_DIR}/' for log file '${APACHE_LOG_DIR}/other_vhosts_access.log' defined at /etc/apache2/conf-enabled/other-vhosts-access-log.conf:2
node.vagrantup.com AH00014: Configuration check failed
I have seen only a couple of discussions indicating an issue with the $HOME environment variable not being set for the daemonized chef-client. However, I am unclear on how to remedy this situation. I would appreciate any insight the community can provide as I learn how to use Chef.
Thx
UPDATE: Viewing the passenger_apache2 cookbook README, apparently this cookbook is not yet supported on Ubuntu 14.04 due to the use of Apache 2.4 in that version of the OS. Further, I see I missed an error in the output which says:
WARNING: Apache doesn't seem to be compiled with the 'prefork', 'worker' or 'event' MPM
node.vagrantup.com Phusion Passenger has only been tested on Apache with the 'prefork', the
node.vagrantup.com 'worker' and the 'event' MPM. Your Apache installation is compiled with
node.vagrantup.com the '' MPM. We recommend you to abort this installer and to recompile
node.vagrantup.com Apache with either the 'prefork', the 'worker' or the 'event' MPM.
Curious to know if anyone is deploying passenger on Ubuntu 14.04 with Apache 2.4 using Chef Server. If so, how?
UPDATE 2: I can not get this working with the supposedly supported Ubuntu 12.04 either. Would really like to know if anybody has this cookbook working and if so, how.
I fixed this issue by taking the following actions:
Downloaded the latest Apache2 cookbook and uploaded it to my Chef server
Downloaded the latest Passenger_Apache2 cookbook.
Uploading the new Passenger_Apache2 cookbook failed with an error indicating that there was a dependency on Apache 1.0 that was unmet. I then modified the metadata.rb file of the Passenger_Apache2 cookbook and changed the following line:
depends 'apache2', '~> 1.0'
to:
depends 'apache2', '~> 3.0'
Now when I bootstrap my chef node, it installs passenger with no errors. Hope this helps others.

Determine version of Phusion Passenger on managed server

I'm going to host an app on a managed server.How to show the current version of Phusion Passenger running on that machine?
passenger -v
gem list |grep passenger

Passenger+Apache2+RubyonRails installation fail

Now I'm trying to install Passenger for RoR on Ubuntu 11.04. I already have apache2 and RoR, also I installed passenger gems. But when I continue with this command:
sudo passenger-install-apache2-module
it says that he can't find this command.
By the way, command 'passenger' he also don't know.
Depending on how you installed the passenger gem the passenger-install-apache2-module file could be in a few different places.
If you are using the default 1.8.7 ruby installation on Ubuntu it should be in here...
/usr/local/lib/ruby/gems/1.8/gems/
In there you should find a passenger folder with the version you installed, example...
/usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.5
Within that folder there should be a bin/ directory, and within there is passenger-install-apache2-module
Failing that, make sure you installed the gem with sudo and try again.