'/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]

Problem:

Foreman-installer throws error once I try to install a plugin:

foreman-installer --enable-foreman-plugin-remote-execution                  --enable-foreman-proxy-plugin-remote-execution-ssh

Error:

2021-04-13 11:17:45 [ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2021-04-13 11:17:45 [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]
foreman-rake db:migrate

throws

== 20180927120509 AddUserId: migrating ========================================
-- add_reference(:foreman_tasks_tasks, :user, {:type=>:integer, :foreign_key=>true})
   -> 0.0066s
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

uninitialized constant ForemanTasks::Lock::OWNER_LOCK_NAME
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:40:in `user_locks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:7:in `block in up'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:6:in `up'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:831:in `exec_migration'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:811:in `block in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:810:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1002:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1361:in `ddl_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1280:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1229:in `block in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1229:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1061:in `up'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1036:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:84:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'

Caused by:
NameError: uninitialized constant ForemanTasks::Lock::OWNER_LOCK_NAME
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:40:in `user_locks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:7:in `block in up'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:6:in `up'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:831:in `exec_migration'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:811:in `block in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:810:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1002:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1361:in `ddl_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1280:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1229:in `block in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1229:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1061:in `up'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1036:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:84:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate

Foreman and Proxy versions:

  • Foreman 1.24

Distribution and version:

  • Debian 10

This looks like probably Bug #32094: Mop up after split from locks to locks and links - foreman-tasks - Foreman which is fixed in foreman-tasks 4.1. However, I’m pretty sure foreman tasks 4.0 isn’t compatible with Foreman 1.24 (which is long out of support). Are you sure that is the version of foreman you are using? if so something is wrong in your repository configuration.

My mistake: Of course it’s 2.4

So

foreman-installer --enable-foreman-plugin-remote-execution\
                  --enable-foreman-proxy-plugin-remote-execution-ssh

makes use of foreman-tasks < 4.1?

Foreman tasks 4.1 was released to the repos yesterday, though currently it’s available only in the nightly repos and not in the 2.4 repo yet (@aruzicka i assume you’re planning to backport it?).

1 Like

I just released 4.0.1 containing the fix and opened packaging PRs.

3 Likes

Thanks a lot. So I guess we just need to wait for a new plugin version of plugin-remote-execution?

By now REX 4.0.1 should have made it to the 2.4 plugin repositories.

Version of rex has nothing to do with this. The issue was in tasks, new tasks were released and should be in the repos by now.

I assume you meant s/REX/tasks. REX is at 4.3.0 in 2.4 repos.

Do I have to perform an action just before I try to install again?

foreman-installer --enable-foreman-plugin-remote-execution\
>                   --enable-foreman-proxy-plugin-remote-execution-ssh
2021-04-14 12:21:47 [NOTICE] [pre_migrations] Executing hooks in group pre_migrations
2021-04-14 12:21:47 [NOTICE] [pre_migrations] All hooks in group pre_migrations finished
2021-04-14 12:21:47 [NOTICE] [boot] Executing hooks in group boot
2021-04-14 12:21:47 [NOTICE] [boot] All hooks in group boot finished
2021-04-14 12:21:47 [NOTICE] [init] Executing hooks in group init
2021-04-14 12:21:47 [NOTICE] [init] All hooks in group init finished
2021-04-14 12:21:47 [NOTICE] [root] Loading default values from puppet modules...
2021-04-14 12:21:52 [NOTICE] [root] ... finished
2021-04-14 12:21:52 [NOTICE] [pre_values] Executing hooks in group pre_values
2021-04-14 12:21:52 [NOTICE] [pre_values] All hooks in group pre_values finished
2021-04-14 12:21:53 [NOTICE] [pre_validations] Executing hooks in group pre_validations
2021-04-14 12:21:53 [NOTICE] [pre_validations] All hooks in group pre_validations finished
2021-04-14 12:21:53 [NOTICE] [root] Running validation checks
2021-04-14 12:21:53 [NOTICE] [pre_commit] Executing hooks in group pre_commit
2021-04-14 12:21:53 [NOTICE] [pre_commit] All hooks in group pre_commit finished
2021-04-14 12:21:53 [NOTICE] [pre] Executing hooks in group pre
2021-04-14 12:21:53 [NOTICE] [pre] All hooks in group pre finished
2021-04-14 12:21:53 [NOTICE] [configure] Starting system configuration.
  The total number of configuration tasks may increase during the run.
  Observe logs or specify --verbose-log-level to see individual configuration tasks.
2021-04-14 12:22:02 [NOTICE] [configure] 100 out of 1480 done.
2021-04-14 12:22:02 [NOTICE] [configure] 200 out of 1480 done.
2021-04-14 12:22:02 [NOTICE] [configure] 300 out of 1480 done.
2021-04-14 12:22:03 [NOTICE] [configure] 400 out of 1480 done.
2021-04-14 12:22:03 [NOTICE] [configure] 500 out of 1482 done.
2021-04-14 12:22:03 [NOTICE] [configure] 600 out of 1482 done.
2021-04-14 12:22:03 [NOTICE] [configure] 700 out of 1489 done.
2021-04-14 12:25:10 [NOTICE] [configure] 800 out of 1492 done.
2021-04-14 12:25:10 [NOTICE] [configure] 900 out of 1594 done.
2021-04-14 12:25:10 [NOTICE] [configure] 1000 out of 1595 done.
2021-04-14 12:25:11 [NOTICE] [configure] 1100 out of 1595 done.
2021-04-14 12:25:33 [ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2021-04-14 12:25:33 [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]
2021-04-14 12:25:42 [NOTICE] [configure] 1200 out of 1595 done.
2021-04-14 12:25:42 [NOTICE] [configure] 1300 out of 1595 done.
2021-04-14 12:25:43 [NOTICE] [configure] 1400 out of 1616 done.
2021-04-14 12:25:43 [NOTICE] [configure] 1500 out of 1616 done.
2021-04-14 12:25:50 [NOTICE] [configure] 1600 out of 1616 done.
2021-04-14 12:25:51 [NOTICE] [configure] System configuration has finished.
2021-04-14 12:25:51 [NOTICE] [post] Executing hooks in group post
StandardError: An error has occurred, this and all later migrations canceled:

uninitialized constant ForemanTasks::Lock::OWNER_LOCK_NAME
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:40:in `user_locks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:7:in `block in up'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:6:in `up'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:831:in `exec_migration'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:811:in `block in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:810:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1002:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1361:in `ddl_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1280:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1229:in `block in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1229:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1061:in `up'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1036:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:84:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'

Caused by:
NameError: uninitialized constant ForemanTasks::Lock::OWNER_LOCK_NAME
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:40:in `user_locks'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:7:in `block in up'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman-tasks-4.0.0/db/migrate/20180927120509_add_user_id.foreman_tasks.rb:6:in `up'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:831:in `exec_migration'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:811:in `block in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:810:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1002:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activesupport-6.0.3.5/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1361:in `ddl_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1280:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1229:in `block in migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1229:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1061:in `up'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1036:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:84:in `each'
/usr/share/foreman/vendor/ruby/2.5.0/gems/activerecord-6.0.3.5/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

To be honest I’m not sure if the installer updates already installed packages to the latest available version.

Yes. I just remember merging a 4.0.1 PR that you submitted.

It doesn’t by default but we have --foreman-plugin-version latest that you can use if that’s what you want.

Still crashes

foreman-installer --enable-foreman-plugin-remote-execution --enable-foreman-proxy-plugin-remote-execution-ssh --foreman-plugin-version latest

2021-04-19 22:34:19 [ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2021-04-19 22:34:19 [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]
2021-04-19 22:34:28 [NOTICE] [configure] 1100 out of 1536 done.

As I am unable to edit my post: The problem does still appear. Is there anything I can do to help to solve this issue?

What is the error when you manually run /usr/sbin/foreman-rake db:migrate? It may also be in /var/log/foreman-installer/YOURSCENARIO.log.

Alright, I rolled back to the moment before the first installation attempt. Now using --foreman-plugin-version latest the installation works. Seems like the failed attempt “blocked” something.

could tell me more about how you fixed the issue im facing the same problem

I’m facing the same problem in the version of foreman 3.1

Hello,
Need help here too.

Hi
I am also getting the same error when I am upgrading my SP foreman environment from 3.0.3 to 3.1.2
At the beginning, when running foreman-installer --foreman-proxy-dns-managed=false --foreman-proxy-dhcp-managed=false, get this error
/usr/sbin/foreman-rake db:migrate’ returned 1 instead of one of [0]

And I go head and the last step of just foreman-installer running get this error:
/usr/sbin/foreman-rake db:seed’ returned 1 instead of one of [0]