Update on ubuntu fail

Added by Ivan Markov almost 8 years ago

I just tried to update my ubuntu 12.04 server, and rails update was somewhere in there.

I used apt-get update / upgrade, as standard.

After that Redmine stoped working.

Starting the redmine page I get "undefined method `session=' for ActionController::Base:Class"

and every time i run apt-get upgrade I get

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up redmine (2.1.2+dfsg1-1~precise+6) ...
dbconfig-common: writing config to /etc/dbconfig-common/redmine/instances/default.conf

Creating config file /etc/redmine/default/database.yml.new with new version
dbconfig-common: flushing administrative password
Populating database for redmine instance "default".
This may take a while.
WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
    at /usr/lib/ruby/vendor_ruby/rake/rdoctask.rb
rake aborted!
undefined method `session=' for ActionController::Base:Class

Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Error when running rake db:migrate, check database configuration.
/var/lib/dpkg/info/redmine.postinst: 279: exit: Illegal number: -1
dpkg: error processing redmine (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 redmine
E: Sub-process /usr/bin/dpkg returned an error code (1)

Any ideas how to fix redmine at this point?

Replies (16)

RE: Update on ubuntu fail - Added by Ben Tsou almost 8 years ago

I have the same problem. Does anyone have a solution?

RE: Update on ubuntu fail - Added by Ivan Markov almost 8 years ago

Had a redmine-mysql package update today.

Now I have the error:

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up redmine (2.1.2+dfsg1-1~precise+13) ...
dbconfig-common: writing config to /etc/dbconfig-common/redmine/instances/default.conf

Creating config file /etc/redmine/default/database.yml.new with new version
dbconfig-common: flushing administrative password
Populating database for redmine instance "default".
This may take a while.
WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
    at /usr/lib/ruby/vendor_ruby/rake/rdoctask.rb
rake aborted!
superclass mismatch for class MysqlAdapter

Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Error when running rake db:migrate, check database configuration.
/var/lib/dpkg/info/redmine.postinst: 275: exit: Illegal number: -1
dpkg: error processing redmine (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 redmine
E: Sub-process /usr/bin/dpkg returned an error code (1)

Basicly I noticed superclass mismatch for class MysqlAdapter now...

Redmine is still down for me... Help?

RE: Update on ubuntu fail - Added by Ben Tsou almost 8 years ago

I gave up and reinstalled Redmine using the method described in http://www.redmine.org/projects/redmine/wiki/RedmineInstall. Migrated my database and files over to the new installation and everything looks good now.

RE: Update on ubuntu fail - Added by Adrian Wilkins almost 8 years ago

This seems to be down to the new versions in Ondrej Sury's PPA ; his efforts to produce packages for Ubuntu are greatly appreciated, but there seem to be a few hiccups when moving from 1.4.3 to 2.1.0 (which is what his package has done).

The problem here seems to be the move to Rails 3.2.8 ; one of the extra scripts

./config/initializers/10-patches.rb

Overloads MysqlAdapter < AbstractAdapter

When ActiveRecord now declares this class

MysqlAdapter < AbstractMysqlAdapter

Changing this line fixes this error... and then runs you into another one... watch this space.

RE: Update on ubuntu fail - Added by Adrian Wilkins almost 8 years ago

Have got a 2.1.2 server up and running by hacking around mercilessly with Ondrej's packages.

Sort version ; they're busted.

Hopefully my feedback to him will be helpful.

RE: Update on ubuntu fail - Added by Alf S. almost 8 years ago

I have the same problem.

Can you elaborate what have you done to get a 2.1.2 server up and running Adrian?

RE: Update on ubuntu fail - Added by Adrian Wilkins almost 8 years ago

Ok...

The action takes place in /usr/share/redmine

  • Firstly, if you're upgrading, the packages will uninstall Redmine, and upgrade the DB packages.
    • Persist
    • Since some of the problems prevent the package configuration succeeding (Session, Database) you'll have to fix them, run the configuration, and the "unfix" some of them
    • dpkg-configure -plow redmine
  • If you're installing fresh (and maybe upgrading too) the session.yml file can't be written
    • One of the Debian patches tries to load the session file... even when the rake to create it is running
    • This fails. Comment out line 70 of config/application.rb which loads the /etc/redmine/session.yml file
    • And lines that depend on it
    • After you sucessfully reconfigure, you'll have to put these lines back
  • Another Debian patch is not up to date with ActiveRecord and causes a superclass mismatch
    • config/initializers/10-patches.rb
    • Replace the reference to AbstractAdapter to AbstractMysqlAdapter
  • The Debian packages for Passenger are version 2, and depend on bits of Rails 2 that don't exist anymore
    • I used gem to manually install Passenger 3
    • Follow the instructions to integrate it into Apache 2
    • Instead of editing the load instruction into the config file, edit the "mods=available/passenger.load" and "passenger.conf" files

RE: Update on ubuntu fail - Added by Alf S. almost 8 years ago

Thanks Adrian.

I'll try. In the mean time, I've configured a 2.1.2 server from the sources just to allow people to work again.

Seems like Ondrej Sury's packages are somewaht broken for now...

RE: Update on ubuntu fail - Added by Adrian Wilkins almost 8 years ago

To be fair, he does point this out on his PPA page, but this is possible of little comfort to those of us who upgraded routinely.

I think I'll be pinning versions on these packages for the immediate future.

RE: Update on ubuntu fail - Added by Denis K. almost 8 years ago

Thanks to Adrian.
But you don't have to update Passenger manually on precise. It worked for me using ppa for passenger described in this wiki: http://wiki.brightbox.co.uk/docs:phusion-passenger . You will have to restart(not reload) apache2.

RE: Update on ubuntu fail - Added by Razor7 Razor7 over 7 years ago

Hi, in my case, followed this steps and got RM 2.1.2 working on Ubuntu server 12.04

  • # cd /usr/share/redmine
  • # sudo apt-add-repository ppa:brightbox/passenger
  • # sudo apt-get update
  • # sudo apt-get install libapache2-mod-passenger
  • # sudo service apache2 restart
  • # nano config/initializers/10-patches.rb, changed class MysqlAdapter < AbstractAdapter to class MysqlAdapter < AbstractMysqlAdapter
  • # apt-get install -f

RE: Update on ubuntu fail - Added by Harshit Jain over 7 years ago

I ended up spending an entire evening on it. I have learnt a lesson that anytime I do a apt get dist-upgrade and see redmine packages in it, I should do it only when I have a free evening.

So I uninstalled Redmine. Then I couldn't get to install it and managed to resolve it by following Razor's instructions

Razor7 Razor7 wrote:

Hi, in my case, followed this steps and got RM 2.1.2 working on Ubuntu server 12.04

  • # cd /usr/share/redmine
  • # sudo apt-add-repository ppa:brightbox/passenger
  • # sudo apt-get update
  • # sudo apt-get install libapache2-mod-passenger
  • # sudo service apache2 restart
  • # nano config/initializers/10-patches.rb, changed class MysqlAdapter < AbstractAdapter to class MysqlAdapter < AbstractMysqlAdapter
  • # apt-get install -f

However, as mentioned by Adrian above my installation was also looking out for session.yml and database.yml files. So I had manually create these files as well. I copied from another redmine installation I had on another server (obviously modified the database.yml with my database settings). The again ran

  • # apt-get install redmine

This ensured it completed the installation from where it was stuck

RE: Update on ubuntu fail - Added by Ondřej Surý over 7 years ago

Just a quick notice for you guys. I would like to thank Adrian because I was able to get the packages back to a shape with his help. I would really appreciate if you could drop me an email (preferably with a patch :) when you notice that something is broken in the redmine packages. I don't read this forum and I have discovered this topic only by accident (searching for something else).

RE: Update on ubuntu fail - Added by Razor7 Razor7 over 7 years ago

Well, today upgraded my Ubuntu Server and latest updates of ruby breaks redmine installation. Thanks to the help of Ondřej, got it working again in no time!

To fix it, I followed this simple steps:

  • Edit file mysql_adapter.rb with nano: # sudo nano /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/mysql_adapter.rb
  • Comment line 5: gem 'mysql', '~> 2.8' -> #gem 'mysql', '~> 2.8'
  • Save file and close nano
  • Test redmine site

Best regards!

RE: Update on ubuntu fail - Added by Ondřej Surý over 7 years ago

Thanks to all who helped me to debug this issue. It will be fixed in ruby-activerecord-3.2 3.2.13-2 version, which should be built shortly.

RE: Update on ubuntu fail - Added by simo geo 5 months ago

Hi,

running upgrade on ubuntu 18.04 server, I get a similar issue ...

Errors were encountered while processing:
 redmine
E: Sub-process /usr/bin/dpkg returned an error code (1)

Redmine still runs, even after a reboot.

But I'd like to fix it before runing into more serious issue.

My environnement :

Environment:
  Redmine version                3.4.4.stable
  Ruby version                   2.5.1-p57 (2018-03-29) [x86_64-linux-gnu]
  Rails version                  4.2.11.1
  Environment                    production
  Database adapter               Mysql2

Any help ?

Thanks in advance

(1-16/16)