Bug 215225 - www/redmine broken again after upgrade of rubygems
Summary: www/redmine broken again after upgrade of rubygems
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ruby (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-11 16:54 UTC by Miroslav Lachman
Modified: 2017-01-05 20:16 UTC (History)
3 users (show)

See Also:


Attachments
Update graphics/rubygem-rmagick from 2.15.4 to 2.16.0 (1.08 KB, patch)
2016-12-13 05:43 UTC, Adrian Murphy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Lachman 2016-12-11 16:54:07 UTC
I did 'pkg upgrade' in jail where only Redmine is running and the result is nonstarting Redmine:

Writing PID to tmp/pids/thin.pid
Changing process privilege to www:www
Using rack adapter
Exiting!
/usr/local/lib/ruby/gems/2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:35:in `block in setup': You have already activated rack 2.0.1, but your Gemfile requires rack 1.6.5. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:20:in `map'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:20:in `setup'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.12.5/lib/bundler.rb:95:in `setup'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.12.5/lib/bundler/setup.rb:19:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:133:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:40:in `require'
        from /usr/local/www/redmine/config/boot.rb:4:in `<top (required)>'


The problem is there are two versions of Rack installed

# pkg info | grep -i rack
rubygem-rack-2.0.1,3           Rack, a Ruby Webserver Interface
rubygem-rack-openid-1.4.2_3    Provides a more HTTPish API around the ruby-openid library
rubygem-rack-test-0.6.3_2      Small, simple testing API for Rack apps
rubygem-rack16-1.6.5           Rack, a Ruby Webserver Interface


# pkg info -r -d rubygem-rack-2.0.1,3 rubygem-rack16-1.6.5
rubygem-rack-2.0.1,3
Depends on     :
        ruby-2.2.6_1,1
        ruby22-gems-2.6.8
Required by    :
        rubygem-rack-test-0.6.3_2
        rubygem-sprockets3-3.7.0_1
        rubygem-thin-1.7.0
        rubygem-rack-openid-1.4.2_3
rubygem-rack16-1.6.5
Depends on     :
        ruby-2.2.6_1,1
        ruby22-gems-2.6.8
Required by    :
        rubygem-actionpack4-4.2.7.1


I am unable to fix or workaround it so our Redmine installation in now non-functional.

I already tried to reinstall everything by 'pkg upgrade -f'. Nothing changed.
Comment 1 Adrian Murphy 2016-12-13 05:43:48 UTC
Created attachment 177928 [details]
Update graphics/rubygem-rmagick from 2.15.4 to 2.16.0

This fixed my redmine problem but I worry what it will do to other consumers of graphics/rubygem-rmagick
Comment 2 Adrian Murphy 2016-12-13 05:45:05 UTC
I too had two instances of redmine fail after the recent rubygems upgrade. However I am not suffering the same affliction as Miroslav.

I run redmine with passenger and apache24. 

To fix my problem I had to adjust graphics/rubygem-rmagick as shown in the attachment.
Comment 3 schmidt 2016-12-13 08:05:06 UTC
The problem is that rubygem-actionpack4 installs the pkg rubygem-rack16 while other rubygems for example rubygem-thin install the package rubygem-rack which is version 2.0

the problem is that all port requited by redmine that depend on rubygem-rack have a  RUN_DEPENDS=rubygem-rack>=1.0:www/rubygem-rack in there Makefile. 

They don't recognize that rake-1.6 is already installed because the packname is rubygem-rack16 and not rubygem-rack and install rack again from the rubygem-rack port.

While starting redmine it finds rake 2.0.1 and uses it but some gem require rack 1.6.5 explicitly and so the startup fails.

Shorthand fix for this problem is to force remove the package rubygem-rake. Redmine works fine without it as all gems used state that they need rack > 1.0 which is there with the package rubygem-rack16 

Longterm the ports depending on rack should check if they can use a already installed version of rake.
Comment 4 Steve Wills freebsd_committer freebsd_triage 2017-01-03 05:19:49 UTC
I believe this was fixed in r429809. Sorry I missed this PR. Closing, please let me know if it's still an issue.
Comment 5 Miroslav Lachman 2017-01-04 12:41:30 UTC
(In reply to Steve Wills from comment #4)

I upgraded redmine to 3.2.3_4 but got the same error as before:

# tail -n 35 -f /usr/local/www/redmine/log/thin.log
Changing process privilege to www:www
Using rack adapter
Exiting!
/usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/runtime.rb:40:in `block in setup': You have already activated rack 2.0.1, but your Gemfile requires rack 1.6.5. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/runtime.rb:25:in `map'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/runtime.rb:25:in `setup'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler.rb:99:in `setup'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/setup.rb:20:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:133:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:40:in `require'
        from /usr/local/www/redmine/config/boot.rb:4:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/www/redmine/config/application.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/www/redmine/config/environment.rb:2:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/www/redmine/config.ru:3:in `block in <main>'
        from /usr/local/lib/ruby/gems/2.2/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
        from /usr/local/lib/ruby/gems/2.2/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
        from /usr/local/www/redmine/config.ru:1:in `new'
        from /usr/local/www/redmine/config.ru:1:in `<main>'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/rack/adapter/loader.rb:33:in `eval'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/rack/adapter/loader.rb:33:in `load'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/rack/adapter/loader.rb:42:in `for'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/thin/controllers/controller.rb:170:in `load_adapter'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/thin/controllers/controller.rb:74:in `start'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/thin/runner.rb:200:in `run_command'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/thin/runner.rb:156:in `run!'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/bin/thin:6:in `<top (required)>'
        from /usr/local/bin/thin:22:in `load'
        from /usr/local/bin/thin:22:in `<main>'


I tried to pkg delete -f rubygem-rack16, but it doesn't work too:

Writing PID to tmp/pids/thin.pid
Changing process privilege to www:www
Using rack adapter
Exiting!
/usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/resolver.rb:203:in `rescue in start': Bundler could not find compatible versions for gem "rack": (Bundler::VersionConflict)
  In Gemfile:
    actionpack-xml_parser was resolved to 1.0.2, which depends on
      actionpack (< 5, >= 4.0.0) was resolved to 4.2.7.1, which depends on
        rack (~> 1.6)

    rack-openid was resolved to 1.4.2, which depends on
      rack (>= 1.1.0)

    thin (>= 1.6.2) was resolved to 1.7.0, which depends on
      rack (< 3, >= 1)

Could not find gem 'rack (~> 1.6)', which is required by gem 'rack-openid', in any of the sources.
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/resolver.rb:199:in `start'


I installed rubygem-rack16 back and deinstalled rubygem-rack-2: pkg delete -f rubygem-rack-2.0.1,3

Redmine now works again.
Exactly as schmidt@ze.tum.de wrote 2016-12-13

So please, can somebody fix this dependency hell?
Comment 6 Steve Wills freebsd_committer freebsd_triage 2017-01-04 13:15:18 UTC
(In reply to Miroslav Lachman from comment #5)
In my test jail running redmine, I also have:

root@redmine:~ # pkg info | grep rack
rubygem-rack-2.0.1,3           Rack, a Ruby Webserver Interface
rubygem-rack-openid-1.4.2_3    Provides a more HTTPish API around the ruby-openid library
rubygem-rack-test-0.6.3_2      Small, simple testing API for Rack apps
rubygem-rack16-1.6.5           Rack, a Ruby Webserver Interface

but it starts up without error. Perhaps Gemfile.lock needs to be re-created?
Comment 7 Miroslav Lachman 2017-01-04 13:37:08 UTC
(In reply to Steve Wills from comment #6)

Are you using thin?
What do you have in Gemfile.lock

Mine contains this lines with rack

      rack (~> 1.6)
      rack-test (~> 0.6.2)
    rack (1.6.5)
    rack-openid (1.4.2)
      rack (>= 1.1.0)
    rack-test (0.6.3)
      rack (>= 1.0)
      rack (> 1, < 3)
      rack (>= 1, < 3)
  rack-openid


According to today's date it was updated during pkg upgrade

# ls -l /usr/local/www/redmine/Gemfile.lock
-rw-r--r--  1 www  www  4266 Jan  4 13:36 /usr/local/www/redmine/Gemfile.lock
Comment 8 Steve Wills freebsd_committer freebsd_triage 2017-01-04 19:14:07 UTC
(In reply to Miroslav Lachman from comment #7)
Odd, seems like the Gemfile might need more adjustment to avoid an issue if rack 2.x is installed.

For now (as of r430588) I've adjusted the deps so that rack 2.x isn't pulled in. Update and pkg autoremove to remove rack 2.x and give it a try, it worked for me (tested thin explicitly this time).
Comment 9 Miroslav Lachman 2017-01-05 10:36:24 UTC
(In reply to Steve Wills from comment #8)
I pulled this file from SVN https://svnweb.freebsd.org/ports?view=revision&revision=430588 re-run poudriere bulk to get new rubygem-thin package and then reinstalled Redmine. Unfortunately id doesn't start



(root@dice) ~/# pkg version -vRL =
Updating codelab repository catalogue...
codelab repository is up-to-date.
Updating redmine repository catalogue...
[dice ] Fetching meta.txz: 100%    820 B   0.8kB/s    00:01
[dice ] Fetching packagesite.txz: 100%   36 KiB  36.6kB/s    00:01
Processing entries: 100%
redmine repository update completed. 139 packages processed.
rubygem-thin-1.7.0                 <   needs updating (remote has 1.7.0_1)



(root@dice) ~/# pkg upgrade -f rubygem-thin redmine
Updating codelab repository catalogue...
codelab repository is up-to-date.
Updating redmine repository catalogue...
redmine repository is up-to-date.
All repositories are up-to-date.
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        rubygem-rack: 2.0.1,3 [redmine]

Installed packages to be UPGRADED:
        rubygem-thin: 1.7.0 -> 1.7.0_1 [redmine]

Installed packages to be REINSTALLED:
        redmine-3.2.3_4 [redmine]

Number of packages to be installed: 1
Number of packages to be upgraded: 1
Number of packages to be reinstalled: 1

2 MiB to be downloaded.

Proceed with this action? [y/N]: y
[dice ] Fetching rubygem-thin-1.7.0_1.txz: 100%   50 KiB  50.9kB/s    00:01
[dice ] Fetching redmine-3.2.3_4.txz: 100%    2 MiB   1.6MB/s    00:01
Checking integrity... done (0 conflicting)
[dice ] [1/3] Installing rubygem-rack-2.0.1,3...
[dice ] [1/3] Extracting rubygem-rack-2.0.1,3: 100%
[dice ] [2/3] Upgrading rubygem-thin from 1.7.0 to 1.7.0_1...
[dice ] [2/3] Extracting rubygem-thin-1.7.0_1: 100%
[dice ] [3/3] Reinstalling redmine-3.2.3_4...
===> Creating groups.
Using existing group 'www'.
===> Creating users
Using existing user 'www'.
[dice ] [3/3] Extracting redmine-3.2.3_4: 100%
You may need to manually remove /usr/local/www/redmine/config/database.yml if it is no longer needed.
You may need to manually remove /usr/local/www/redmine/config/settings.yml if it is no longer needed.
Message from redmine-3.2.3_4:
=============================================================================

Redmine was installed.

You now need to setup your Redmine installation so
please have a look at the Installation Guide.

http://www.redmine.org/wiki/redmine/RedmineInstall


If you are upgrading please read the Upgrading Guide
before starting the new version.

http://www.redmine.org/wiki/redmine/RedmineUpgrade

=============================================================================


(root@dice) ~/# service redmine status
redmine is running as pid 99318.

(root@dice) ~/# service redmine stop
Stopping redmine.
Waiting for PIDS: 99318.

(root@dice) ~/# service redmine start

(root@dice) ~/# service redmine status
redmine is not running.



Writing PID to tmp/pids/thin.pid
Changing process privilege to www:www
Using rack adapter
Exiting!
/usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/runtime.rb:40:in `block in setup': You have already activated rack 2.0.1, but your Gemfile requires rack 1.6.5. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/runtime.rb:25:in `map'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/runtime.rb:25:in `setup'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler.rb:99:in `setup'
        from /usr/local/lib/ruby/gems/2.2/gems/bundler-1.13.7/lib/bundler/setup.rb:20:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:133:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:40:in `require'
        from /usr/local/www/redmine/config/boot.rb:4:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/www/redmine/config/application.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/www/redmine/config/environment.rb:2:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.2/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/www/redmine/config.ru:3:in `block in <main>'
        from /usr/local/lib/ruby/gems/2.2/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
        from /usr/local/lib/ruby/gems/2.2/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
        from /usr/local/www/redmine/config.ru:1:in `new'
        from /usr/local/www/redmine/config.ru:1:in `<main>'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/rack/adapter/loader.rb:33:in `eval'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/rack/adapter/loader.rb:33:in `load'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/rack/adapter/loader.rb:42:in `for'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/thin/controllers/controller.rb:170:in `load_adapter'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/thin/controllers/controller.rb:74:in `start'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/thin/runner.rb:200:in `run_command'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/lib/thin/runner.rb:156:in `run!'
        from /usr/local/lib/ruby/gems/2.2/gems/thin-1.7.0/bin/thin:6:in `<top (required)>'
        from /usr/local/bin/thin:22:in `load'
        from /usr/local/bin/thin:22:in `<main>'



I don't know what went wrong but Gemfile.lock is empty

# ll /usr/local/www/redmine/Gemfile*
-r--r--r--  1 www  www   3.2K Jan  5 11:24 /usr/local/www/redmine/Gemfile
-rw-r--r--  1 www  www     0B Jan  5 11:24 /usr/local/www/redmine/Gemfile.lock


And rubygem-rack-2.0.1,3 is still required by these packages

# pkg info -r -d rubygem-rack
rubygem-rack-2.0.1,3
Depends on     :
        ruby-2.2.6_1,1
        ruby22-gems-2.6.8
Required by    :
        rubygem-rack-test-0.6.3_2
        rubygem-sprockets3-3.7.1
        rubygem-rack-openid-1.4.2_3
Comment 10 Steve Wills freebsd_committer freebsd_triage 2017-01-05 19:33:42 UTC
(In reply to Miroslav Lachman from comment #9)

Seems like you haven't gotten all the updates, because you should have:

rubygem-rack-test-0.6.3_3
rubygem-sprockets3-3.7.1_1
rubygem-rack-openid-1.4.2_4

Please make sure you have those and try removing rack 2.x again.
Comment 11 Miroslav Lachman 2017-01-05 20:16:20 UTC
(In reply to Steve Wills from comment #10)
Yes, this was my bad.
It works now.
Thank you for your time and effort.