Bug 1995783

Summary: foreman.service does not get enabled after running foreman-maintain service enable
Product: Red Hat Satellite Reporter: Avijit Roy <avroy>
Component: Satellite MaintainAssignee: Eric Helms <ehelms>
Status: CLOSED ERRATA QA Contact: Griffin Sullivan <gsulliva>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: apatel, aupadhye, ehelms, kgaikwad, kkinge, pcreech
Target Milestone: 6.14.0Keywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: foreman-maintain-1.3.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-08 14:17:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Avijit Roy 2021-08-19 18:29:53 UTC
Description of problem:

When we disable all the services and enable them back using foreman-maintain the foreman.service does not get enabled. Even after satellite reboot the service is still disabled and UI is not accessible with below error:

~~~~~~~~~~~~~~~~~~~~~~~~
Service Unavailable
     The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
~~~~~~~~~~~~~~~~~~~~~~~~


Version-Release number of selected component (if applicable):

6.9

How reproducible:
100%

Steps to Reproduce:
1. foreman-maintain service stop  
2. foreman-maintain service disable
3. foreman-maintain service enable
4. reboot

Actual results:

- When we enable the services the symlink for foreman.service does not get created. 
- After reboot the foreman.service is in the failed state

~~~~~~~~~~~~~~~~~~
# systemctl status foreman.service
● foreman.service - Foreman
   Loaded: loaded (/usr/lib/systemd/system/foreman.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/foreman.service.d
           └─installer.conf
   Active: inactive (dead)
     Docs: https://theforeman.org
~~~~~~~~~~~~~~~~~~

- Satellite UI is not accessible with the below error:

~~~~~~~~~~~~~~~~~~
Service Unavailable
     The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
~~~~~~~~~~~~~~~~~~


Expected results:

- After "foreman-maintain service enable" symlink for foreman.service should get created. 
- After rebooting of satellite all services should be up and running and UI should be accssible. 

Additional info:

- After restarting the foreman.service everything was fine in Satellite 6.9. 

- Instead of reboot if we do 'satellite-maintain service restart' then we do not face any issues and all services are running without any error. 

- If we perform similar test on Satellite 6.8, after reboot the foreman.service was disabled and not started. Along with that many services were just down. 

~~~~~~~~~~~~~~~~~~~~
Some services are not running (rh-mongodb34-mongod, pulp_celerybeat, pulp_resource_manager, pulp_streamer)
--------------------------------------------------------------------------------
Scenario [Status Services] failed.
~~~~~~~~~~~~~~~~~~~~ 

- Though the UI was accessible in Satellite 6.8.

Comment 3 Eric Helms 2023-05-20 23:27:33 UTC
*** Bug 2011690 has been marked as a duplicate of this bug. ***

Comment 4 Griffin Sullivan 2023-06-21 16:21:25 UTC
Verified on 6.14 snap 4

satellite-maintain service enable is correctly enabling the foreman service, even after reboot

Steps:
1. foreman-maintain service stop  
2. foreman-maintain service disable
3. foreman-maintain service enable
4. reboot

Results:
If you run `# systemctl status foreman.service` right on boot you will get:

● 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: activating (start) since Wed 2023-06-21 12:16:05 EDT; 9s ago
     Docs: https://theforeman.org
 Main PID: 896 (rails)
    Tasks: 1 (limit: 151972)
   Memory: 209.3M
   CGroup: /system.slice/foreman.service
           └─896 /usr/bin/ruby /usr/share/foreman/bin/rails server --environment production

After a few moments it will say `active (running)` and `foreman-maintain service status --brief --only foreman.service` will work correctly. During this restart period, `foreman-maintain service status` will fail.

Comment 8 errata-xmlrpc 2023-11-08 14:17:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.14 security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:6818