You have already activated thor 1.2.1, but your Gemfile requires thor 1.1.0

Hi together.

I got this issue again in foreman 3.2.0 trying to migrate reports into new format.

I cannot Finnish this task because of the following issue.

Problem:

foreman-rake host_reports:migrate
Traceback (most recent call last):
	12: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	11: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	10: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/setup.rb:10:in `<top (required)>'
	 9: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'
	 8: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'
	 7: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/setup.rb:10:in `block in <top (required)>'
	 6: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
	 5: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `setup'
	 4: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `map'
	 3: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
	 2: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
	 1: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:31:in `block in setup'
/usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:312:in `check_for_activated_spec!': You have already activated thor 1.2.1, but your Gemfile requires thor 1.1.0. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

Expected outcome:

Foreman and Proxy versions:
3.2.0

Foreman and Proxy plugin versions:
foreman_fog_proxmox 0.14.0
foreman_memcache 0.1.1
foreman_puppet 3.0.5
puppetry_foreman 5.0.0

Distribution and version:
5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:04:27 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
20.04.4 LTS

Other relevant data:
/var/log/foreman/cron.log

requires thor 1.1.0. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:31:in `block in setup'
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `map'
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `setup'
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `block in <top (required)>'
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'
[2022-04-05 18:00:03] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `<top (required)>'
[2022-04-05 18:00:03] 	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
[2022-04-05 18:00:03] 	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
[2022-04-05 18:30:02] /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:312:in `check_for_activated_spec!': You have already activated thor 1.2.1, but your Gemfile requires thor 1.1.0. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:31:in `block in setup'
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `map'
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `setup'
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `block in <top (required)>'
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'
[2022-04-05 18:30:02] 	from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `<top (required)>'
[2022-04-05 18:30:02] 	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
[2022-04-05 18:30:02] 	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'

/usr/share/foreman % cat Gemfile

# foreman plugins import this file therefore __FILE__ cannot be used
FOREMAN_GEMFILE = __FILE__ unless defined? FOREMAN_GEMFILE

require_relative 'config/boot_settings'

source 'https://rubygems.org'

case SETTINGS[:rails]
when '6.0'
  gem 'rails', '~> 6.0.3.1'
else
  raise "Unsupported Ruby on Rails version configured in settings.yaml: #{SETTINGS[:rails]}"
end

gem 'rest-client', '>= 2.0.0', '< 3', :require => 'rest_client'
gem 'audited', '>= 4.9.0', '< 5'
gem 'will_paginate', '>= 3.1.7', '< 4'
gem 'ancestry', '>= 3.0.7', '< 4', '!= 3.2.0'
gem 'scoped_search', '>= 4.1.8', '< 5'
gem 'ldap_fluff', '>= 0.5.0', '< 1.0'
gem 'apipie-rails', '>= 0.5.17', '< 0.6.0'
gem 'apipie-dsl', '>= 2.2.6'
# Pin rdoc to prevent updating bundled psych (https://github.com/ruby/rdoc/commit/ebe185c8775b2afe844eb3da6fa78adaa79e29a4)
# Rails 6.0 is incompatible with Psych 4, Rails 6.1 should work
gem 'rdoc', '< 6.4'
gem 'rabl', '~> 0.14.2'
gem 'oauth', '>= 0.5.4', '< 1'
gem 'deep_cloneable', '>= 3', '< 4'
gem 'validates_lengths_from_database', '~> 0.5'
gem 'friendly_id', '>= 5.3.0', '< 5.4'
gem 'secure_headers', '~> 6.3'
gem 'safemode', '>= 1.3.5', '< 2'
gem 'fast_gettext', '~> 1.4'
gem 'gettext_i18n_rails', '~> 1.8'
gem 'rails-i18n', '~> 6.0'
gem 'i18n', '~> 1.1'
gem 'logging', '>= 1.8.0', '< 3.0.0'
gem 'fog-core', '2.1.0'
gem 'net-scp'
gem 'net-ssh', '4.2.0'
gem 'net-ldap', '>= 0.16.0'
gem 'net-ping', :require => false
gem 'activerecord-session_store', '>= 2.0.0', '< 3'
gem 'sprockets', '~> 4.0'
gem 'sprockets-rails', '~> 3.0'
gem 'responders', '~> 3.0'
gem 'roadie-rails', '~> 2.0'
gem 'deacon', '~> 1.0'
gem 'webpack-rails', '~> 0.9.8'
gem 'mail', '~> 2.7'
gem 'sshkey', '~> 1.9'
gem 'dynflow', '>= 1.4.4', '< 2.0.0'
gem 'daemons'
gem 'bcrypt', '~> 3.1'
gem 'get_process_mem'
gem 'rack-cors', '~> 1.0.2', require: 'rack/cors'
gem 'jwt', '~> 2.2.2'
gem 'graphql', '~> 1.8.0'
gem 'graphql-batch'

Dir["#{File.dirname(FOREMAN_GEMFILE)}/bundler.d/*.rb"].each do |bundle|
  instance_eval(Bundler.read_file(bundle))
end
gem "thor", "1.1.0"

How can I solve this issue?

BR. Torsten

Two questions:

  • Is this a recently updated Ubuntu version (like from 18.04 to 20.04)?
  • Can you post the contents of /usr/sbin/foreman-rake?

This setup starts with Ubuntu 20.04LTS clean installation

#!/bin/bash
USERNAME=$(/usr/bin/id -un)
RAKE_CMD=/usr/bin/rake
BUNDLER_CMD="/usr/bin/foreman-ruby /usr/bin/bundle2.7 exec"

die() {
  echo $*; exit 1
}

cd ~foreman || die "Cannot change to foreman home directory"
[ -f Gemfile ] && [[ -z ${BUNDLER_CMD// } ]] && BUNDLER_CMD="bundle exec"
CMD="$BUNDLER_CMD $RAKE_CMD"
if [ $# -eq 0 ]; then
  $RAKE_CMD -h; exit 0;
elif [ "$USERNAME" = foreman ]; then
  RUBYOPT=-W0 RAILS_ENV=production $CMD "$@"
else
  su foreman -s /bin/bash -c 'RUBYOPT=-W0 RAILS_ENV=production "$0" "$@"' -- $CMD "$@"
fi

This… doesn’t make much sense to me yet. Can you show a bash -x /usr/sbin/foreman-rake -T please? Oh, and the contents of /usr/share/foreman/Gemfile.lock too.

bash -x /usr/sbin/foreman-rake -T
++ /usr/bin/id -un
+ USERNAME=root
+ RAKE_CMD=/usr/bin/rake
+ BUNDLER_CMD='/usr/bin/foreman-ruby /usr/bin/bundle2.7 exec'
+ cd /usr/share/foreman
+ '[' -f Gemfile ']'
+ [[ -z /usr/bin/foreman-ruby/usr/bin/bundle2.7exec ]]
+ CMD='/usr/bin/foreman-ruby /usr/bin/bundle2.7 exec /usr/bin/rake'
+ '[' 1 -eq 0 ']'
+ '[' root = foreman ']'
+ su foreman -s /bin/bash -c 'RUBYOPT=-W0 RAILS_ENV=production "$0" "$@"' -- /usr/bin/foreman-ruby /usr/bin/bundle2.7 exec /usr/bin/rake -T
Traceback (most recent call last):
	12: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	11: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
	10: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/setup.rb:10:in `<top (required)>'
	 9: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'
	 8: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'
	 7: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/setup.rb:10:in `block in <top (required)>'
	 6: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
	 5: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `setup'
	 4: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:26:in `map'
	 3: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
	 2: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/spec_set.rb:147:in `each'
	 1: from /usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:31:in `block in setup'
/usr/share/rubygems-integration/all/gems/bundler-2.1.4/lib/bundler/runtime.rb:312:in `check_for_activated_spec!': You have already activated thor 1.2.1, but your Gemfile requires thor 1.1.0. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
cat Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:
    actioncable (6.0.3.7)
      actionpack (= 6.0.3.7)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (6.0.3.7)
      actionpack (= 6.0.3.7)
      activejob (= 6.0.3.7)
      activerecord (= 6.0.3.7)
      activestorage (= 6.0.3.7)
      activesupport (= 6.0.3.7)
      mail (>= 2.7.1)
    actionmailer (6.0.3.7)
      actionpack (= 6.0.3.7)
      actionview (= 6.0.3.7)
      activejob (= 6.0.3.7)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (6.0.3.7)
      actionview (= 6.0.3.7)
      activesupport (= 6.0.3.7)
      rack (~> 2.0, >= 2.0.8)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (6.0.3.7)
      actionpack (= 6.0.3.7)
      activerecord (= 6.0.3.7)
      activestorage (= 6.0.3.7)
      activesupport (= 6.0.3.7)
      nokogiri (>= 1.8.5)
    actionview (6.0.3.7)
      activesupport (= 6.0.3.7)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (6.0.3.7)
      activesupport (= 6.0.3.7)
      globalid (>= 0.3.6)
    activemodel (6.0.3.7)
      activesupport (= 6.0.3.7)
    activerecord (6.0.3.7)
      activemodel (= 6.0.3.7)
      activesupport (= 6.0.3.7)
    activerecord-session_store (2.0.0)
      actionpack (>= 5.2.4.1)
      activerecord (>= 5.2.4.1)
      multi_json (~> 1.11, >= 1.11.2)
      rack (>= 2.0.8, < 3)
      railties (>= 5.2.4.1)
    activestorage (6.0.3.7)
      actionpack (= 6.0.3.7)
      activejob (= 6.0.3.7)
      activerecord (= 6.0.3.7)
      marcel (~> 1.0.0)
    activesupport (6.0.3.7)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
      zeitwerk (~> 2.2, >= 2.2.2)
    addressable (2.8.0)
      public_suffix (>= 2.0.2, < 5.0)
    algebrick (0.7.5)
    ancestry (3.2.1)
      activerecord (>= 4.2.0)
    apipie-dsl (2.4.0)
    apipie-params (0.0.5)
    apipie-rails (0.5.19)
      rails (>= 4.1)
    audited (4.10.0)
      activerecord (>= 4.2, < 6.2)
    bcrypt (3.1.17)
    builder (3.2.4)
    colorize (0.8.1)
    concurrent-ruby (1.1.9)
    concurrent-ruby-edge (0.6.0)
      concurrent-ruby (~> 1.1.6)
    connection_pool (2.2.5)
    crass (1.0.6)
    css_parser (1.11.0)
      addressable
    daemons (1.4.1)
    dalli (2.7.8)
    deacon (1.0.0)
    deep_cloneable (3.2.0)
      activerecord (>= 3.1.0, < 8)
    deface (1.5.3)
      nokogiri (>= 1.6)
      polyglot
      rails (>= 4.1)
      rainbow (>= 2.1.0)
    domain_name (0.5.20190701)
      unf (>= 0.0.5, < 1.0.0)
    dynflow (1.6.5)
      algebrick (~> 0.7.0)
      apipie-params
      concurrent-ruby (~> 1.1.3)
      concurrent-ruby-edge (~> 0.6.0)
      msgpack (~> 1.3, >= 1.3.3)
      multi_json
      sequel (>= 4.0.0)
    erubi (1.10.0)
    excon (0.92.0)
    facter (4.2.7)
      hocon (~> 1.3)
      thor (>= 1.0.1, < 2.0)
    fast_gettext (1.8.0)
    ffi (1.15.5)
    fog-core (2.1.0)
      builder
      excon (~> 0.58)
      formatador (~> 0.2)
      mime-types
    fog-json (1.2.0)
      fog-core
      multi_json (~> 1.10)
    fog-libvirt (0.9.0)
      fog-core (>= 1.27.4)
      fog-json
      fog-xml (~> 0.1.1)
      json
      ruby-libvirt (>= 0.7.0)
    fog-proxmox (0.14.0)
      fog-core (~> 2.1)
      fog-json (~> 1.2)
      ipaddress (~> 0.8)
    fog-xml (0.1.4)
      fog-core
      nokogiri (>= 1.5.11, < 2.0.0)
    foreman_fog_proxmox (0.14.0)
      deface
      fog-proxmox (~> 0.14)
    foreman_host_reports (1.0.2)
    foreman_memcache (0.1.1)
      dalli
    foreman_puppet (3.0.5)
    formatador (0.3.0)
    friendly_id (5.3.0)
      activerecord (>= 4.0.0)
    get_process_mem (0.2.7)
      ffi (~> 1.0)
    gettext_i18n_rails (1.8.1)
      fast_gettext (>= 0.9.0)
    gitlab-sidekiq-fetcher (0.6.1)
      sidekiq (>= 5, < 6.1)
    globalid (1.0.0)
      activesupport (>= 5.0)
    graphql (1.8.18)
    graphql-batch (0.4.3)
      graphql (>= 1.3, < 2)
      promise.rb (~> 0.7.2)
    hocon (1.3.1)
    http-accept (1.7.0)
    http-cookie (1.0.4)
      domain_name (~> 0.5)
    i18n (1.10.0)
      concurrent-ruby (~> 1.0)
    ipaddress (0.8.3)
    json (2.6.1)
    jwt (2.2.3)
    ldap_fluff (0.6.0)
      activesupport
      net-ldap (>= 0.11)
    little-plugger (1.1.4)
    logging (2.3.0)
      little-plugger (~> 1.1)
      multi_json (~> 1.14)
    loofah (2.15.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (1.0.2)
    method_source (1.0.0)
    mime-types (3.4.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2022.0105)
    mini_mime (1.1.2)
    mini_portile2 (2.8.0)
    minitest (5.15.0)
    msgpack (1.4.5)
    multi_json (1.15.0)
    net-ldap (0.17.0)
    net-ping (2.0.8)
    net-scp (3.0.0)
      net-ssh (>= 2.6.5, < 7.0.0)
    net-ssh (4.2.0)
    net_http_unix (0.2.2)
    netrc (0.11.0)
    nio4r (2.5.8)
    nokogiri (1.13.3)
      mini_portile2 (~> 2.8.0)
      racc (~> 1.4)
    oauth (0.5.8)
    parallel (1.21.0)
    pg (1.3.4)
    polyglot (0.3.5)
    promise.rb (0.7.4)
    public_suffix (4.0.6)
    puma (5.6.2)
      nio4r (~> 2.0)
    puma-status (1.4)
      colorize (~> 0.8)
      net_http_unix (~> 0.2)
      parallel (~> 1)
    puppetdb_foreman (5.0.0)
    rabl (0.14.5)
      activesupport (>= 2.3.14)
    racc (1.6.0)
    rack (2.2.3)
    rack-cors (1.0.6)
      rack (>= 1.6.0)
    rack-jsonp (1.3.1)
      rack
    rack-protection (2.2.0)
      rack
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (6.0.3.7)
      actioncable (= 6.0.3.7)
      actionmailbox (= 6.0.3.7)
      actionmailer (= 6.0.3.7)
      actionpack (= 6.0.3.7)
      actiontext (= 6.0.3.7)
      actionview (= 6.0.3.7)
      activejob (= 6.0.3.7)
      activemodel (= 6.0.3.7)
      activerecord (= 6.0.3.7)
      activestorage (= 6.0.3.7)
      activesupport (= 6.0.3.7)
      bundler (>= 1.3.0)
      railties (= 6.0.3.7)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.4.2)
      loofah (~> 2.3)
    rails-i18n (6.0.0)
      i18n (>= 0.7, < 2)
      railties (>= 6.0.0, < 7)
    railties (6.0.3.7)
      actionpack (= 6.0.3.7)
      activesupport (= 6.0.3.7)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.20.3, < 2.0)
    rainbow (3.0.0)
    rake (13.0.6)
    rdoc (6.3.3)
    redis (4.5.1)
    responders (3.0.1)
      actionpack (>= 5.0)
      railties (>= 5.0)
    rest-client (2.1.0)
      http-accept (>= 1.7.0, < 2.0)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 4.0)
      netrc (~> 0.8)
    roadie (4.0.0)
      css_parser (~> 1.4)
      nokogiri (~> 1.8)
    roadie-rails (2.3.0)
      railties (>= 5.1, < 7.1)
      roadie (>= 3.1, < 5.0)
    ruby-libvirt (0.8.0)
    ruby2ruby (2.4.4)
      ruby_parser (~> 3.1)
      sexp_processor (~> 4.6)
    ruby_parser (3.18.1)
      sexp_processor (~> 4.16)
    safemode (1.3.6)
      ruby2ruby (>= 2.4.0)
      ruby_parser (>= 3.10.1)
      sexp_processor (>= 4.10.0)
    scoped_search (4.1.10)
      activerecord (>= 4.2.0)
    sd_notify (0.1.1)
    secure_headers (6.3.3)
    sequel (5.54.0)
    sexp_processor (4.16.0)
    sidekiq (5.2.10)
      connection_pool (~> 2.2, >= 2.2.2)
      rack (~> 2.0)
      rack-protection (>= 1.5.0)
      redis (~> 4.5, < 4.6.0)
    sprockets (4.0.3)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.4.2)
      actionpack (>= 5.2)
      activesupport (>= 5.2)
      sprockets (>= 3.0.0)
    sshkey (1.9.0)
    thor (1.1.0)
    thread_safe (0.3.6)
    tzinfo (1.2.9)
      thread_safe (~> 0.1)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.8.1)
    validates_lengths_from_database (0.8.0)
      activerecord (>= 4)
    webpack-rails (0.9.11)
      railties (>= 3.2.0)
    websocket-driver (0.7.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    will_paginate (3.3.1)
    zeitwerk (2.5.4)

PLATFORMS
  ruby

DEPENDENCIES
  activerecord-session_store (>= 2.0.0, < 3)
  ancestry (>= 3.0.7, < 4, != 3.2.0)
  apipie-dsl (>= 2.2.6)
  apipie-rails (>= 0.5.17, < 0.6.0)
  audited (>= 4.9.0, < 5)
  bcrypt (~> 3.1)
  daemons
  deacon (~> 1.0)
  deep_cloneable (>= 3, < 4)
  deface (= 1.5.3)
  dynflow (>= 1.4.4, < 2.0.0)
  facter
  fast_gettext (~> 1.4)
  fog-core (= 2.1.0)
  fog-libvirt (>= 0.9.0)
  fog-proxmox (= 0.14.0)
  foreman_fog_proxmox (= 0.14.0)
  foreman_host_reports (= 1.0.2)
  foreman_memcache (= 0.1.1)
  foreman_puppet (= 3.0.5)
  friendly_id (>= 5.3.0, < 5.4)
  get_process_mem
  gettext_i18n_rails (~> 1.8)
  gitlab-sidekiq-fetcher
  graphql (~> 1.8.0)
  graphql-batch
  i18n (~> 1.1)
  jwt (~> 2.2.2)
  ldap_fluff (>= 0.5.0, < 1.0)
  logging (>= 1.8.0, < 3.0.0)
  mail (~> 2.7)
  net-ldap (>= 0.16.0)
  net-ping
  net-scp
  net-ssh (= 4.2.0)
  oauth (>= 0.5.4, < 1)
  pg (>= 0.18, < 2.0)
  puma (~> 5.1)
  puma-status
  puppetdb_foreman (= 5.0.0)
  rabl (~> 0.14.2)
  rack-cors (~> 1.0.2)
  rack-jsonp
  rails (~> 6.0.3.1)
  rails-i18n (~> 6.0)
  rdoc (< 6.4)
  responders (~> 3.0)
  rest-client (>= 2.0.0, < 3)
  roadie-rails (~> 2.0)
  ruby-libvirt (~> 0.5)
  safemode (>= 1.3.5, < 2)
  scoped_search (>= 4.1.8, < 5)
  sd_notify (~> 0.1)
  secure_headers (~> 6.3)
  sidekiq (~> 5.0)
  sprockets (~> 4.0)
  sprockets-rails (~> 3.0)
  sshkey (~> 1.9)
  thor (= 1.1.0)
  validates_lengths_from_database (~> 0.5)
  webpack-rails (~> 0.9.8)
  will_paginate (>= 3.1.7, < 4)

BUNDLED WITH
   2.1.4
  • ls -alh /usr/share/foreman/vendor/cache/thor*
  • dpkg -S /usr/share/foreman/vendor/cache/thor*
  • dpkg -l

(grasping at straws here, honestly)

ls -alh /usr/share/foreman/vendor/cache/thor*
-rw-r--r-- 1 foreman foreman 56K Mar 15 17:36 /usr/share/foreman/vendor/cache/thor-1.1.0.gem

dpkg -S /usr/share/foreman/vendor/cache/thor*
foreman: /usr/share/foreman/vendor/cache/thor-1.1.0.gem

list for dpkg -l Is to big. can I upload a file?

ii  foreman                               3.2.0-1                            amd64        Systems management web interface
ii  foreman-cli                           3.2.0-1                            all          metapackage providing hammer CLI for Foreman
ii  foreman-debug                         3.2.0-1                            all          provides support utility foreman-debug.
ii  foreman-dynflow-sidekiq               3.2.0-1                            all          package providing dynflow sidekiq services for Foreman
ii  foreman-installer                     3.2.0-1                            all          Automated puppet-based installer for The Foreman
ii  foreman-libvirt                       3.2.0-1                            all          metapackage providing libvirt dependencies for Foreman
ii  foreman-postgresql                    3.2.0-1                            all          metapackage providing PostgreSQL dependencies for Foreman
ii  foreman-proxy                         3.2.0-1                            all          RESTful proxies for DNS, DHCP, TFTP, and Puppet
ii  foreman-service                       3.2.0-1                            all          package providing Foreman services running via
..
ii  ruby                                  1:2.7+1                            amd64        Interpreter of object-oriented scripting language Ruby (default version)
ii  ruby-amazing-print                    1.1.0-1                            all          Pretty print Ruby objects with proper indentation and colors
ii  ruby-ansi                             1.5.0-1                            all          ANSI escape codes at your fingertips
ii  ruby-apipie-bindings                  0.4.0-1                            all          Ruby bindings for Apipie documented APIs
ii  ruby-augeas                           1:0.5.0-3build7                    amd64        Augeas bindings for the Ruby language
ii  ruby-bundler                          2.1.4-1                            all          Manage Ruby application dependencies (runtime)
ii  ruby-bundler-ext                      0.4.1-1                            all          Load system gems via Bundler DSL
ii  ruby-clamp                            1.1.1-1                            all          minimal framework for Ruby command-line utilities
ii  ruby-concurrent                       1.1.6+dfsg-3                       all          modern concurrency tools for Ruby
ii  ruby-dev:amd64                        1:2.7+1                            amd64        Header files for compiling extension modules for Ruby (default version)
ii  ruby-domain-name                      0.5.20160216-2                     all          Domain Name manipulation library for Ruby
ii  ruby-excon                            0.72.0-2                           all          Ruby library for creating fast, persistent, HTTP(S) connections
ii  ruby-fast-gettext                     2.0.0-1                            all          Fast GetText implementation for Ruby
ii  ruby-ffi                              1.12.2+dfsg-2build2                amd64        load dynamic libraries, bind functions from within ruby code
ii  ruby-foreman-deface                   1.5.3-1                            all          Foreman Deface Plugin Dependency
ii  ruby-foreman-fog-proxmox              0.14.0-2                           all          Foreman plugin that adds Proxmox VE compute resource using fog-proxmox
ii  ruby-foreman-host-reports             1.0.2-1                            all          Foreman Host Reports
ii  ruby-foreman-memcache                 0.1.1-1                            all          Foreman Memcache Plugin
ii  ruby-foreman-puppet                   3.0.5-1                            all          Foreman Puppet Plugin
ii  ruby-gssapi                           1.2.0-1                            all          FFI wrapper around the system GSSAPI library
ii  ruby-hammer-cli                       3.1.0-1                            all          Universal command-line interface
ii  ruby-hammer-cli-foreman               3.1.0-1                            all          Foreman commands for Hammer
ii  ruby-hammer-cli-foreman-puppet        0.0.4-1                            all          Foreman Puppet plugin for Hammer CLI
ii  ruby-hashie                           3.5.5-2                            all          small collection of tools that make hashes more powerful
ii  ruby-highline                         2.0.3-1                            all          high-level interactive IO Ruby library
ii  ruby-http-cookie                      1.0.3-1                            all          Ruby library to handle HTTP Cookies based on RFC 6265
ii  ruby-json                             2.3.0+dfsg-1build1                 amd64        JSON library for Ruby
ii  ruby-jwt                              2.2.1-1                            all          JSON Web Token implementation in Ruby
ii  ruby-kafo                             6.4.0-1                            all          Ruby gem for making installations based on puppet user friendly
ii  ruby-kafo-parsers                     1.2.1-1                            all          Puppet module parsers
ii  ruby-kafo-wizards                     0.0.1-1                            all          Wizard like interfaces in terminal
ii  ruby-libvirt                          0.7.1-1build1                      amd64        Ruby bindings for libvirt
ii  ruby-little-plugger                   1.1.4-1                            all          module that provides Gem based plugin management
ii  ruby-locale                           2.1.2-1                            all          Locale library for Ruby
ii  ruby-logging                          2.2.2-1                            all          flexible and extendable logging library for Ruby
ii  ruby-mime-types                       3.3.1-1                            all          guess MIME type of files
ii  ruby-mime-types-data                  3.2015.1120-1                      all          registry for information about MIME media type definitions
ii  ruby-minitest                         5.13.0-1                           all          Ruby test tools supporting TDD, BDD, mocking, and benchmarking
ii  ruby-molinillo                        0.6.4-1                            all          generic dependency resolution algorithm
ii  ruby-multi-json                       1.14.1-1                           all          Ruby library to provide easy switching between different JSON backends
ii  ruby-mustermann                       1.0.0-4                            all          use patterns like regular expressions
ii  ruby-net-http-persistent              2.9.4-2                            all          Manages persistent connections using Net::HTTP
ii  ruby-net-telnet                       0.1.1-2                            all          telnet client library
ii  ruby-netrc                            0.11.0-3                           all          Ruby library to read and write netrc files
ii  ruby-oauth                            0.5.4-1                            all          Ruby library for OAuth core
ii  ruby-oj:amd64                         3.10.1-1build1                     amd64        fast JSON parser and serializer for Ruby
ii  ruby-power-assert                     1.1.7-1                            all          library showing values of variables and method calls in an expression
ii  ruby-powerbar                         1.0.18-1                           all          progressbar library for Ruby
ii  ruby-puppetdb-foreman                 5.0.0-2                            all          Foreman Puppetdb Plugin
ii  ruby-rack                             2.0.7-2ubuntu0.1                   all          modular Ruby webserver interface
ii  ruby-rack-protection                  2.0.8.1-1                          all          Protects against typical web attacks for Rack apps
ii  ruby-rb-inotify                       0.9.10-1                           all          Ruby wrapper for Linux's inotify, using FFI
ii  ruby-redfish-client                   0.5.2-1                            all          Simple Redfish client library
ii  ruby-rest-client                      2.0.2-3.1                          all          simple REST client for Ruby
ii  ruby-rkerberos                        0.1.3-3                            amd64        Kerberos binding for Ruby
ii  ruby-rsec                             0.4.2-1                            all          Parser / Regexp Combinator For Ruby
ii  ruby-rubyipmi                         0.11.0-1                           all          A ruby wrapper for ipmi command line tools that supports ipmitool and freeipmi
ii  ruby-sd-notify                        0.1.0-1                            all          Pure Ruby implementation of systemd's sd_notify(3)
ii  ruby-server-sent-events               0.1.2-1                            all          Library for dealing with server-sent events
ii  ruby-sinatra                          2.0.8.1-1                          all          Ruby web-development dressed in a DSL
ii  ruby-smart-proxy-reports              1.0.0-1                            all          Provides an API for configuration management platforms like
ii  ruby-sqlite3                          1.4.2-2build1                      amd64        SQLite3 interface for Ruby
ii  ruby-test-unit                        3.3.5-1                            all          unit testing framework for Ruby
ii  ruby-thor                             1.1.0-1                            all          Thor is a toolkit for building powerful command-line interfaces.
ii  ruby-tilt                             2.0.10-1                           all          Generic interface to multiple Ruby template engines
ii  ruby-unf                              0.1.4-2                            all          Wrapper library to bring Unicode Normalization Form support to Ruby
ii  ruby-unf-ext                          0.0.7.6-1build1                    amd64        Unicode Normalization Form support library for CRuby
ii  ruby-unicode                          0.4.4-2build9                      amd64        Unicode string manipulation library for Ruby
ii  ruby-unicode-display-width            1.1.3-1                            all          Determines the monospace display width of a string in Ruby
ii  ruby-xmlrpc                           0.3.0-2                            all          XMLRPC library for Ruby
ii  ruby2.7                               2.7.0-5ubuntu1.6                   amd64        Interpreter of object-oriented scripting language Ruby
ii  ruby2.7-dev:amd64                     2.7.0-5ubuntu1.6                   amd64        Header files for compiling extension modules for the Ruby 2.7
ii  ruby2.7-doc                           2.7.0-5ubuntu1.6                   all          Documentation for Ruby 2.7
ii  rubygems-integration                  1.16                               all          integration of Debian Ruby packages with Rubygems
..
ii  puppet-agent                          7.15.0-1focal                      amd64        The Puppet Agent package contains all of the elements needed to run puppet, including ruby, facter, and hiera.
ii  puppet-agent-oauth                    0.5.5-1                            all          OAuth Core Ruby implementation for Puppet Agent
ii  puppet7-release                       7.0.0-2focal                       all          Release packages for the Puppet 7 repository
ii  puppetdb                              7.10.0-1focal                      all          Puppet Labs puppetdb
ii  puppetserver                          7.6.1-1focal                       all          Puppet Labs puppetserver

I found one thing:

but I am not sure how can I fix it:

find / -name thor
/home/gitlab-runner/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/info/thor
/opt/puppetlabs/server/data/puppetserver/dropsonde/bin/thor
**/opt/puppetlabs/server/data/puppetserver/dropsonde/gems/thor-1.2.1/bin/thor**
**/opt/puppetlabs/server/data/puppetserver/dropsonde/gems/thor-1.2.1/lib/thor**
/opt/puppetlabs/puppet/bin/thor
/opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.1.0/bin/thor
/opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor
/opt/puppetlabs/puppet/lib/ruby/2.7.0/bundler/vendor/thor
/opt/puppetlabs/puppet/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor
**/var/lib/gems/2.7.0/gems/thor-1.2.1/bin/thor**
**/var/lib/gems/2.7.0/gems/thor-1.2.1/lib/thor**
/usr/bin/thor
/usr/local/bin/thor
/usr/share/foreman/vendor/ruby/2.7.0/bin/thor
/usr/share/foreman/vendor/ruby/2.7.0/gems/thor-1.1.0/bin/thor
/usr/share/foreman/vendor/ruby/2.7.0/gems/thor-1.1.0/lib/thor
/usr/share/rubygems-integration/all/gems/thor-1.1.0/bin/thor
/usr/share/rubygems-integration/all/gems/thor-1.1.0/lib/thor
/usr/lib/ruby/2.7.0/bundler/vendor/thor
/usr/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor
/root/.oh-my-zsh/plugins/thor
/root/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/info/thor

is this a reason, why I have this issue? but normally I understand that the gem files in the foreman folder are defined for the foreman or not?

This is most probably the culprit here, yeah.

Where does that come from?! Are there more gems in /var/lib/gems/2.7.0/gems/? On my setup, this folder doesn’t even exist, as there shouldn’t be any gems installed by gem install on the system.

Yeah, we ship our deps in /usr/share/foreman/vendor, but if things are installed system wide, they are still visible to Ruby and thor is special as it’s a dependency of bundler and that’s what probably loads it for you “too early” before our stuff kicks in.

good question. I got a puppet server update last days.

I can try to remove this folder. this is may a puppet labs plugin, but no idea from which is coming.

Nah, Puppet should be doing all its stuff in /opt/puppetlabs/ (in a similar-ish fashion to what we do), so I’d assume it’s not it.

ok. I found the issue now.

I use a git CI/CD process which is doing the following:

---

before_script:
  - /bin/bundle install --gemfile=./.gitlab/ci/Gemfile

stages:
  - syntax
  - lint
  - deploy

lint:
  stage: lint
  script:
    - BUNDLE_GEMFILE=./.gitlab/ci/Gemfile /bin/bundle exec rake --rakefile ./.gitlab/ci/rakefile_lint lint

syntax-manifests:
  stage: syntax
  script:
    - BUNDLE_GEMFILE=./.gitlab/ci/Gemfile /bin/bundle exec rake --rakefile ./.gitlab/ci/rakefile_syntax syntax:manifests

syntax-templates:
  stage: syntax
  script:
    - BUNDLE_GEMFILE=./.gitlab/ci/Gemfile /bin/bundle exec rake --rakefile ./.gitlab/ci/rakefile_syntax syntax:templates

syntax-hiera:
  stage: syntax
  script:
    - BUNDLE_GEMFILE=./.gitlab/ci/Gemfile /bin/bundle exec rake --rakefile ./.gitlab/ci/rakefile_syntax syntax:hiera

deploy-code:
  stage: deploy
  script:
    - ./.gitlab/ci/puppet_deploy.sh $CI_COMMIT_BRANCH

in this case gem-files will be installed into the folder. also thor1.2.0. this is the problem. I will check how I can fix it

source "https://rubygems.org"

gem "puppet-syntax"
gem "puppet-lint"
gem "puppet", '7.15.0'
gem "thor",  '1.1.0'

this should fix the issue. thanks for your support and brain at this point :smiley:

1 Like

BUT:

foreman-rake host_reports:migrate
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
Starting, 2431 report(s) left
Error when processing report ID=279
#<ConfigReport id: 279, host_id: 1, reported_at: [FILTERED], created_at: "2022-03-28 07:58:38", updated_at: "2022-03-28 07:58:38", status: 0, metrics: "---\nresources: !ruby/hash:ActiveSupport::HashWithI...", type: "ConfigReport", origin: "Puppet">
To resume the process:

***

foreman-rake host_reports:migrate from_id=279 from_date=1980-01-15

***

rake aborted!
ArgumentError: No unique index found for name
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/insert_all.rb:65:in `find_unique_index_for'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/insert_all.rb:17:in `initialize'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/persistence.rb:243:in `new'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/persistence.rb:243:in `upsert_all'
/usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_host_reports-1.0.2/lib/tasks/migrate.rake:181:in `block (3 levels) in <top (required)>'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/relation/batches.rb:70:in `block (2 levels) in find_each'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/relation/batches.rb:70:in `each'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/relation/batches.rb:70:in `block in find_each'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/relation/batches.rb:136:in `block in find_in_batches'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/relation/batches.rb:238:in `block in in_batches'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/relation/batches.rb:222:in `loop'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/relation/batches.rb:222:in `in_batches'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/relation/batches.rb:135:in `find_in_batches'
/usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.0.3.7/lib/active_record/relation/batches.rb:69:in `find_each'
/usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_host_reports-1.0.2/lib/tasks/migrate.rake:165:in `block (2 levels) in <top (required)>'
/usr/share/foreman/vendor/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
Tasks: TOP => host_reports:migrate
(See full trace by running task with --trace)

Ok. I did it from new and now it was running fine. Thanks a lot.

Great, yeah, if it now fails in the actual host_reports:migrate code, then at least I’m off the hook, because I have no idea about host_reports :smiley:

Yes, I will go to the other post and send a message into that. Tanks for your support so much.

1 Like