Getting Kafo error while running foreman-installer script

Problem:
Getting below error while we are executing foreman-installer script:
[root@w2dapl0048746 modules]# foreman-installer -i --scenario katello
Traceback (most recent call last):
2: from /sbin/foreman-installer:5:in <main>' 1: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require’
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require': cannot load such file -- kafo (LoadError) 18: from /sbin/foreman-installer:5:in
17: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:147:in require' 16: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:158:in rescue in require’
15: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:158:in require' 14: from /usr/local/share/gems/gems/kafo-6.5.0/lib/kafo.rb:3:in <top (required)>’
13: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:94:in require' 12: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:94:in require’
11: from /usr/local/share/gems/gems/kafo-6.5.0/lib/kafo/kafo_configure.rb:17:in <top (required)>' 10: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require’
9: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require' 8: from /usr/local/share/gems/gems/kafo-6.5.0/lib/kafo/configuration.rb:4:in <top (required)>’
7: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require' 6: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require’
5: from /usr/local/share/gems/gems/kafo-6.5.0/lib/kafo/puppet_module.rb:2:in <top (required)>' 4: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require’
3: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require' 2: from /usr/local/share/gems/gems/kafo-6.5.0/lib/kafo/param.rb:3:in <top (required)>’
1: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require' /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in require’: cannot load such file – kafo/data_type (LoadError)

Expected outcome:
It suppose to go the interactive mode to select required modules. I am trying to install it in a Rocky 8 server.

Foreman and Proxy versions:

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

What version of Foreman/Katello are you trying to install?
From the kafo version in your stacktrace, you are at most on 3.6, which is already over a year old.
Is this a fresh install or an upgrade?

Its Fresh install.

https://yum.theforeman.org/releases/3.6/el8/x86_64/foreman-release.rpm
https://yum.theforeman.org/katello/4.8/katello/el8/x86_64/katello-repos-latest.rpm

Just to be sure:
I assume you just installed the release RPMs as well as the Puppet Repo/release RPM, did dnf install foreman-installer-katello and then ran foreman-installer?
Were there any other steps you have taken?

Side note: Is there any specific reason you try to install a release that’s nearly a year old? Only the the two newest versions are usually considered supported, which currently would be 3.9 and 3.8.

Ok currently i am trying with latest versions. But getting same error

[root@xxxxyum.repos.d]# foreman-installer -i --scenario katello --puppet-server true --foreman-proxy-puppet true --puppet-server-ca true --foreman-proxy-puppetca true
Scenarios are being compared, that may take a while…
Traceback (most recent call last):
20: from /sbin/foreman-installer:8:in <main>' 19: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/kafo_configure.rb:54:in run’
18: from /usr/share/gems/gems/clamp-1.3.2/lib/clamp/command.rb:140:in run' 17: from /usr/share/gems/gems/clamp-1.3.2/lib/clamp/command.rb:140:in new’
16: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/kafo_configure.rb:132:in initialize' 15: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/scenario_manager.rb:127:in check_scenario_change’
14: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/scenario_manager.rb:157:in confirm_scenario_change' 13: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/scenario_manager.rb:117:in show_scenario_diff’
12: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/scenario_manager.rb:217:in load_and_setup_configuration' 11: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/configuration.rb:268:in preset_defaults_from_puppet’
10: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/configuration.rb:258:in params' 9: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/configuration.rb:132:in modules’
8: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/configuration.rb:396:in register_data_types' 7: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/configuration.rb:396:in each’
6: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/configuration.rb:397:in block in register_data_types' 5: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/configuration.rb:397:in each’
4: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/configuration.rb:398:in block (2 levels) in register_data_types' 3: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/data_type_parser.rb:37:in register’
2: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/data_type_parser.rb:37:in each' 1: from /usr/share/gems/gems/kafo-7.3.0/lib/kafo/data_type_parser.rb:39:in block in register’
/usr/share/gems/gems/kafo-7.3.0/lib/kafo/data_type.rb:31:in `register_type’: Data type Apache::LogLevel is already registered, cannot be re-registered (ArgumentError)
[root@xxxxxx yum.repos.d]# rpm -qa | grep -i foreman
foreman-installer-3.9.0-1.el8.noarch
foreman-release-3.9.0-1.el8.noarch
foreman-installer-katello-3.9.0-1.el8.noarch
[root@xxxxxx yum.repos.d]#

This is at least a new error.
The most obvious thing I see is, that foreman-installer thinks you are changing scenarios. Did you try to run it with a different scenario before? Does the symlink /etc/foreman-installer/scenarios.d/last_scenario.yaml exist and if so, which file does it link to?

1 Like

Yes its existing

[root@xxxxxxx~]# cat /etc/foreman-installer/scenarios.d/last_scenario.yaml

:answer_file: “/etc/foreman-installer/scenarios.d/foreman-answers.yaml”
:color_of_background: :dark
:colors: true
:custom: {}
:description: Default installation of Foreman
:enabled: true
:facts: {}
:hiera_config: “/usr/share/foreman-installer/config/foreman-hiera.yaml”
:hook_dirs:
:installer_dir: “/usr/share/foreman-installer”
:log_dir: “/var/log/foreman-installer”
:log_level: :debug
:log_name: foreman.log
:low_priority_modules:

  • foreman_proxy_plugin
  • foreman_compute
  • foreman_plugin
    :mapping: {}
    :module_dirs: “/usr/share/foreman-installer/modules”
    :name: Foreman
    :no_prefix: false
    :order:
  • foreman
  • foreman_proxy
  • puppet
    :parser_cache_path: “/usr/share/foreman-installer/parser_cache/foreman.yaml”
    :skip_puppet_version_check: false
    :store_dir: ‘’
    :verbose: true
    :verbose_log_level: notice

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

[root@xxxxxxx~]# cat “/etc/foreman-installer/scenarios.d/foreman-answers.yaml”

Format:

: false - don’t include this class

: true - include and use the defaults

:

: - include and override the default(s)

See params.pp in each class for what options are available


foreman: {}
foreman::cli: true
foreman::cli::ansible: false
foreman::cli::azure: false
foreman::cli::discovery: false
foreman::cli::google: false
foreman::cli::kubevirt: false
foreman::cli::openscap: false
foreman::cli::puppet: true
foreman::cli::remote_execution: false
foreman::cli::ssh: false
foreman::cli::tasks: false
foreman::cli::templates: false
foreman::cli::webhooks: false
foreman::compute::ec2: false
foreman::compute::libvirt: false
foreman::compute::openstack: false
foreman::compute::ovirt: false
foreman::compute::vmware: false
foreman::plugin::acd: false
foreman::plugin::ansible: false
foreman::plugin::azure: false
foreman::plugin::bootdisk: false
foreman::plugin::default_hostgroup: false
foreman::plugin::dhcp_browser: false
foreman::plugin::discovery: false
foreman::plugin::dlm: false
foreman::plugin::expire_hosts: false
foreman::plugin::git_templates: false
foreman::plugin::google: false
foreman::plugin::hooks: false
foreman::plugin::host_extra_validator: false
foreman::plugin::kubevirt: false
foreman::plugin::leapp: false
foreman::plugin::monitoring: false
foreman::plugin::netbox: false
foreman::plugin::omaha: false
foreman::plugin::openscap: false
foreman::plugin::ovirt_provision: false
foreman::plugin::proxmox: false
foreman::plugin::puppet: true
foreman::plugin::puppetdb: false
foreman::plugin::remote_execution: false
foreman::plugin::remote_execution::cockpit: false
foreman::plugin::rescue: false
foreman::plugin::salt: false
foreman::plugin::setup: false
foreman::plugin::snapshot_management: false
foreman::plugin::statistics: false
foreman::plugin::tasks: false
foreman::plugin::templates: false
foreman::plugin::vault: false
foreman::plugin::webhooks: false
foreman::plugin::wreckingball: false
foreman_proxy: {}
foreman_proxy::plugin::acd: false
foreman_proxy::plugin::ansible: false
foreman_proxy::plugin::dhcp::infoblox: false
foreman_proxy::plugin::dhcp::remote_isc: false
foreman_proxy::plugin::discovery: false
foreman_proxy::plugin::dns::infoblox: false
foreman_proxy::plugin::dns::powerdns: false
foreman_proxy::plugin::dns::route53: false
foreman_proxy::plugin::dynflow: false
foreman_proxy::plugin::monitoring: false
foreman_proxy::plugin::omaha: false
foreman_proxy::plugin::openscap: false
foreman_proxy::plugin::remote_execution::script: false
foreman_proxy::plugin::salt: false
foreman_proxy::plugin::shellhooks: false
puppet:
server: true
server_jvm_extra_args:

  • “-Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger”
  • “-XX:ReservedCodeCacheSize=512m”
    apache::mod::status: false

It looks like you might have ran foreman-installer without --scenario katello in the past (or at least you system seems to think so). You do not have any running Foreman services and foreman-installer never went through on anything, right? If yes, try removing the last_scenario.yaml via unlink /etc/foreman-installer/scenarios.d/last_scenario.yaml. I guess that should be save if the installer never got to do something productive. If that does not help, or if you had actually run foreman-installer before without the Katello scenario, I would suggest reinstalling your system.
Switching scenarios (like it tries to) is technichaly possible for kafo (the framework used in foreman-installer), but for Foreman it is not supported and probably not tested.

My command i used is below:

[root@xxxxyum.repos.d]# foreman-installer -i --scenario katello --puppet-server true --foreman-proxy-puppet true --puppet-server-ca true --foreman-proxy-puppetca true

This is tracked in Bug #25657: Data type is already registerd, cannot be re-registered - Kafo - Foreman and does indeed happen when switching scenarios. That’s generally not well supported and I’d recommend against it. Upgrading an instance from vanilla Foreman to Katello has more bugs you may run into.

It works … Unlinking scenario.yaml. Thank you very much !!!

1 Like