Upgrade failed with: rake aborted! Gem loading error: cannot load such file -- audited/activerecord

I am trying to upgrade foreman 1.3 to 1.4 with the rpm method. Can anyone
help me with this error. Thanks.

[root]# foreman-rake db:migrate --trace
rake aborted!
Gem loading error: cannot load such file – audited/activerecord
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:30:in
strict_error' /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:53:inrescue in rescue in block in system_require'
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:43:in
rescue in block in system_require' /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:37:inblock in system_require'
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:in
each' /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:insystem_require'
/usr/share/foreman/config/application.rb:11:in <top (required)>' /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:inrequire'
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in
require&#39; /usr/share/foreman/Rakefile:1:in<top (required)>'
/opt/rh/ruby193/root/usr/share/ruby/rake/rake_module.rb:25:in load&#39; /opt/rh/ruby193/root/usr/share/ruby/rake/rake_module.rb:25:inload_rakefile'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:501:in
raw_load_rakefile&#39; /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:82:inblock in
load_rakefile'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in
standard_exception_handling&#39; /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:81:inload_rakefile'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:65:in block in run&#39; /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:instandard_exception_handling'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:63:in run&#39; /opt/rh/ruby193/root/usr/bin/rake:32:in<main>'

[root]# rpm -q ruby
ruby-1.8.7.374-4.el6_6.x86_64
[root]# rpm -q ruby193-ruby
ruby193-ruby-1.9.3.484-51.el6.x86_64
[root]# ruby --version
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
[root]# scl enable ruby193 "ruby --version"
ruby 1.9.3p484 (2013-11-22) [x86_64-linux]

[root]# scl enable ruby193 v8314 "gem list"

*** LOCAL GEMS ***

actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
ancestry (2.0.0)
apipie-rails (0.0.23)
arel (3.0.2)
audited (3.0.0)
audited-activerecord (3.0.0)
bigdecimal (1.1.0)
bootstrap-sass (3.0.3.0)
builder (3.0.0)
bundler (1.3.5)
bundler_ext (0.3.0)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
daemon_controller (1.1.4)
daemons (1.1.4)
diff-lcs (1.1.3)
diffy (3.0.1)
erubis (2.7.0)
eventmachine (0.12.10)
excon (0.31.0)
execjs (1.4.0)
fast_gettext (0.8.0)
fog (1.19.0)
foreigner (1.4.2)
foreman_bootdisk (2.0.3)
foreman_default_hostgroup (1.1.0)
foreman_templates (1.4.0)
formatador (0.2.1)
gettext_i18n_rails (0.10.0)
gettext_i18n_rails_js (0.0.8)
hike (1.2.1)
i18n (0.6.0)
i18n_data (0.2.7)
io-console (0.3)
journey (1.0.4)
jquery-rails (2.0.2)
jquery-ui-rails (4.0.2)
json (1.5.5)
mail (2.4.4)
mime-types (1.19)
multi_json (1.8.2)
net-http-persistent (2.7)
net-ldap (0.3.1)
net-scp (1.1.0)
net-ssh (2.6.7)
nokogiri (1.5.6)
oauth (0.4.7)
passenger (4.0.18)
pg (0.12.2)
po_to_json (0.0.7)
polyglot (0.3.3)
rabl (0.7.6)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.8)
railties (3.2.8)
rake (0.9.2.2)
rbovirt (0.0.21)
rdoc (3.12)
ref (1.0.0)
rest-client (1.6.1)
ruby-hmac (0.4.0)
ruby2ruby (2.0.1)
ruby_parser (3.1.1)
safemode (1.2.0)
sass (3.2.13)
sass-rails (3.2.5)
scoped_search (2.6.5)
sexp_processor (4.1.3)
sprockets (2.4.5)
therubyracer (0.11.0beta5)
thin (1.3.1)
thor (0.18.1)
tilt (1.3.3)
treetop (1.4.10)
twitter-bootstrap-rails (2.2.6)
tzinfo (0.3.33)
uglifier (1.2.6)
unf (0.1.3)
unf_ext (0.0.6)
uuidtools (2.1.3)
will_paginate (3.0.2)
[root]# gem list

*** LOCAL GEMS ***

ansi (1.4.3)
clamp (0.6.2)
daemon_controller (1.1.4)
fastthread (1.0.7)
foreman_api (0.1.11)
hashie (2.0.5)
highline (1.6.20)
json (1.6.8)
kafo (0.3.17)
little-plugger (1.1.3)
logging (1.8.1)
mime-types (1.16)
multi_json (1.8.2)
oauth (0.4.7)
passenger (4.0.18)
powerbar (1.0.11)
rack (1.2.5)
rake (0.9.2.2)
rdoc (3.12)
rest-client (1.6.1)
stomp (1.2.2)

What's the output of this command: ruby193-ruby -raudited-activerecord
-etrue

The error about "audited/activerecord" (with a slash) is probably a
consequence of "audited-activerecord" (with a hyphen) failing to load,
but that ought to work.

··· On 11/05/16 21:30, askstack98@gmail.com wrote: > I am trying to upgrade foreman 1.3 to 1.4 with the rpm method. Can > anyone help me with this error. Thanks. > > [root]# foreman-rake db:migrate --trace > rake aborted! > Gem loading error: cannot load such file -- audited/activerecord


Dominic Cleal
dominic@cleal.org

Dominic
Thanks. It returns blank.
[root]# ruby193-ruby -raudited-activerecord -etrue

[root]# ruby193-ruby -v -raudited-activerecord -etrue
ruby 1.9.3p484 (2013-11-22) [x86_64-linux]
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/defaults/operating_system.rb:44:
warning: method redefined; discarding old default_dir
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/defaults.rb:21: warning:
previous definition of default_dir was here
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/defaults/operating_system.rb:52:
warning: method redefined; discarding old default_path
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/defaults.rb:63: warning:
previous definition of default_path was here
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/defaults/operating_system.rb:57:
warning: method redefined; discarding old default_bindir
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/defaults.rb:88: warning:
previous definition of default_bindir was here
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/defaults/operating_system.rb:65:
warning: method redefined; discarding old default_ext_dir_for
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/defaults.rb:103: warning:
previous definition of default_ext_dir_for was here
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/core_ext/class/attribute.rb:70:
warning: assigned but unused variable - instance_reader
-e:1: warning: possibly useless use of true in void context

··· On Thursday, May 12, 2016 at 6:19:19 AM UTC-4, Dominic Cleal wrote: > > On 11/05/16 21:30, askst...@gmail.com wrote: > > I am trying to upgrade foreman 1.3 to 1.4 with the rpm method. Can > > anyone help me with this error. Thanks. > > > > [root]# foreman-rake db:migrate --trace > > rake aborted! > > Gem loading error: cannot load such file -- audited/activerecord > > What's the output of this command: ruby193-ruby -raudited-activerecord > -etrue > > The error about "audited/activerecord" (with a slash) is probably a > consequence of "audited-activerecord" (with a hyphen) failing to load, > but that ought to work. > > -- > Dominic Cleal > dom...@cleal.org >

I'd have expected that to fail given the foreman-rake error.

You could next uncomment/add some debug into bundler_ext by editing
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb.
It should have a line like this:

and commenting the puts should print an error when running the
foreman-rake command.

··· On 12/05/16 14:56, askstack98@gmail.com wrote: > Dominic > Thanks. It returns blank. > [root]# ruby193-ruby -raudited-activerecord -etrue


Dominic Cleal
dominic@cleal.org

[root]# foreman-rake db:migrate --trace
Caught error FOREMAN-RAKE: cannot load such file –
active_support/security_utils
rake aborted!
Gem loading error: cannot load such file – audited/activerecord
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:30:in
strict_error&#39; /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:53:inrescue in rescue in block in system_require'
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:43:in
rescue in block in system_require&#39; /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:37:inblock in system_require'
/opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:in
each&#39; /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:insystem_require'
/usr/share/foreman/config/application.rb:11:in &lt;top (required)&gt;&#39; /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:inrequire'
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in
require&#39; /usr/share/foreman/Rakefile:1:in<top (required)>'
/opt/rh/ruby193/root/usr/share/ruby/rake/rake_module.rb:25:in load&#39; /opt/rh/ruby193/root/usr/share/ruby/rake/rake_module.rb:25:inload_rakefile'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:501:in
raw_load_rakefile&#39; /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:82:inblock in
load_rakefile'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in
standard_exception_handling&#39; /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:81:inload_rakefile'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:65:in block in run&#39; /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:instandard_exception_handling'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:63:in run&#39; /opt/rh/ruby193/root/usr/bin/rake:32:in<main>'

··· On Thursday, May 12, 2016 at 10:00:08 AM UTC-4, Dominic Cleal wrote: > > On 12/05/16 14:56, askst...@gmail.com wrote: > > Dominic > > Thanks. It returns blank. > > [root]# ruby193-ruby -raudited-activerecord -etrue > > I'd have expected that to fail given the foreman-rake error. > > You could next uncomment/add some debug into bundler_ext by editing > /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb. > > It should have a line like this: > > > https://github.com/bundlerext/bundler_ext/blob/a3c5a0794d4698938a605a45301d1582ce986082/lib/bundler_ext/bundler_ext.rb#L41 > > and commenting the puts should print an error when running the > foreman-rake command. > > -- > Dominic Cleal > dom...@cleal.org >

No error from this command.
[root]# ruby193-ruby -ractive_support -etrue

··· On Thursday, May 12, 2016 at 10:32:25 AM UTC-4, askst...@gmail.com wrote: > > [root]# foreman-rake db:migrate --trace > Caught error FOREMAN-RAKE: cannot load such file -- > active_support/security_utils > rake aborted! > Gem loading error: cannot load such file -- audited/activerecord > /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:30:in > `strict_error' > /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:53:in > `rescue in rescue in block in system_require' > /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:43:in > `rescue in block in system_require' > /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:37:in > `block in system_require' > /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:in > `each' > /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb:35:in > `system_require' > /usr/share/foreman/config/application.rb:11:in `' > /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in > `require' > /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in > `require' > /usr/share/foreman/Rakefile:1:in `' > /opt/rh/ruby193/root/usr/share/ruby/rake/rake_module.rb:25:in `load' > /opt/rh/ruby193/root/usr/share/ruby/rake/rake_module.rb:25:in > `load_rakefile' > /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:501:in > `raw_load_rakefile' > /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:82:in `block in > load_rakefile' > /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in > `standard_exception_handling' > /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:81:in > `load_rakefile' > /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:65:in `block in > run' > /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in > `standard_exception_handling' > /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:63:in `run' > /opt/rh/ruby193/root/usr/bin/rake:32:in `' > > > On Thursday, May 12, 2016 at 10:00:08 AM UTC-4, Dominic Cleal wrote: >> >> On 12/05/16 14:56, askst...@gmail.com wrote: >> > Dominic >> > Thanks. It returns blank. >> > [root]# ruby193-ruby -raudited-activerecord -etrue >> >> I'd have expected that to fail given the foreman-rake error. >> >> You could next uncomment/add some debug into bundler_ext by editing >> /opt/rh/ruby193/root/usr/share/gems/gems/bundler_ext-0.3.0/lib/bundler_ext/bundler_ext.rb. >> >> It should have a line like this: >> >> >> https://github.com/bundlerext/bundler_ext/blob/a3c5a0794d4698938a605a45301d1582ce986082/lib/bundler_ext/bundler_ext.rb#L41 >> >> and commenting the puts should print an error when running the >> foreman-rake command. >> >> -- >> Dominic Cleal >> dom...@cleal.org >> >

You might have some mismatched ruby193-rubygem-active* and
ruby193-rubygem-action* packages, some with a security fix and some
without that cause this error. The best way to resolve it would be to
check the vendor of each package (rpm -qi) and ensure they're from the
same source.

The source has changed a few times for various reasons and Foreman 1.3
used to contain our builds of them. I'd recommend using the CentOS SCLo
builds from http://mirror.centos.org/centos/6/sclo/x86_64/rh nowadays,
so replace any package with the two prefixes mentioned above with the
SCLo ones - or at least a consistent source.

··· On 12/05/16 15:32, askstack98@gmail.com wrote: > [root]# foreman-rake db:migrate --trace > Caught error FOREMAN-RAKE: cannot load such file -- > active_support/security_utils > rake aborted!


Dominic Cleal
dominic@cleal.org

You are absolutely right. I had a mix of packages from SCL and puppet
repos.

After I re-installed theses packages from SCL, upgrade started to work.

ruby193-rubygem-activerecord-3.2.8-12.el6.noarch

ruby193-rubygem-activesupport-3.2.8-6.el6.noarch

ruby193-rubygem-activeresource-3.2.8-3.el6.noarch

ruby193-rubygem-activemodel-3.2.8-3.el6.noarch

ruby193-rubygem-actionmailer-3.2.8-2.el6.noarch

ruby193-rubygem-actionpack-3.2.8-16.el6.noarch

Thank you so much!

··· On Thursday, May 12, 2016 at 10:37:38 AM UTC-4, Dominic Cleal wrote: > > On 12/05/16 15:32, askst...@gmail.com wrote: > > [root]# foreman-rake db:migrate --trace > > Caught error FOREMAN-RAKE: cannot load such file -- > > active_support/security_utils > > rake aborted! > > You might have some mismatched ruby193-rubygem-active* and > ruby193-rubygem-action* packages, some with a security fix and some > without that cause this error. The best way to resolve it would be to > check the vendor of each package (rpm -qi) and ensure they're from the > same source. > > The source has changed a few times for various reasons and Foreman 1.3 > used to contain our builds of them. I'd recommend using the CentOS SCLo > builds from http://mirror.centos.org/centos/6/sclo/x86_64/rh nowadays, > so replace any package with the two prefixes mentioned above with the > SCLo ones - or at least a consistent source. > > -- > Dominic Cleal > dom...@cleal.org >