Redmine on Ubuntu 13.10 with Apache2 and Passenger

After a fresh Ubuntu 13.10 install, I encountered the following error

[Fri Nov 01 20:06:50.239664 2013] [core:notice] [pid 59440] AH00094: Command line: '/usr/sbin/apache2'
[ pid=59448 thr=19153000 file=utils.rb:176 time=2013-11-01 20:06:51.996 ]: *** Exception LoadError in PhusionPassenger::ClassicRails::ApplicationSpawner (Please install the mysql adapter: `gem install activerecord-mysql-adapter` (cannot load such file -- mysql)) (process 59448, thread #):

I tried several fix and I finally get Redmine working :

  • install activerecord-mysql2-adapter
gem install activerecord-mysql2-adapter  -- --with-mysql-config=$(which mysql_config)
  • update your redmine database adapter (/etc/redmine/default/database.yml)
production:
    adapter: mysql2

If you have updated redmine, don’t forget to update your database :

cd /usr/share/redmine
rake db:migrate RAILS_ENV=production
rake redmine:plugins:migrate RAILS_ENV=production 
rake tmp:cache:clear
rake tmp:sessions:clear

In case you get a 500 error when you sign in, there’s a workaround.
You can find an error like this in redmine production log :

NoMethodError (undefined method `options' for {:user_id=>1, :ctime=>1383335524, :atime=>1383335524}:Hash):
  /usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:329:in `commit_session'

It seems the default rack version (1.5.2) is not compatible. Just install a previous version and update redmine’s Gemfile :

gem install rack --version 1.4.5

Add the following line in Gemfile :

gem 'rack', '1.4.5'
 
  • Fan Zhang

    Hi,

    Thanks for your tips, I got to remove the annoying rack error message, but now I’m stuck on this

    Error message:
    Invalid argument – setenv
    Exception class:
    Errno::EINVAL

    Any tips?

    Full error here:
    Ruby on Rails application could not be started
    These are the possible causes:
    There may be a syntax error in the application’s code. Please check for such errors and fix them.
    A required library may not installed. Please install all libraries that this application requires.
    The application may not be properly configured. Please check whether all configuration files are written correctly, fix any incorrect configurations, and restart this application.
    A service that the application relies on (such as the database server or the Ferret search engine server) may not have been started. Please start that service.
    Further information about the error may have been written to the application’s log file. Please check it in order to analyse the problem.
    Error message:
    Invalid argument – setenv
    Exception class:
    Errno::EINVAL
    Application root:
    /usr/share/redmine
    Backtrace:
    # File Line Location
    0 /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb 236 in `[]=’
    1 /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb 236 in `block in prepare_app_process’
    2 /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb 235 in `each_pair’
    3 /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb 235 in `prepare_app_process’
    4 /usr/lib/ruby/vendor_ruby/phusion_passenger/classic_rails/application_spawner.rb 176 in `block in initialize_server’
    5 /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb 572 in `report_app_init_status’
    6 /usr/lib/ruby/vendor_ruby/phusion_passenger/classic_rails/application_spawner.rb 174 in `initialize_server’
    7 /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server.rb 204 in `start_synchronously’
    8 /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server.rb 180 in `start’
    9 /usr/lib/ruby/vendor_ruby/phusion_passenger/classic_rails/application_spawner.rb 149 in `start’
    10 /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb 219 in `block (2 levels) in spawn_rails_application’
    11 /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server_collection.rb 132 in `lookup_or_add’
    12 /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb 214 in `block in spawn_rails_application’
    13 /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server_collection.rb 82 in `block in synchronize’
    14 prelude> 10:in `synchronize’
    15 /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server_collection.rb 79 in `synchronize’
    16 /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb 213 in `spawn_rails_application’
    17 /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb 132 in `spawn_application’
    18 /usr/lib/ruby/vendor_ruby/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application’
    19 /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server.rb 357 in `server_main_loop’
    20 /usr/lib/ruby/vendor_ruby/phusion_passenger/abstract_server.rb 206 in `start_synchronously’
    21 /usr/share/phusion-passenger/helper-scripts/passenger-spawn-server 99 in `

  • Pingback: Redmine unter Ubuntu 13.10 | My personal memory hook!()

  • Georges Dupéron

    Hi, based on your post and Redmine’s documentation, I wrote the full list of steps to use in order to install Redmine on a fresh install of xubuntu 13.10 (Desktop version). This is nearly a fully-automated script, the only manual steps are answering dpkg’s questions about setting up the database passwords when installing mysql and redmine.

    You can find this script at https://gist.github.com/anonymous/8617906 if the copy below gets garbled in some way.

    # See also: http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Ubuntu_step_by_step
    # See also: http://charles.lescampeurs.org/2013/11/01/redmine-on-ubuntu-13-10-with-apache2-and-passenger

    echo “vb-redmine” | sudo tee /etc/hostname
    sudo sed -i -e “s/vb-xub1310-64/vb-redmine/” /etc/hosts

    sudo apt-get -y install apache2 libapache2-mod-passenger mysql-server mysql-client redmine redmine-mysql
    # Configuring mysql-server-5.5
    # New password for the MySQL “root” user:
    # => root
    # Repeat password for the MySQL “root” user.
    # => root

    # Configuring redmine
    # Configure database for redmine/instances/default with dbconfig-common?
    # => Yes
    # Database type to be used by redmine/instances/default:
    # => mysql
    # Password of the database’s administrative user:
    # => root
    # MySQL application password for redmine/instances/default:
    # => redmine
    # Password confirmation:
    # => redmine

    # Redmine will crash. To fix that, run:
    sudo sed -i -e ‘s/adapter: mysql/adapter: mysql2/’ /etc/redmine/default/database.yml
    sudo dpkg –configure -a
    # Password of the database’s administrative user:
    # => root

    sudo sed -i -e ‘//a\ PassengerDefaultUser www-data’ /etc/apache2/mods-available/passenger.conf
    sudo ln -s /usr/share/redmine/public /var/www/redmine

    sudo sed -i -e ‘//i\\t’ /etc/apache2/sites-available/000-default.conf
    sudo sed -i -e ‘//i\\t\tRailsBaseURI /redmine’ /etc/apache2/sites-available/000-default.conf
    sudo sed -i -e ‘//i\\t\tPassengerResolveSymlinksInDocumentRoot on’ /etc/apache2/sites-available/000-default.conf
    sudo sed -i -e ‘//i\\t’ /etc/apache2/sites-available/000-default.conf

    echo “ServerName localhost” | sudo tee /etc/apache2/conf-available/fqdn.conf
    sudo a2enconf fqdn.conf

    sudo service apache2 restart

    sudo chown -R www-data:www-data /usr/share/redmine/

    cd /usr/share/redmine
    sudo -u www-data rake db:migrate RAILS_ENV=production
    sudo -u www-data rake redmine:plugins:migrate RAILS_ENV=production
    sudo -u www-data rake tmp:cache:clear
    sudo -u www-data rake tmp:sessions:clear

    # In case you get a 500 error when you sign in, there’s a workaround.
    # You can find an error like this in redmine production log :
    #
    # NoMethodError (undefined method `options’ for {:user_id=>1, :ctime=>1383335524, :atime=>1383335524}:Hash):
    # /usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:329:in `commit_session’
    # It seems the default rack version (1.5.2) is not compatible. Just install a previous version and update redmine’s Gemfile :
    cd /
    sudo -u www-data gem install rack –version 1.4.5
    # Add the following line in Gemfile :
    echo “gem ‘rack’, ‘1.4.5’” | sudo tee -a /usr/share/redmine/Gemfile

    sudo service apache2 restart

    # You can now access http://127.0.0.1:80/redmine .

  • Georges Dupéron

    Sorry for my previous comment, I didn’t see that I could use HTML syntax and forgot to clean up a couple of things.

    Hi, based on your post and Redmine’s documentation, I wrote the full list of steps to use in order to install Redmine on a fresh install of xubuntu 13.10 (Desktop version). This is nearly a fully-automated script, the only manual steps are answering dpkg’s questions about setting up the database passwords when installing mysql and redmine.

    You can find this script at https://gist.github.com/anonymous/8617906 if the copy below gets garbled in some way.


    # Script based on:
    # http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Ubuntu_step_by_step
    # http://charles.lescampeurs.org/2013/11/01/redmine-on-ubuntu-13-10-with-apache2-and-passenger

    sudo apt-get -y install apache2 libapache2-mod-passenger mysql-server mysql-client redmine redmine-mysql
    # Configuring mysql-server-5.5
    # New password for the MySQL “root” user:
    # => root
    # Repeat password for the MySQL “root” user.
    # => root

    # Configuring redmine
    # Configure database for redmine/instances/default with dbconfig-common?
    # => Yes
    # Database type to be used by redmine/instances/default:
    # => mysql
    # Password of the database’s administrative user:
    # => root
    # MySQL application password for redmine/instances/default:
    # => redmine
    # Password confirmation:
    # => redmine

    # Redmine will crash. To fix that, run:
    sudo sed -i -e ‘s/adapter: mysql/adapter: mysql2/’ /etc/redmine/default/database.yml
    sudo dpkg –configure -a
    # Password of the database’s administrative user:
    # => root

    sudo sed -i -e ‘//a\ PassengerDefaultUser www-data’ /etc/apache2/mods-available/passenger.conf
    sudo ln -s /usr/share/redmine/public /var/www/redmine

    sudo sed -i -e ‘//i\\t’ /etc/apache2/sites-available/000-default.conf
    sudo sed -i -e ‘//i\\t\tRailsBaseURI /redmine’ /etc/apache2/sites-available/000-default.conf
    sudo sed -i -e ‘//i\\t\tPassengerResolveSymlinksInDocumentRoot on’ /etc/apache2/sites-available/000-default.conf
    sudo sed -i -e ‘//i\\t’ /etc/apache2/sites-available/000-default.conf

    echo “ServerName localhost” | sudo tee /etc/apache2/conf-available/fqdn.conf
    sudo a2enconf fqdn.conf

    sudo service apache2 restart

    sudo chown -R www-data:www-data /usr/share/redmine/

    cd /usr/share/redmine
    sudo -u www-data rake db:migrate RAILS_ENV=production
    sudo -u www-data rake redmine:plugins:migrate RAILS_ENV=production
    sudo -u www-data rake tmp:cache:clear
    sudo -u www-data rake tmp:sessions:clear

    # In case you get a 500 error when you sign in, there’s a workaround.
    # You can find an error like this in redmine production log :
    #
    # NoMethodError (undefined method `options’ for {:user_id=>1, :ctime=>1383335524, :atime=>1383335524}:Hash):
    # /usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:329:in `commit_session’
    # It seems the default rack version (1.5.2) is not compatible. Just install a previous version and update redmine’s Gemfile :
    cd /
    sudo -u www-data gem install rack –version 1.4.5
    # Add the following line in Gemfile :
    echo “gem ‘rack’, ’1.4.5′” | sudo tee -a /usr/share/redmine/Gemfile

    sudo service apache2 restart

    You can now access http://127.0.0.1:80/redmine .

  • Georges Dupéron

    Sorry the script URL was wrong in my previous comment, it’s https://gist.github.com/jsmaniac/8618063 .

  • Pingback: ubuntu 13.10安装redmine | DTkun()