System is not able to subscribe using Subscription-Manager in `%post` script after installation of Red Hat Enterprise Linux 6 via kickstart

Solution Verified - Updated -

Issue

While installing the server using kickstart method, system is not able to subscribe to channels using Subscription-Manager. The system gets registered successfully after firstboot. Following is the kickstart file used.

install
cdrom
firewall --enable --port=22:tcp,5432:tcp,1099:tcp,1099:udp,3000:tcp,3000:udp,4001:udp,4002:udp,5900:tcp,5000-5200:tcp --service=ssh
rootpw redhat
auth  --useshadow  --passalgo=md5
graphical
firstboot --disable
keyboard us
lang en_US.UTF-8
selinux --disabled
logging --level=debug
timezone  America/New_York
network  --bootproto=dhcp --device=eth0 --onboot=on
bootloader --location=mbr
clearpart --all 
key --skip
%packages 
@base

%post --log=/root/my-post-log

export LANG=en_US.UTF-8
/usr/sbin/subscription-manager register --username=<my_username> --password=<password> --autosubscribe

yum update -y
%end

The errors are reported in rhsm.log file as follows.

Trace-back #1

2012-06-29 17:26:34,245 [ERROR] handle_exception() @managercli.py:46 - exception caught in subscription-manager
2012-06-29 17:26:34,245 [ERROR] handle_exception() @managercli.py:47 - 'NoneType' object has no attribute 'lower'
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 78, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 69, in main
    return managercli.CLI().main()
  File "/usr/share/rhsm/managercli.py", line 842, in main
    cmd.main()
  File "/usr/share/rhsm/managercli.py", line 183, in main
    proxy_password=self.proxy_password)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 294, in __init__
    ssl_verify_depth=self.ssl_verify_depth)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 110, in __init__
    "Accept-Language": locale.getdefaultlocale()[0].lower().replace('_', '-')}
AttributeError: 'NoneType' object has no attribute 'lower'

Trace-back # 2

2012-06-29 17:34:23,304 [ERROR] validateResponse() @connection.py:189 - No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 187, in validateResponse
    parsed = json.loads(response['content'])
  File "/usr/lib64/python2.6/site-packages/simplejson/__init__.py", line 307, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.6/site-packages/simplejson/decoder.py", line 335, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.6/site-packages/simplejson/decoder.py", line 353, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
2012-06-29 17:34:23,315 [ERROR] validateResponse() @connection.py:191 - remote server status code: 500
2012-06-29 17:34:23,317 [ERROR] handle_exception() @managercli.py:46 - Error during registration: 

Trace-back #3

2012-06-29 17:34:23,317 [ERROR] handle_exception() @managercli.py:47 - 
Traceback (most recent call last):
  File "/usr/share/rhsm/managercli.py", line 422, in _do_command
    facts=self.facts.get_facts())
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 323, in registerConsumer
    return self.conn.request_post('/consumers/', params)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 203, in request_post
    return self._request("POST", method, params)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 178, in _request
    self.validateResponse(result)
  File "/usr/lib/python2.6/site-packages/rhsm/connection.py", line 192, in validateResponse
    raise RemoteServerException(response['status'])
RemoteServerException
2012-06-29 17:38:09,406 [ERROR] main() @certmgr.py:72 - Either the consumer is not registered or the certificates are corrupted. Certificate update using daemon failed.

Environment

  • Red Hat Enterprise Linux 6.1
  • Subscription-Manager
  • Kickstart Installation and --autosubscribe option of Subscription-Manager Registration in %post script

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In