Katello 4.3 Installation errors

Problem:
2022-01-31 05:29:29 [ERROR ] [configure] ‘/usr/sbin/foreman-rake db:migrate’ returned 1 instead of one of [0]
2022-01-31 05:29:29 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: change from ‘notrun’ to [‘0’] failed: ‘/usr/sbin/foreman-rake db:migrate’ returned 1 instead of one of [0]
2022-01-31 05:29:51 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: Failed to call refresh: ‘/usr/sbin/foreman-rake db:migrate’ returned 1 instead of one of [0]
2022-01-31 05:29:51 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: ‘/usr/sbin/foreman-rake db:migrate’ returned 1 instead of one of [0]

Expected outcome:
Clean install

Foreman and Proxy versions:
Foreman 3.1, Katello 4.3

Foreman and Proxy plugin versions:

Distribution and version:
CentOS 7

Other relevant data:
Fresh OS install
Data disks blank/formatted
Repos configred as per Install Docs

[root@katello ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.exabytes.com.my
 * centos-sclo-rh: centos.exabytes.com.my
 * epel: epel.mirror.angkasa.id
 * extras: centos.exabytes.com.my
 * updates: centos.exabytes.com.my
repo id                          repo name                                                                    status
base/7/x86_64                    CentOS-7 - Base                                                              10,072
centos-sclo-rh/x86_64            CentOS-7 - SCLo rh                                                            7,819
*epel/x86_64                     Extra Packages for Enterprise Linux 7 - x86_64                               13,718
extras/7/x86_64                  CentOS-7 - Extras                                                               500
foreman/x86_64                   Foreman 3.1                                                                     627
foreman-plugins/x86_64           Foreman plugins 3.1                                                             406
katello/x86_64                   Katello 4.3                                                                     102
katello-candlepin/x86_64         Candlepin: an open source entitlement management system.                          4
pulpcore/x86_64                  pulpcore: Fetch, Upload, Organize, and Distribute Software Packages.            222
puppet6/x86_64                   Puppet 6 Repository el 7 - x86_64                                               335
updates/7/x86_64                 CentOS-7 - Updates                                                            3,369
repolist: 37,174
[root@katello ~]# 

# foreman-installer --scenario katello  \
                    --foreman-initial-admin-password password123 \
                    --foreman-initial-organization Innes \
                    --foreman-initial-location Laptop \
                    --enable-foreman-plugin-bootdisk \
                    --enable-foreman-compute-libvirt \
                    --enable-foreman-plugin-remote-execution \
                    --enable-foreman-proxy-plugin-remote-execution-ssh \
                    --foreman-proxy-tftp true \
                    --foreman-proxy-tftp-listen-on both \
                    --enable-foreman-plugin-openscap \
                    --enable-foreman-proxy-plugin-openscap
2022-01-31 05:17:35 [NOTICE] [root] Loading installer configuration. This will take some time.
2022-01-31 05:17:40 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2022-01-31 05:17:40 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2022-01-31 05:21:44 [NOTICE] [configure] Starting system configuration.
2022-01-31 05:24:04 [NOTICE] [configure] 250 configuration steps out of 1808 steps complete.
2022-01-31 05:25:23 [NOTICE] [configure] 500 configuration steps out of 1808 steps complete.
2022-01-31 05:25:37 [NOTICE] [configure] 750 configuration steps out of 1810 steps complete.
2022-01-31 05:27:28 [NOTICE] [configure] 1000 configuration steps out of 1816 steps complete.
2022-01-31 05:27:35 [NOTICE] [configure] 1250 configuration steps out of 1834 steps complete.
2022-01-31 05:29:29 [ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2022-01-31 05:29:29 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: change from 'notrun' to ['0'] failed: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2022-01-31 05:29:51 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: Failed to call refresh: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2022-01-31 05:29:51 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2022-01-31 05:30:03 [NOTICE] [configure] 1500 configuration steps out of 1834 steps complete.
2022-01-31 05:31:04 [NOTICE] [configure] 1750 configuration steps out of 1834 steps complete.
2022-01-31 05:31:28 [NOTICE] [configure] System configuration has finished.

  There were errors detected during install.
  Please address the errors and re-run the installer to ensure the system is properly configured.
  Failing to do so is likely to result in broken functionality.

  The full log is at /var/log/foreman-installer/katello.log

I have also performed the install on a fresh CentOS 8 install and received the same errors. The CentOS 8 server then threw up a load more errors which the CentOS 7 systems hasn’t.

Hello,
Could you provide the output of:

foreman-rake db:migrate

Might give a clue on where the migration breaks.

[root@katello ~]# foreman-rake db:migrate
Apipie cache enabled but not present yet. Run apipie:cache rake task to speed up API calls.
== 20200803065041 MigratePortOverridesForAnsible: migrating ===================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

uninitialized constant MigratePortOverridesForAnsible::AnsibleRole
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-5.1.0/db/migrate/20200803065041_migrate_port_overrides_for_ansible.rb:14:in `transform_lookup_values'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-5.1.0/db/migrate/20200803065041_migrate_port_overrides_for_ansible.rb:3:in `up'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:831:in `exec_migration'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:811:in `block in migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:810:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1002:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/transactions.rb:212:in `transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1361:in `ddl_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1280:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1229:in `block in migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1229:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1061:in `up'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1036:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/databases.rake:84:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby27/root/usr/share/gems/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'

Caused by:
NameError: uninitialized constant MigratePortOverridesForAnsible::AnsibleRole
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-5.1.0/db/migrate/20200803065041_migrate_port_overrides_for_ansible.rb:14:in `transform_lookup_values'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-5.1.0/db/migrate/20200803065041_migrate_port_overrides_for_ansible.rb:3:in `up'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:831:in `exec_migration'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:811:in `block in migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:810:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1002:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/transactions.rb:212:in `transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1361:in `ddl_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1280:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1229:in `block in migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1229:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1061:in `up'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:1036:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/databases.rake:84:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby27/root/usr/share/gems/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
[root@katello ~]# 

This is a fresh install though. What’s it migrating?

I had the same issue. This solved it for me.

1 Like

@Duncan_Innes seems like an Ansible issue to me even though you did not enabled ansible plugins. I am facing now a similar issue with db:migrate and haven’t figured it out yet

I will try @cazzen2k4 solution maybe it’s a fix.

Not sure how clearing out all tasks can help in my case. This is a new install of Katello on a completely new OS install. There are no tasks in the database yet other than those which might have been created during the earlier installation phases.

Hi, is there anything else I could look to do? I would expect a fresh install on a fresh OS deployment to result in an installation without errors?

Is there a bugzilla I can track for this, or is a new bug report required?

D

The issue is in foreman_openscap, not foreman_ansible (which you don’t have).

For some reason, the “no Ansible plugin” detection isn’t working, and then it (rightfully) fails to do things with AnsibleRole:

I think this is because ForemanAnsible is now actually defined in Foreman core since Fixes #32518 - Moving Ansible fact parser · theforeman/foreman@bd68827 · GitHub

Yeah, looking at https://github.com/Katello/katello/pull/9416 we need to better check for Ansible.

Either by using Foreman::Plugin.installed?("foreman_ansible") (but no idea if that’s allowed in migrations) or checking something more specific, like ForemanAnsible::Engine or ForemanAnsible::VERSION

Similarish should also happen in

1 Like

I opened an issue Bug #34385: Detect ForemanAnsible presence more reliably - OpenSCAP - Foreman to track this. It would be great if you could test this patch https://github.com/theforeman/foreman_openscap/pull/524 I think it should resolve the issue.

I have applied this patch to the current server, but it makes no change to the error. I also removed the OpenScap flags from the installer, but these may already be stored from previous runs.

I am performing an OS reinstall and will apply the patch to the new system before running foreman-installer.

D

Update:

After a few attempts, I’ve only managed to install Katello 4.3 by removing the openscap options from foreman_installer on a clean OS install. Looking back, I half expected this. But not sure why I couldn’t get the above patch to work.

1 Like