Getting 'incorrect padding' error while running 'subscription-manager' commands.

Solution Verified - Updated -


  • Red Hat Enterprise Linux 7.1
  • Red Hat Subscription Manager


  • Every time subscription-manager command is executed, we get an error 'incorrect padding' error message.

  • Getting 'Incorrect padding' error message as follows:

# subscription-manager remove --all
0 subscriptions removed at the server.
Incorrect padding


# yum update coreutils
  • Coreutils (base64) is an encoder/decoder which reads a block of input to a buffer, transforms it, and writes it out.

Root Cause

  • The trackback errors shows incompatibility between the O.S. and the subscription-manager as base64-encoded strings are not getting decrypted as required.

Diagnostic Steps

Check for /var/log/rhsm/rhsm.log file to see the python trackback errors:

exception caught while running <subscription_manager.repolib.RepoActionInvoker object at 0xe9fdd0> update
2019-02-18 08:51:28,643 [ERROR] rhsmcertd-worker - Incorrect padding Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/", line 63, in _run_update
    update_report = lib.update()
  File "/usr/share/rhsm/subscription_manager/", line 31, in update =
  File "/usr/share/rhsm/subscription_manager/", line 17, in run
    return action()
  File "/usr/share/rhsm/subscription_manager/", line 53, in _do_update
    action = RepoUpdateActionCommand(cache_only=self.cache_only)
  File "/usr/share/rhsm/subscription_manager/", line 184, in _init_
    self.ent_source = ent_cert.EntitlementDirEntitlementSource()
  File "/usr/share/rhsm/subscription_manager/model/", line 70, in _init_
    for ent_cert in ent_dir.list_valid():
  File "/usr/share/rhsm/subscription_manager/", line 293, in list_valid
    for c in self.list():
  File "/usr/share/rhsm/subscription_manager/", line 121, in list
  File "/usr/lib64/python2.7/site-packages/rhsm/", line 59, in create_from_file
    return _CertFactory().create_from_file(path)
  File "/usr/lib64/python2.7/site-packages/rhsm/", line 66, in create_from_file
    return self._read_x509(_certificate.load(path), path, pem)
  File "/usr/lib64/python2.7/site-packages/rhsm/", line 100, in _read_x509
    raise CertificateException(str(e))
CertificateException: Incorrect padding
2019-02-18 08:51:28,644 [DEBUG] rhsmcertd-worker - loaded plugin modules: []
2019-02-18 08:51:28,644 [DEBUG] rhsmcertd-worker - loaded plugins: {}
2019-02-18 08:51:28,644 [ERROR] rhsmcertd-worker - Incorrect padding Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/rhsm/", line 94, in _read_x509
    return self._create_v3_cert(version, extensions, x509, path, pem)
  File "/usr/lib64/python2.7/site-packages/rhsm/", line 258, in _create_v3_cert
    payload = self._decompress_payload(base64.b64decode(entitlement_data))
  File "/usr/lib64/python2.7/", line 76, in b64decode
    raise TypeError(msg)
TypeError: Incorrect padding

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.