Foreman Upgrade with Katello in 3 easy steps

0 0
0 0
Read Time:8 Minute

Introduction

Foreman Upgrade: This guide will help to do a version upgrade or solution for an error “HTTP error (500 – Internal Server Error): Unable to register system, not all services available“.

To upgrade the foreman between a minor release version is super easy.

During the regular server update, I have run the # yum update -y post to the upgrade, when I’m trying to register a new client with foreman it throws HTTP error, to avoid this we should skip upgrading the foreman packages by doing a yum version lock. If we fail to do so, you may hit with this issue.

Let’s start with foreman upgrade.

Current Installed Version

To check the currently installed version, Navigate to Administer –> About or before login to the dashboard we could see the current version.

foreman version

Pre-Check for Foreman Upgrade

Do a pre check before hand.

# foreman-rake katello:upgrade_check
[root@foreman ~]# foreman-rake katello:upgrade_check
Rubocop not loaded.
This script makes no modifications and can be re-run multiple times for the most up to date results.
Checking upgradeability...

Checking for running tasks...
[SUCCESS] - There are 0 active tasks. 
         You may proceed with the upgrade.

[root@foreman ~]# 

Make sure to take a snapshot backup or full backup of foreman server.

Checking the Options

Check the installed scenarios by running foreman-instller

[root@foreman ~]# foreman-installer --list-scenarios
Available scenarios
  Foreman (use: --scenario foreman)
        Default installation of Foreman
  Foreman Proxy Content (use: --scenario foreman-proxy-content)
        Install a stand-alone Foreman Content Proxy.
  Katello (INSTALLED)
        Install Foreman with Katello
[root@foreman ~]#

Start Foreman Upgrade

To start the upgrade it’s straight forward after taking the backup. To install the foreman we have used the same command without upgrade option, however, to perform an upgrade we need to specify --upgrade.

# foreman-installer --scenario katello --upgrade

The upgrade will take few minutes to complete.

[root@foreman ~]# foreman-installer --scenario katello --upgrade 
Upgrading, to monitor the progress on all related services, please do:
  foreman-tail | tee upgrade-$(date +%Y-%m-%d-%H%M).log
Upgrade Step: stop_services...
Running Stop Services
================================================================================
Check if command is run as root user:                                 [OK]
--------------------------------------------------------------------------------
Stop applicable services: Stopping the following service(s):

rh-mongodb34-mongod, postgresql, qdrouterd, qpidd, squid, pulp_celerybeat, pulp_resource_manager, pulp_streamer, pulp_workers, smart_proxy_dynflow_core, tomcat, dynflowd, httpd, puppetserver, foreman-proxy
| All services stopped                                                [OK]      
--------------------------------------------------------------------------------

foreman-maintain service stop finished successfully!
Upgrade Step: start_postgresql...
systemctl start postgresql finished successfully!
Upgrade Step: migrate_pulp...
systemctl start rh-mongodb34-mongod finished successfully!
Attempting to connect to localhost:27017
Attempting to connect to localhost:27017
Write concern for Mongo connection: {}
Loading content types.
Loading type descriptors []
Parsing type descriptors
Validating type descriptor syntactic integrity
Validating type descriptor semantic integrity
Loading unit model: modulemd_defaults = pulp_rpm.plugins.db.models:ModulemdDefaults
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-2.0.2/db/seeds.d/openscap_feature.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-2.0.2/db/seeds.d/openscap_policy_notification.rb
All seed files executed
foreman-rake db:seed finished successfully!
Rubocop not loaded.
=============================================
Upgrade Step 1/3: katello:correct_repositories. This may take a long while.
Processing Repository 1/39: CentOS 7 OS x86_64 (1)
Processing Repository 2/39: CentOS 7 Extra x86_64 (2)
Processing Repository 3/39: CentOS 7 Updates x86_64 (3)
Processing Repository 4/39: Storage x86_64 (4)
Processing Repository 5/39: CentOS 7 Extra x86_64 (5)
Processing Repository 6/39: CentOS 7 Updates x86_64 (6)
Processing Repository 7/39: Storage x86_64 (7)
Processing Repository 8/39: CentOS 7 OS x86_64 (8)
Processing Repository 9/39: CentOS 7 Extra x86_64 (9)
Processing Repository 10/39: CentOS 7 Updates x86_64 (10)
Processing Repository 11/39: Storage x86_64 (11)
Processing Repository 12/39: CentOS 7 OS x86_64 (12)
Processing Repository 13/39: CentOS 7 OS x86_64 (13)
Processing Repository 14/39: Storage x86_64 (14)
Processing Repository 15/39: CentOS 7 Updates x86_64 (15)
Processing Repository 16/39: CentOS 7 Extra x86_64 (16)
Processing Repository 17/39: CentOS 7 OS x86_64 (17)
Processing Repository 18/39: Storage x86_64 (18)
Processing Repository 19/39: CentOS 7 Updates x86_64 (19)
Processing Repository 20/39: CentOS 7 Extra x86_64 (20)
Processing Repository 21/39: CentOS 7 OS x86_64 (21)
Processing Repository 22/39: Storage x86_64 (22)
Processing Repository 23/39: CentOS 7 Updates x86_64 (23)
Processing Repository 24/39: CentOS 7 Extra x86_64 (24)
Processing Repository 25/39: Foreman Client (25)
Processing Repository 26/39: CentOS 7 Extra x86_64 (32)
Processing Repository 27/39: CentOS 7 Updates x86_64 (33)
Processing Repository 28/39: Storage x86_64 (34)
Processing Repository 29/39: CentOS 7 OS x86_64 (35)
Processing Repository 30/39: Foreman Client (36)
Processing Repository 31/39: Foreman Client (37)
Processing Repository 32/39: Foreman Client (38)
Processing Repository 33/39: Foreman Client (39)
Processing Repository 34/39: Foreman Client (40)
Processing Repository 35/39: CentOS 7 Extra x86_64 (41)
Processing Repository 36/39: CentOS 7 Updates x86_64 (42)
Processing Repository 37/39: Storage x86_64 (43)
Processing Repository 38/39: CentOS 7 OS x86_64 (44)
Processing Repository 39/39: Foreman Client (45)
=============================================
Upgrade Step 2/3: katello:correct_puppet_environments. This may take a long while.
Processing Puppet Environment 1/3: 1-CentOS_7-v1_0-puppet-3840fae6-9670-40f2-a0f4-66daac03e437 (1)
Processing Puppet Environment 2/3: 1-CentOS_7-v2_0-puppet-dd885c43-ee23-49f8-9cf7-255258ed90f9 (3)
Processing Puppet Environment 3/3: 1-CentOS_7-v3_0-puppet-62169603-2bea-4623-aa4b-174405adee2b (4)
=============================================
Upgrade Step 3/3: katello:clean_backend_objects. This may take a long while.
0 orphaned consumer id(s) found in candlepin.
Candlepin orphaned consumers: []
0 orphaned consumer id(s) found in pulp.
Pulp orphaned consumers: []
foreman-rake upgrade:run finished successfully!
Upgrade completed!
[root@foreman ~]#

Long output has been truncated.

To watch the upgrade logs we can use foreman-tail command with options and arguments.

# foreman-tail | tee upgrade-$(date +%Y-%m-%d-%H%M).log

Restart the foreman-maintain service after the upgrade.

[root@foreman ]# foreman-maintain service restart
Running Restart Services
================================================================================
Check if command is run as root user:                                 [OK]
--------------------------------------------------------------------------------
Restart applicable services: 
Stopping the following service(s):

rh-mongodb34-mongod, postgresql, qdrouterd, qpidd, squid, pulp_celerybeat, pulp_resource_manager, pulp_streamer, pulp_workers, tomcat, dynflowd, httpd, puppetserver, foreman-proxy
/ All services stopped                                                          
Starting the following service(s):

rh-mongodb34-mongod, postgresql, qdrouterd, qpidd, squid, pulp_celerybeat, pulp_resource_manager, pulp_streamer, pulp_workers, tomcat, dynflowd, httpd, puppetserver, foreman-proxy
\ All services started                                                [OK]      
--------------------------------------------------------------------------------

[root@foreman ]#

That’s it, we have successfully upgraded the foreman to latest available version.

Resolution for below error

This because we have run yum update on foreman server and foreman packages are updated, however still we have not upgraded the foreman version by running foreman-installer. When trying to register a new host with foreman server we may come across below issue. Upgrading the foreman version is the solution to this issue.

[root@pve3 ~]# subscription-manager register --org="LinuxSys_Organization" --activationkey="CentOS7_Prod"
HTTP error (500 - Internal Server Error): Unable to register system, not all services available
[root@pve3 ~]#

Once upgraded successfully, now we are good with registering the clients.

[root@pve3 ~]# subscription-manager register --org="LinuxSys_Organization" --activationkey="CentOS7_Prod"
The system has been registered with ID: 0799606a-d29d-4698-9051-a8d1e7056972
The registered system name is: pve3.linuxsysadmins.local
No products installed.
[root@pve3 ~]#

Check Subscription Status

Right after registering, check for the subscription status.

[root@pve3 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

System Purpose Status: Not Specified

[root@pve3 ~]# 

List the repositories.

[root@pve3 ~]# subscription-manager repos --list
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   LinuxSys_Organization_CentOS_7_Linux_x86_64_Storage_x86_64
Repo Name: Storage x86_64
Repo URL:  https://foreman.linuxsysadmins.local/pulp/repos/LinuxSys_Organization/Production/CentOS_7/custom/CentOS_7_Linux_x86_64/Storage_x86_64
Enabled:   1

Repo ID:   LinuxSys_Organization_CentOS_7_Linux_x86_64_CentOS_7_Updates_x86_64
Repo Name: CentOS 7 Updates x86_64
Repo URL:  https://foreman.linuxsysadmins.local/pulp/repos/LinuxSys_Organization/Production/CentOS_7/custom/CentOS_7_Linux_x86_64/CentOS_7_Updates_x86_64
Enabled:   1

Repo ID:   LinuxSys_Organization_CentOS_7_Linux_x86_64_CentOS_7_Extra_x86_64
Repo Name: CentOS 7 Extra x86_64
Repo URL:  https://foreman.linuxsysadmins.local/pulp/repos/LinuxSys_Organization/Production/CentOS_7/custom/CentOS_7_Linux_x86_64/CentOS_7_Extra_x86_64
Enabled:   1

Repo ID:   LinuxSys_Organization_CentOS_7_Linux_x86_64_CentOS_7_OS_x86_64
Repo Name: CentOS 7 OS x86_64
Repo URL:  https://foreman.linuxsysadmins.local/pulp/repos/LinuxSys_Organization/Production/CentOS_7/custom/CentOS_7_Linux_x86_64/CentOS_7_OS_x86_64
Enabled:   1

[root@pve3 ~]#

Enable the repositories

# subscription-manager repos --enable LinuxSys_Organization_CentOS_7_Linux_x86_64_Storage_x86_64
# subscription-manager repos --enable LinuxSys_Organization_CentOS_7_Linux_x86_64_CentOS_7_Updates_x86_64
# subscription-manager repos --enable LinuxSys_Organization_CentOS_7_Linux_x86_64_CentOS_7_Extra_x86_64
# subscription-manager repos --enable LinuxSys_Organization_CentOS_7_Linux_x86_64_CentOS_7_OS_x86_64

Now, while running YUM update or DNF update it will list the enabled repositories.

Conclusion

To perform a foreman upgrade we need to run only a few commands. Will be back with a new guide on foreman soon, subscribe to our newsletter for more nix guides.

About Author

Babin Lonston

Overall 14+ Years of experience in the IT field, currently working as a Senior Linux administration with Virtualization & Cloud. Being numismatist for a long time.
Happy
0 0 %
Sad
0 0 %
Excited
0 0 %
Sleepy
0 0 %
Angry
0 0 %
Surprise
0 0 %

Leave a Comment

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

We promise not to spam you, and we don't usually send more than one email a week.

You have Successfully Subscribed!

Exit mobile version