Re-register Spacewalk Client
In some cases we may need to re-register a client back to the spacewalk server for various reasons:
1-The client machines was initially registered with the spw server but was offline for sometime and due to not checking in with the server it marked it as inactive system and was removed from the server
This process involves few steps before we attempt to register the client
we need to change the identifier for this system before we attempt to re-register and that is located in this config file:
a) #systemctl stop osad
b) mv /etc/sysconfig/rhn/osad-auth.conf /etc/sysconfig/rhn/osad-auth.conf.old
c) #systemctl start osad
d) re-register with the register command and use the force flag as in option 2- below
########################## these values are dynamic and unique in this file #####################
[root@kacd01-acd01-lpm01-cli04-1588357276 ~]# cat /etc/sysconfig/rhn/osad-auth.conf
# Automatically generated. Do not edit!
[osad-auth]
username = osad-b465d41294
password = 2599f91e109d10d5f795
resource = osad
######################
2-The client was registered but you need to re-register with a different activation key and then you need to use the same register command with the "–force" flag
sample command provided below with the highlighted force flag
rhnreg_ks --force --serverUrl=https://koss01-oss01-lpm01-app-1581438274.int.oss.cigar.inc/XMLRPC --sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT --activationkey=1-ol-repo-cos77-gcp-kcap-grp-spw-keys
3-Re-registered the client for 2nd and 3rd time by mistake or not knowing
Can you re-register a client that is already actively monitored by the spw server?
Yes, you can and what will happened if you do so?
Here is the answer:
You will have multiple entries for this client on the server console everything is identical on this client except for the registered "System_ID", every time you register the client it will register it with new "system_id" and will abandon the previous IDs.
How do I find out which one is the good one? Multiple ways you can tackle this:
If you like to find out immediately login to the client and cat the systemID file (# cat /etc/sysconfig/rhn/systemid) and locate the "<name>system_id</name>" line somewhere in the middle of the config page and that under has string with ID so this is your true ID number for this client that is active on the spw server
next, login to the server and list the systems and search for the system name and all registered will populate and there will be more than one but only one is true or active now, if you click on each one and inside the properties you will see the "System_ID" and whichever has the client's current ID number that is the one that you need to leave in the list and delete the rest.
or
You can wait for more than 24 hour (1 day) and list the "duplicate systems" under the "systems" menu → select "duplicate hostnames" navigate to the bottom of the page and on left side there is button called "select inactive" and then on the right side again bottom of the page there is a "delete selected" button and remove all the systems that are with duplicate hostname and inactive for a day.
Demo from actual client and server data
from the server side
Spacewalk System ID: 1000015501
Spacewalk System ID: 1000015519 current on the client side
from the client side
# cat /etc/sysconfig/rhn/systemid
<name>system_id</name>
<value><string>ID-1000015519</string></value>