Why yum fails with TypeError: 'NoneType' object is not callable ?
Environment
- Red Hat Enterprise Linux 5
- Red Hat Satellite
- Red Hat Network (RHN)
- Red Hat Subscription Management
Issue
-
yum fails with
TypeError: 'NoneType' object is not callable
when trying to install or update rpm packages -
yum update
,yum repolist
, oryum check-update
fails with following traceback:
# yum update
Loaded plugins: rhnplugin, security
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 309, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 161, in main
return exFatal(e)
File "/usr/share/yum-cli/yummain.py", line 64, in exFatal
logger.critical('\n\n%s', to_unicode(e))
File "/usr/lib64/python2.4/logging/__init__.py", line 1019, in critical
apply(self._log, (CRITICAL, msg, args), kwargs)
File "/usr/lib64/python2.4/logging/__init__.py", line 1078, in _log
record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info)
File "/usr/lib64/python2.4/logging/__init__.py", line 1064, in makeRecord
return LogRecord(name, level, fn, lno, msg, args, exc_info)
File "/usr/lib64/python2.4/logging/__init__.py", line 226, in __init__
if args and (len(args) == 1) and args[0] and (type(args[0]) == types.DictType):
TypeError: 'NoneType' object is not callable
- Tried to re-register the system by running rhn_register and it failed with error message
An error has occurred:
Network error:
See /var/log/up2date for more information
- From /var/log/update log file can see the below error message
Traceback (most recent call last):
File "/usr/sbin/rhn_register", line 82, in ?
app.run()
File "/usr/share/rhn/up2date_client/rhncli.py", line 66, in run
sys.exit(self.main() or 0)
File "/usr/sbin/rhn_register", line 64, in main
ui.main()
File "/usr/share/rhn/up2date_client/tui.py", line 1753, in main
tui.run()
File "/usr/share/rhn/up2date_client/tui.py", line 1645, in run
result = win.run()
File "/usr/share/rhn/up2date_client/tui.py", line 127, in run
tui_call_wrapper(self.screen, rhnreg.getCaps)
File "/usr/share/rhn/up2date_client/tui.py", line 66, in tui_call_wrapper
results = func(*params)
File "/usr/share/rhn/up2date_client/rhnreg.py", line 295, in getCaps
s.capabilities.validate()
File "/usr/share/rhn/up2date_client/rhnserver.py", line 159, in __get_capabilities
self.registration.welcome_message()
File "/usr/share/rhn/up2date_client/rhnserver.py", line 69, in __call__
raise up2dateErrors.NetworkError(message)
up2date_client.up2dateErrors.NetworkError: Network error
Resolution
- If using RHN:
- Re-registering the system to Red Hat Network resolves this issue.
- To re-register a system refer: How do I re-register my system with Red Hat Network (RHN) Classic or Red Hat Network Satellite?
- If using RHN Satellite:
- If this system is registerd with Satellite then redeploy the '/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT' file from Red Hat Network (RHN) Satellite to the client machine.
-
If using RHSM:
- Disable RHN plugins:
RHN Classic Plugins:
rhnplugin.conf
refresh-package.conf[root@localhost ~]# vim /etc/yum/pluginconf.d/rhnplugin.conf
[main]
enabled = 0
gpgcheck = 1- Clean yum cache data:
[root@localhost ~]# yum clean all
Loaded plugins: refresh-packagekit, rhnplugin
Cleaning up Everything- Remove (or rename) the systemid file:
[root@localhost ~]# cd /etc/sysconfig/rhn
[root@localhost ~]# mv systemid rhnclassic.systemid- Re-register system to RHSM:
[root@localhost ~]# subscription-manager register --autosubscribe --force
Root Cause
- This error indicate's that this system is not checking in with Red Hat Network (RHN).
Diagnostic Steps
- Commenting out lines 226 and 227 of /usr/lib64/python2.4/logging/init.py file permitted yum to display the proper error message.
# cp /usr/lib64/python2.4/logging/__init__.py /usr/lib64/python2.4/logging/__init__.py.orig
- comment out line 226 and 227 in /usr/lib64/python2.4/logging/__init__.py
# if args and (len(args) == 1) and args[0] and (type(args[0]) == types.DictType):
# args = args[0]
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.
Comments