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 -


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.

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
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

%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

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

Trace-back #1

2012-06-29 17:26:34,245 [ERROR] handle_exception() - exception caught in subscription-manager
2012-06-29 17:26:34,245 [ERROR] handle_exception() - '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/", line 842, in main
  File "/usr/share/rhsm/", line 183, in main
  File "/usr/lib/python2.6/site-packages/rhsm/", line 294, in __init__
  File "/usr/lib/python2.6/site-packages/rhsm/", 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() - No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/rhsm/", line 187, in validateResponse
    parsed = json.loads(response['content'])
  File "/usr/lib64/python2.6/site-packages/simplejson/", line 307, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.6/site-packages/simplejson/", line 335, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.6/site-packages/simplejson/", 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() - remote server status code: 500
2012-06-29 17:34:23,317 [ERROR] handle_exception() - Error during registration: 

Trace-back #3

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


  • 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