Bug #7029
closedsed error in postinstall script of bootstrap rpm causes "subscription-manager register" to error on RHEL 5.7 and 6.1 clients for Satellite 6
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1127011
Description of problem:
The bootstrap RPM from the satellite server (http://sat6.example.com/pub/katello-ca-consumer-sat6.example.com-1.0-1.noarch.rpm) contains a sed error that prevents older subscription-manager RPMs (pre 0.96) from registering (RHEL 6.1 and RHEL 5.7 are affected)
Version-Release number of selected component (if applicable):
Satellite 6.0.3
subscription-manager older than 96.6
How reproducible:
Always
Steps to Reproduce:
1. cold install 5.7 or 6.1
2. install bootstrap RPM from satellite server (http://sat6.example.com/pub/katello-ca-consumer-sat6.example.com-1.0-1.noarch.rpm)
3. subscription-manager register
- yum -y --nogpgcheck install katello-ca-consumer-sat6.example.com-1.0-1.noarch.rpm
<<<snip>>>
================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================
Installing:
katello-ca-consumer-sat6.example.com noarch 1.0-1 /katello-ca-consumer-sat6.example.com-1.0-1.noarch 5.2 k
Transaction Summary
================================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
<<<snip>>>
Running Transaction
Installing : katello-ca-consumer-sat6.example.com 1/1
sed: -e expression #1, char 27: unknown option to `s'
duration: 0(ms)
Installed products updated.
Installed:
katello-ca-consumer-sat6.example.com.noarch 0:1.0-1
- END ***
Which leads to different errors when doing "subscription-manager register"
- For RHEL 5:
- subscription-manager register
Username: admin
Password:
RemoteServerException instance has no attribute 'args'
- For RHEL 6:
[root@localhost ~]# subscription-manager register
Username: admin
Password:
Remote server error. Please check the connection details, or see /var/log/rhsm/rhsm.log for more information.
From rhsm.log on RHEL 6
2014-08-05 21:13:46,113 [DEBUG] _request() @connection.py:209 - Making request: GET /subscription/
2014-08-05 21:13:46,150 [DEBUG] _request() @connection.py:218 - Response status: 404
2014-08-05 21:13:46,150 [ERROR] validateResponse() @connection.py:230 - No JSON object could be decoded
Looking at the postscript for katello-ca-consumer-sat6.example.com-1.0-1.noarch, we can see the prefix sed line has an error.
~~~- configure rhsm
- the config command was introduced in rhsm 0.96.6
- fallback left for older versions
if test ${RHSM_VERSION0:-0}gt 0 -o ${RHSM_VERSION1:-0} -gt 96 -o \( ${RHSM_VERSION1:-0} -eq 96 -a ${RHSM_VERSION2:-0}
-gt 6 \); then
subscription-manager config \
--server.hostname="$KATELLO_SERVER" \
--server.prefix="$PREFIX" \
--server.port="$PORT" \
--rhsm.repo_ca_cert="%(ca_cert_dir)scandlepin-local.pem" \
--rhsm.baseurl="$BASEURL"
else
sed -i "s/^hostname\s*=.*/hostname = $KATELLO_SERVER/g" $CFG
sed -i "s/^port\s*=.*/port = $PORT/g" $CFG
sed -i "s/^prefix\s*=.*/prefix = $PREFIX/g" $CFG <--
sed -i 's/^repo_ca_cert\s*=.*/repo_ca_cert = %(ca_cert_dir)scandlepin-local.pem/g' $CFG
sed -i "s|^baseurl\s*=.*|baseurl=$BASEURL|g" $CFG
fi
~~~
Changing the sed line to this resolves the issue:
sed -i 's|^prefix\s*=.*|prefix = /katello/api|g' /etc/rhsm/rhsm.conf
- sed -i 's/^prefix\s*=.*/prefix = /katello/api/g' /etc/rhsm/rhsm.conf
sed: -e expression #1, char 27: unknown option to `s' - sed -i 's|^prefix\s*=.*|prefix = /katello/api|g' /etc/rhsm/rhsm.conf #
Work around is to update /etc/rhsm/rhsm.conf and change prefix line from "/subscription" to "/katello/api" and then run subscription-manager again.
A note to upgrade the subscription-manager RPM to the newest version before registering a system is recommended in the user guide may help as the older version of subscription-manager doesn't support --org and required me to set the default org for the user that I was using.
https://access.redhat.com/documentation/en-US/Red_Hat_Satellite/6.0/html-single/User_Guide/index.html#chap-Configuring_Hosts
Updated by Justin Sherrill over 10 years ago
- Category set to 125
- Status changed from New to Assigned
- Target version set to 54
- Translation missing: en.field_release set to 13
- Difficulty set to easy
- Triaged changed from No to Yes
Updated by The Foreman Bot over 10 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/Katello/katello-installer/pull/102 added
- Pull request deleted (
)
Updated by Justin Sherrill over 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset katello-installer|569eded895ef87feb19dd36134c5834d33e26562.