Facing issue with foreman 3.3 installation- foreman service is working but getting crashed after os reboot

Hi All,

I am not sure if i am doing anything wrong or not. I am installing Foreman with default following doc- Foreman :: Manual . But getting error below, not help from Google.

OS - centos > CentOS Linux release 7.9.2009 (Core) > x86_64

Note: Installation Is completed successfully but after OS reboot, getting this error and I have checked PostgreSQL db service is running fine.

[root@chelksptest003 kanhpatel]# service foreman status
Redirecting to /bin/systemctl status foreman.service
● foreman.service - Foreman
Loaded: loaded (/usr/lib/systemd/system/foreman.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/foreman.service.d
└─installer.conf
Active: failed (Result: exit-code) since Tue 2022-08-30 03:17:29 PDT; 2min 32s ago
Docs: [https://theforeman.org](https://theforeman.org/)
Process: 1042 ExecStart=/usr/share/foreman/bin/rails server --environment $FOREMAN_ENV (code=exited, status=1/FAILURE)
Main PID: 1042 (code=exited, status=1/FAILURE)

Aug 30 03:17:29 chelksptest003 foreman[1042]: from /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:158:in `rescue in require' Aug 30 03:17:29 chelksptest003 foreman[1042]: from /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:147:in `require'
Aug 30 03:17:29 chelksptest003 foreman[1042]: from /usr/share/foreman/bin/rails:9:in `<main>' Aug 30 03:17:29 chelksptest003 foreman[1042]: /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- rails/co... (LoadError)
Aug 30 03:17:29 chelksptest003 foreman[1042]: from /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require' Aug 30 03:17:29 chelksptest003 foreman[1042]: from /usr/share/foreman/bin/rails:9:in `<main>'
Aug 30 03:17:29 chelksptest003 systemd[1]: foreman.service: main process exited, code=exited, status=1/FAILURE
Aug 30 03:17:29 chelksptest003 systemd[1]: Failed to start Foreman.
Aug 30 03:17:29 chelksptest003 systemd[1]: Unit foreman.service entered failed state.
Aug 30 03:17:29 chelksptest003 systemd[1]: foreman.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@chelksptest003 kanhpatel]# journalctl -xe
Aug 30 03:48:27 chelksptest003 puppet-agent[11007]: Applied catalog in 0.13 seconds
Aug 30 03:48:28 chelksptest003 foreman[11766]: => Booting Puma
Aug 30 03:48:28 chelksptest003 foreman[11766]: => Rails 6.0.4.7 application starting in production
Aug 30 03:48:28 chelksptest003 foreman[11766]: => Run `rails server --help` for more startup options
Aug 30 03:48:28 chelksptest003 foreman[11766]: Exiting
Aug 30 03:48:28 chelksptest003 foreman[11766]: /opt/rh/rh-ruby27/root/usr/share/ruby/fileutils.rb:250:in `mkdir': File exists @ dir_s_mkdir - /usr/share/foreman/tmp (Errno::EEXIST)
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/ruby/fileutils.rb:250:in `fu_mkdir'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/ruby/fileutils.rb:228:in `block (2 levels) in mkdir_p'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/ruby/fileutils.rb:226:in `reverse_each'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/ruby/fileutils.rb:226:in `block in mkdir_p'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/ruby/fileutils.rb:211:in `each'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/ruby/fileutils.rb:211:in `mkdir_p'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/commands/server/server_command.rb:72:in `block in create_tmp_dire
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/commands/server/server_command.rb:71:in `each'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/commands/server/server_command.rb:71:in `create_tmp_directories'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/commands/server/server_command.rb:35:in `start'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/commands/server/server_command.rb:147:in `block in perform'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/commands/server/server_command.rb:138:in `tap'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/commands/server/server_command.rb:138:in `perform'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/command/base.rb:69:in `perform'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/command.rb:46:in `invoke'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.4.7/lib/rails/commands.rb:18:in `<top (required)>'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:158:in `require'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:158:in `rescue in require'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:147:in `require'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /usr/share/foreman/bin/rails:9:in `<main>'
Aug 30 03:48:28 chelksptest003 foreman[11766]: /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- rails/commands (LoadEr
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
Aug 30 03:48:28 chelksptest003 foreman[11766]: from /usr/share/foreman/bin/rails:9:in `<main>'
Aug 30 03:48:28 chelksptest003 systemd[1]: foreman.service: main process exited, code=exited, status=1/FAILURE
Aug 30 03:48:28 chelksptest003 systemd[1]: Failed to start Foreman.
-- Subject: Unit foreman.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit foreman.service has failed.
--
-- The result is failed.
Aug 30 03:48:28 chelksptest003 systemd[1]: Unit foreman.service entered failed state.
Aug 30 03:48:28 chelksptest003 systemd[1]: foreman.service failed.
Aug 30 03:48:28 chelksptest003 systemd[1]: Starting Foreman...
-- Subject: Unit foreman.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit foreman.service has begun starting up.
Aug 30 03:16:39 chelksptest003 foreman[5199]: FATAL:  terminating connection due to administrator command
Aug 30 03:16:39 chelksptest003 foreman[5199]: FATAL:  terminating connection due to administrator command
Aug 30 03:16:39 chelksptest003 foreman[5199]: FATAL:  terminating connection due to administrator command
Aug 30 03:16:39 chelksptest003 foreman[5199]: FATAL:  terminating connection due to administrator command
Aug 30 03:16:39 chelksptest003 foreman[5199]: E, [2022-08-30T03:16:38.870275 #5255] ERROR -- /connector-database-core: PG::UnableToSend: server closed the connection unexpectedly
Aug 30 03:16:39 chelksptest003 foreman[5199]: This probably means the server terminated abnormally
Aug 30 03:16:39 chelksptest003 foreman[5199]: before or while processing the request.
Aug 30 03:16:39 chelksptest003 foreman[5199]: (Sequel::DatabaseDisconnectError)
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:154:in `async_exec'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:154:in `block in execute_query'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/database/logging.rb:38:in `log_connection_yield'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:154:in `execute_query'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:142:in `block in execute'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:119:in `check_disconnect_errors'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:142:in `execute'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:498:in `_execute'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:316:in `block (2 levels) in execute'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:519:in `check_database_errors'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:316:in `block in execute'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/connection_pool/threaded.rb:92:in `hold'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/database/connecting.rb:269:in `synchronize'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/postgres.rb:316:in `execute'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/database/query.rb:50:in `execute_dui'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/database/query.rb:43:in `execute_ddl'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/sequel-5.53.0/lib/sequel/adapters/shared/postgres.rb:708:in `notify'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.6.4/lib/dynflow/connectors/database.rb:36:in `notify'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.6.4/lib/dynflow/connectors/database.rb:41:in `stop'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.6.4/lib/dynflow/connectors/database.rb:109:in `postgres_listen_stop'
Aug 30 03:16:39 chelksptest003 foreman[5199]: /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.6.4/lib/dynflow/connectors/database.rb:73:in `stop_listening'
Aug 30 03:16:39 chelksptest003 foreman[5199]: [ concurrent-ruby ]
Aug 30 03:16:39 chelksptest003 foreman[5199]: FATAL:  terminating connection due to administrator command
Aug 30 03:16:39 chelksptest003 foreman[5199]: Exiting
Aug 30 03:16:39 chelksptest003 systemd[1]: Stopped Foreman.
-- Reboot --
Aug 30 03:17:19 chelksptest003 systemd[1]: Starting Foreman...
Aug 30 03:17:29 chelksptest003 foreman[1042]: => Booting Puma
Aug 30 03:17:29 chelksptest003 foreman[1042]: => Rails 6.0.4.7 application starting in production
Aug 30 03:17:29 chelksptest003 foreman[1042]: => Run `rails server --help` for more startup options
Aug 30 03:17:29 chelksptest003 foreman[1042]: Exiting

can anyone please help me.

I have no clue how you got to that stage, but this error suggests you packages didn’t install properly:

Aug 30 03:48:28 chelksptest003 foreman[11766]: /opt/rh/rh-ruby27/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- rails/commands (LoadEr

If you’re getting started, I’d recommend starting over on EL8. While Foreman 3.3 should work on EL7, Foreman 3.4 drops it so you’re essentially starting on a dead end.