[ContentMigration] Cannot prepare for migration from Pulp 2 to 3 according to the documentation

Problem:
According to the Katello 3.17 doc (Katello Upgrade, Pulp3 Migration), you need to run
chmod -R g+rwX /var/lib/pulp/content
find /var/lib/pulp/content -type d -perm -g-s -exec sudo chmod g+s {} ;
chgrp -R pulp /var/lib/pulp/content
in order to prepare the migration process. However, on the foreman server that directory does not exist. All my content is located under /var/lib/pulp/docroot/artifact, which is also mentioned here:
/var/lib/pulp/content defined in pulp_content_dir parameter doesn’t exist or is unreadable

I tried to run the prepare steps and switchover steps anyway, to see if I get any more issues or error messages. Prepare runs fine and switchover gives me the error:
Running Switch support for certain content from Pulp 2 to Pulp 3
================================================================================
Switch support for certain content from Pulp 2 to Pulp 3:
Performing final content migration before switching content
Content Migration completed successfully
Performing a check to verify everything that is needed has been migrated

Switching specified content over to pulp 3                            [FAIL]
Failed executing foreman-rake katello:pulp3_content_switchover, exit status 1:
 rake aborted!
The Dynflow world was not initialized yet. If your plugin uses it, make sure to call Rails.application.dynflow.require! in some initializer
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.7/lib/dynflow/rails.rb:75:in `world'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.1/lib/foreman_tasks.rb:23:in `trigger'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.1/lib/foreman_tasks.rb:29:in `block in trigger_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.1/lib/foreman_tasks.rb:49:in `block in rails_safe_trigger_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.1/lib/foreman_tasks.rb:48:in `rails_safe_trigger_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.1/lib/foreman_tasks.rb:27:in `trigger_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-3.0.1/lib/foreman_tasks.rb:58:in `sync_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.17.0/lib/katello/tasks/pulp3_content_switchover.rake:19:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => katello:pulp3_content_switchover
(See full trace by running task with --trace)
--------------------------------------------------------------------------------
Scenario [Switch support for certain content from Pulp 2 to Pulp 3] failed.

The following steps ended up in failing state:

  [content-switchover]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="content-switchover"

All related tasks, however, are having the status “success” and no errors. Interestingly, they run only 2-3 seconds.

Could these two things be related somehow?

This is a new setup with Foreman 2.2 and Katello 3.17, upgraded to Foreman 2.2.1.

Expected outcome:
I should find the content as laid out in the documentation and the switchover should proceed without errors.

Foreman and Proxy versions:
Foreman 2.2.1
Katello 3.17

Foreman and Proxy plugin versions:
* candlepin-3.1.22-1.el7.noarch
* candlepin-selinux-3.1.22-1.el7.noarch
* foreman-2.2.1-1.el7.noarch
* foreman-cli-2.2.1-1.el7.noarch
* foreman-debug-2.2.1-1.el7.noarch
* foreman-dynflow-sidekiq-2.2.1-1.el7.noarch
* foreman-installer-2.2.1-1.el7.noarch
* foreman-installer-katello-2.2.1-1.el7.noarch
* foreman-postgresql-2.2.1-1.el7.noarch
* foreman-proxy-2.2.1-1.el7.noarch
* foreman-release-2.2.1-1.el7.noarch
* foreman-selinux-2.2.1-1.el7.noarch
* foreman-service-2.2.1-1.el7.noarch
* foreman-vmware-2.2.1-1.el7.noarch
* katello-3.17.0-1.el7.noarch
* katello-ca-consumer-aibsll17.bsl.ch.almanid.com-1.0-2.noarch
* katello-certs-tools-2.7.1-2.el7.noarch
* katello-client-bootstrap-1.7.5-1.el7.noarch
* katello-common-3.17.0-1.el7.noarch
* katello-debug-3.17.0-1.el7.noarch
* katello-default-ca-1.0-1.noarch
* katello-repos-3.17.0-1.el7.noarch
* katello-selinux-3.4.0-1.el7.noarch
* katello-server-ca-1.0-2.noarch
* pulp-client-1.0-1.noarch
* pulp-deb-plugins-1.10.2-1.el7.noarch
* pulp-docker-plugins-3.2.8-1.el7.noarch
* pulp-katello-1.0.3-1.el7.noarch
* pulp-puppet-plugins-2.21.4-1.el7.noarch
* pulp-puppet-tools-2.21.4-1.el7.noarch
* pulp-rpm-plugins-2.21.4-1.el7.noarch
* pulp-selinux-2.21.4-2.el7.noarch
* pulp-server-2.21.4-2.el7.noarch
* pulpcore-selinux-1.0.0-2.el7.x86_64

Distribution and version:
CentOS 7.9

Other relevant data:

Interestingly enough, on the smart proxy with the same versions I find the content under /var/lib/pulp/content, as expected.

I found this message in the log file of the smart proxy located on the foreman server:

File at /var/lib/pulp/content defined in pulp_content_dir parameter doesn’t exist or is unreadable

It also repeats every couple of hours.

I’m very new to foreman and wanted to upgrade to pulp 3 before we really got started, but I ran into the same error, and now our foreman server is displaying

Service unavailable ERF64-6496 [Foreman::MaintenanceException]: There are migrations pending in the system. Service unavailable ERF64-6496 [Foreman::MaintenanceException]: There are migrations pending in the system.

Any pointers on correcting the issue or rolling bck?