Project

General

Profile

Issues with running redmine on a Debian 10 Apache server

Added by Mario Lino da Silva over 2 years ago

I have been running redmine for a longtime, installing it with apt-get. Recently I upgraded to Debian 10 and lost the installation owing to the issues in porting redmine to the new bullseye repository.

Therefore I decided to install redmine using the procedure outlined in the wiki: [[https://www.redmine.org/projects/redmine/wiki/RedmineInstall]]

I created a redmine user as a member of www-data and downloaded and extracted version 4.2 in the directory /opt/redmine, installed all the necessary packages, edited the config.yml file and migrated the SQL database. These are the versions that I have:

> rails -v
Rails 6.1.4.1
> ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]
> gem -v
3.2.5

Then I tested the server in localhost port 3000 with

bundle exec rails server webrick -e production

Redmine works like a charm, I can login and all my projects, posts, and issues are there.

Then I tried to set up redmine in the apache server, I updated passenger

passenger-install-apache2-module

and edited the passenger.conf

<IfModule mod_passenger.c>
  PassengerRoot /var/lib/gems/2.7.0/gems/passenger-6.0.12
  PassengerDefaultRuby /usr/bin/ruby2.7
  PassengerDefaultUser www-data
</IfModule>

and passenger.load

LoadModule passenger_module /var/lib/gems/2.7.0/gems/passenger-6.0.12/buildout/apache2/mod_passenger.so

Finally I created a link to the www directory:

ln -s /opt/redmine/public /var/www/redmine

And created the redmine.conf in apache:

<Location /redmine>
RailsEnv production
PassengerFriendlyErrorPages on
RackBaseURI /redmine
Options -MultiViews
</Location>

and

a2ensite redmine

Sadly I get an error when accessing my server redmine location

superclass mismatch for class StringIO (TypeError)
  /usr/lib/ruby/2.7.0/openssl/config.rb:14:in `require'
  /usr/lib/ruby/2.7.0/openssl/config.rb:14:in `<top (required)>'
  /usr/lib/ruby/2.7.0/openssl.rb:18:in `require'
  /usr/lib/ruby/2.7.0/openssl.rb:18:in `<top (required)>'
  /opt/redmine/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/key_generator.rb:4:in `require'
  /opt/redmine/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.6/lib/active_support/key_generator.rb:4:in `<top (required)>'
  /opt/redmine/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/application.rb:6:in `require'
  /opt/redmine/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails/application.rb:6:in `<top (required)>'
  /opt/redmine/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails.rb:14:in `require'
  /opt/redmine/vendor/bundle/ruby/2.7.0/gems/railties-5.2.6/lib/rails.rb:14:in `<top (required)>'
  /opt/redmine/config/application.rb:5:in `require'
  /opt/redmine/config/application.rb:5:in `<top (required)>'
  /opt/redmine/config/environment.rb:5:in `require'
  /opt/redmine/config/environment.rb:5:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /opt/redmine/vendor/bundle/ruby/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `instance_eval'
  /opt/redmine/vendor/bundle/ruby/2.7.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /var/lib/gems/2.7.0/gems/passenger-6.0.12/src/helper-scripts/rack-preloader.rb:101:in `eval'
  /var/lib/gems/2.7.0/gems/passenger-6.0.12/src/helper-scripts/rack-preloader.rb:101:in `preload_app'
  /var/lib/gems/2.7.0/gems/passenger-6.0.12/src/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
  /var/lib/gems/2.7.0/gems/passenger-6.0.12/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:397:in `run_block_and_record_step_progress'
  /var/lib/gems/2.7.0/gems/passenger-6.0.12/src/helper-scripts/rack-preloader.rb:188:in `<module:App>'
  /var/lib/gems/2.7.0/gems/passenger-6.0.12/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
  /var/lib/gems/2.7.0/gems/passenger-6.0.12/src/helper-scripts/rack-preloader.rb:29:in `<main>'

Here are the printouts of the commands gem env as user redmine inside /opt/redmine

RubyGems Environment:
  - RUBYGEMS VERSION: 3.2.5
  - RUBY VERSION: 2.7.4 (2021-07-07 patchlevel 191) [x86_64-linux-gnu]
  - INSTALLATION DIRECTORY: /var/lib/gems/2.7.0
  - USER INSTALLATION DIRECTORY: /opt/redmine/.local/share/gem/ruby/2.7.0
  - RUBY EXECUTABLE: /usr/bin/ruby2.7
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /opt/redmine/.local/share/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-linux
  - GEM PATHS:
     - /var/lib/gems/2.7.0
     - /opt/redmine/.local/share/gem/ruby/2.7.0
     - /usr/local/lib/ruby/gems/2.7.0
     - /usr/lib/ruby/gems/2.7.0
     - /usr/lib/x86_64-linux-gnu/ruby/gems/2.7.0
     - /usr/share/rubygems-integration/2.7.0
     - /usr/share/rubygems-integration/all
     - /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /opt/redmine/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/local/games
     - /usr/games
     - /usr/local/mdsplus/bin

Running

RAILS_ENV=production /opt/redmine/script/about

I get an error:

-bash: /opt/redmine/script/about.: No such file or directory

but I do have a /bin/about in the directory so I ran instead:

RAILS_ENV=production /opt/redmine/bin/about
sh: 1: hg: not found
sh: 1: cvs: not found
sh: 1: bzr: not found
Environment:
  Redmine version                4.2.3.stable
  Ruby version                   2.7.4-p191 (2021-07-07) [x86_64-linux-gnu]
  Rails version                  5.2.6
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Subversion                     1.14.1
  Git                            2.30.2
  Filesystem                     
Redmine plugins:
  no plugin installed

Do note that I downgraded rails in the/opt/redmine directory to version 5.2.6 (as root I ran gem install rails -v=5.2 inside /opt/redmine) as a try to get things fixed (tried both versions, no luck), hence why rails as user redmine appears as 5.2.6 whereas rails as root is 6.1.4.1

Any help is appreciated, thank you.


Replies (4)

RE: Issues with running redmine on a Debian 10 Apache server - Added by Liane Hampe over 2 years ago

Hi Mario,

Thank you for all the information you put in your request. This helps for getting ideas about the reason of your problem.

Starting at the first error message:

superclass mismatch for class StringIO (TypeError)

StringIO is a class of rubys standard library. A superclass mismatch occurs when there are multiple classes named StringIO and due to this it is not quite clear which one should be used.

When I look at your error stack then I find a lot of different pathes for ruby and ruby gems.

1) /var/lib/gems/2.7.0/gems/
2) /opt/redmine/vendor/bundle/ruby/2.7.0/gems/
3) /usr/lib/ruby/2.7.0/

I guess that you have the required class at several places which are all in your PATH and hence recognized. I would try to clean this up a little bit. It seems as if you have bundled all gems into

 /opt/redmine/vendor/bundle/

Try to stick with that directory or its corresponding path as stated in GEM PATHS in your PassengerDefaultRuby configuration. Maybe it will work with:

<IfModule mod_passenger.c>
  PassengerRoot /var/lib/gems/2.7.0/gems/passenger-6.0.12
  PassengerDefaultRuby /opt/redmine/.local/share/gem/ruby/2.7.0
  PassengerDefaultUser www-data
</IfModule>

Best Regards,
Liane

RE: Issues with running redmine on a Debian 10 Apache server - Added by Mario Lino da Silva over 2 years ago

Thanks for the help Liane, I see, I should try for the server to load the gems in /opt/redmine.

With this said, and although gem env does mention /opt/redmine/.local/share/gem/ruby/2.7.0 changing the configuration of passenger did not work as I seem to not have a .local subfolder in my /opt/redmine folder, did I miss some command to create this somewhere? I am a bit confused gem env mentions it as a path although it does not exist.

I checked and have all my local gems in

/opt/redmine/vendor/bundle/ruby/2.7.0/gems

however putting this path on PassengerDefaultRuby yields me an error

/bin/sh: 1: exec: /opt/redmine/vendor/bundle/ruby/2.7.0/gems: Permission denied

although I do have 755 permissions on this folder (and all other ones).

Do you have any more suggestions on what to try next?

Your help is appreciated,

Mario

RE: Issues with running redmine on a Debian 10 Apache server - Added by Liane Hampe over 2 years ago

Hi Mario

There are some more things you could check:

i) Navigate to the root of your Redmine instance and run

which ruby

If you get a path different from that you have tried to configure for passenger than try that one.

ii) If there are still permission problems than check also whether the group of passenger is the same in your path returned by which ruby.

iii) Maybe you should also set the gem path for passenger. Since you have a lot of pathes registered you could try to find the relevant one with the following command running at the instance root directory:

gem list bundler -d

and set that path in the passenger configuration like so:

SetEnv GEM_PATH (the-path-you-get-from-the-command-above)

Please let me know whether something is helpful or when you try some other things what was helpful of them.

Best Regards,
Liane

RE: Issues with running redmine on a Debian 10 Apache server - Added by Mario Lino da Silva about 2 years ago

Well, this is driving me crazy, I have lost countless hours to this to no avail. Have been trying different builds of redmine with no results.

Right now I have been trying to have the gems all in one place, I download and unpack redmine and run:

bundle install --without development test --path vendor/bundle

All the gems get downloaded and stored in the vendor/bundle directory.

If I don't do anything else, he will complain that he needs higher versions of the gems, which doesn't make sense since all the redmine version needs is in the Gemfile.

For example, I'm trying redmine-4.2.3, which has the following Gemfile:

source 'https://rubygems.org'

ruby '>= 2.4.0', '< 2.8.0'
gem 'bundler', '>= 1.12.0'

gem 'rails', '5.2.6'
gem 'sprockets', '~> 3.7.2' if RUBY_VERSION < '2.5'
gem 'globalid', '~> 0.4.2' if Gem.ruby_version < Gem::Version.new('2.6.0')
gem 'rouge', '~> 3.26.0'
gem 'request_store', '~> 1.5.0'
gem "mini_mime", "~> 1.0.1" 
gem "actionpack-xml_parser" 
gem 'roadie-rails', (RUBY_VERSION < '2.5' ? '~> 1.3.0' : '~> 2.2.0')
gem 'marcel'
gem "mail", "~> 2.7.1" 
gem 'csv', (RUBY_VERSION < '2.5' ? ['>= 3.1.1', '<= 3.1.5'] : '~> 3.1.1')
gem 'nokogiri', (RUBY_VERSION < '2.5' ? '~> 1.10.0' : '~> 1.11.1')
gem 'i18n', '~> 1.8.2'
gem "rbpdf", "~> 1.20.0" 
gem 'addressable'
gem 'rubyzip', '~> 2.3.0'
...

I get the correct gems installed:

 ls vendor/bundle/ruby/2.7.0/gems/
actioncable-5.2.6         css_parser-1.11.0      nio4r-2.5.8            roadie-4.0.0
actionmailer-5.2.6         csv-3.1.9          nokogiri-1.11.7-x86_64-linux    roadie-rails-2.2.0
actionpack-5.2.6         erubi-1.10.0      public_suffix-4.0.6        rotp-6.2.0
actionpack-xml_parser-2.0.1  globalid-1.0.0      racc-1.6.0            rouge-3.26.1
actionview-5.2.6         htmlentities-4.3.4   rack-2.2.3            rqrcode-2.1.0
activejob-5.2.6             i18n-1.8.11      rack-openid-1.4.2        rqrcode_core-1.2.0
activemodel-5.2.6         loofah-2.13.0      rack-test-1.1.0        ruby-openid-2.9.2
activerecord-5.2.6         mail-2.7.1          rails-5.2.6            rubyzip-2.3.2
activestorage-5.2.6         marcel-1.0.2      rails-dom-testing-2.0.3    sprockets-4.0.2
activesupport-5.2.6         method_source-1.0.0  rails-html-sanitizer-1.4.2    sprockets-rails-3.4.2
addressable-2.8.0         mini_magick-4.11.0   railties-5.2.6        thor-1.2.1
arel-9.0.0             mini_mime-1.0.3      rake-13.0.6            thread_safe-0.3.6
builder-3.2.4             mini_portile2-2.5.3  rbpdf-1.20.1            tzinfo-1.2.9
chunky_png-1.4.0         minitest-5.15.0      rbpdf-font-1.19.1        websocket-driver-0.7.5
concurrent-ruby-1.1.9         mysql2-0.5.3      redcarpet-3.5.1        websocket-extensions-0.1.5
crass-1.0.6             net-ldap-0.17.0      request_store-1.5.1

but now passenger is asking me for i18n-1.9.1 ??? Why is that?

Could not find i18n-1.9.1 in any of the sources (Bundler::GemNotFound)

(my passenger.conf file)

<IfModule mod_passenger.c>
  PassengerRoot /var/lib/gems/2.7.0/gems/passenger-6.0.12
  PassengerDefaultRuby /usr/bin/ruby2.7
  PassengerRuby /usr/bin/ruby2.7
  PassengerDefaultUser redmine
  PassengerUser redmine
  SetEnv GEM_PATH /opt/redmine/vendor/bundle/ruby/2.7.0
  SetEnv GEM_HOME /opt/redmine/vendor/bundle/ruby/2.7.0
</IfModule>

IF I go all the way and install the gems he is asking me for, then I will run into this interpreter error
Again any help is appreciated, I haven't felt this much frustration in years

    (1-4/4)