Created attachment 1485108 [details] Small diff which fixes my problem Python 3.7 - which is shipped with F29 - removed os.errno. It seems that subscription-manager relies on it. From the changelog: https://docs.python.org/3.7/whatsnew/3.7.html "Several undocumented internal imports were removed. One example is that os.errno is no longer available; use import errno directly instead. Note that such undocumented internal imports may be removed any time without notice, even in micro version releases" If you try to subscribe to a repository on F29, you'll get the following error: Traceback (most recent call last): File "/usr/lib64/python3.7/site-packages/subscription_manager/identity.py", line 140, in reload self.consumer = self._get_consumer_identity() File "/usr/lib64/python3.7/site-packages/subscription_manager/identity.py", line 164, in _get_consumer_identity return ConsumerIdentity.read() File "/usr/lib64/python3.7/site-packages/subscription_manager/identity.py", line 53, in read with open(cls.keypath()) as key_file: FileNotFoundError: [Errno 2] No such file or directory: '/etc/pki/consumer/key.pem' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/sbin/subscription-manager", line 11, in <module> load_entry_point('subscription-manager==1.23.3', 'console_scripts', 'subscription-manager')() File "/usr/lib64/python3.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main return managercli.ManagerCLI().main() File "/usr/lib64/python3.7/site-packages/subscription_manager/managercli.py", line 2838, in __init__ CLI.__init__(self, command_classes=commands) File "/usr/lib64/python3.7/site-packages/subscription_manager/cli.py", line 101, in __init__ cmd = clazz() File "/usr/lib64/python3.7/site-packages/subscription_manager/managercli.py", line 1056, in __init__ super(RegisterCommand, self).__init__("register", shortdesc, True) File "/usr/lib64/python3.7/site-packages/subscription_manager/managercli.py", line 529, in __init__ super(UserPassCommand, self).__init__(name, shortdesc, primary) File "/usr/lib64/python3.7/site-packages/subscription_manager/managercli.py", line 257, in __init__ self.identity = inj.require(inj.IDENTITY) File "/usr/lib64/python3.7/site-packages/subscription_manager/injection.py", line 106, in require return FEATURES.require(feature, *args, **kwargs) File "/usr/lib64/python3.7/site-packages/subscription_manager/injection.py", line 80, in require self.providers[feature] = provider(*args, **kwargs) File "/usr/lib64/python3.7/site-packages/subscription_manager/identity.py", line 133, in __init__ self.reload() File "/usr/lib64/python3.7/site-packages/subscription_manager/identity.py", line 147, in reload if isinstance(err, IOError) and err.errno == os.errno.ENOENT: AttributeError: module 'os' has no attribute 'errno' I've attached a small patch which fixes it for me.
*** Bug 1636654 has been marked as a duplicate of this bug. ***
Rob, would you like to submit a PR for this? https://github.com/candlepin/subscription-manager. We ask that the commit message start with the bug number (ex. 1631339: Fix os.errno issue). Would also accept a patch that git can apply via git am. We'd like to recognize your contribution by having a commit/changelog entry if you'd like.
Hi Kevin, As per your request PR #1953 is now ready.
When I do this: subscription-manager register: Username: <name> Password: <...> module 'os' has no attribute 'errno' This is on a subscription-manager on Fedora 29 that has already above fix # subscription_manager]# rpm -qa | grep -i subscription subscription-manager-rhsm-certificates-1.24.2-1.fc29.x86_64 dnf-plugin-subscription-manager-1.24.2-1.fc29.x86_64 python3-subscription-manager-rhsm-1.24.2-1.fc29.x86_64 subscription-manager-1.24.2-1.fc29.x86_64
I also saw the it, module 'os' has no attribute 'errno', while registering. rhsm.log showed: 2018-12-18 10:24:20,189 [INFO] subscription-manager:1871:MainThread @connection.py:917 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=basic username=; 2018-12-18 10:24:20,190 [ERROR] subscription-manager:1871:MainThread @managercli.py:190 - Error during registration: module 'os' has no attribute 'errno' 2018-12-18 10:24:20,190 [ERROR] subscription-manager:1871:MainThread @managercli.py:191 - module 'os' has no attribute 'errno' Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/syspurpose/utils.py", line 51, in create_dir os.makedirs(path, mode=0o755) File "/usr/lib64/python3.7/os.py", line 221, in makedirs mkdir(name, mode) FileExistsError: [Errno 17] File exists: '/etc/rhsm/syspurpose' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib64/python3.7/site-packages/subscription_manager/managercli.py", line 1273, in _do_command syspurpose = syspurposelib.read_syspurpose() File "/usr/lib64/python3.7/site-packages/subscription_manager/syspurposelib.py", line 234, in read_syspurpose syspurpose = SyspurposeStore.read(USER_SYSPURPOSE).contents File "/usr/lib/python3.7/site-packages/syspurpose/files.py", line 187, in read new_store.create() File "/usr/lib/python3.7/site-packages/syspurpose/files.py", line 78, in create return create_dir(os.path.dirname(self.path)) or \ File "/usr/lib/python3.7/site-packages/syspurpose/utils.py", line 53, in create_dir if e.errno == os.errno.EEXIST: AttributeError: module 'os' has no attribute 'errno' 2018-12-18 10:33:01,547 [INFO] yum:1890:MainThread @connection.py:917 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
Looks like this is happening again on Fedora 29.. I made similar changes to: /usr/lib/python3.7/site-packages/syspurpose/utils.py and /usr/lib/python3.7/site-packages/syspurpose/files.py import errno and :%s/os.errno/errno/g This has got me past that error, but now I'm getting: sudo subscription-manager register Registering to: satellite.bne-home.net:443/rhsm Username: admin Password: Environment: Library 'dict' object has no attribute 'has_key' Looks like this is raised when it tries to call: if not conduit.facts.has_key('network.fqdn'): conduit.facts['network.fqdn'] = socket.getfqdn() from /usr/share/rhsm-plugins/fqdn.py I checked to make sure that socket.getfqdn() worked on it's own, which it did. So I just did this: import socket from subscription_manager.base_plugin import SubManPlugin requires_api_version = "1.0" class FactsPlugin(SubManPlugin): name = 'fqdn fact' def post_facts_collection_hook(self, conduit): try: if not conduit.facts.has_key('network.fqdn'): conduit.facts['network.fqdn'] = socket.getfqdn() except AttributeError as e: log.debug("Attribute error in collecting facts: %s" % e) conduit.facts['network.fqdn'] = socket.getfqdn() This allows me to register the system. Probably not the greatest fix for the problem. Probably would help to identify why it couldn't get it in the first place. But my python skillz are limited and this got me out of trouble. Hopefully it provides enough information for a better solution. :)
Sorry, that log.debug section didn't actually log anything for me so I removed it and just did the try, except without logging anything. As I said, amateur Python skillz. The working one looks like this: import socket from subscription_manager.base_plugin import SubManPlugin requires_api_version = "1.0" class FactsPlugin(SubManPlugin): name = 'fqdn fact' def post_facts_collection_hook(self, conduit): try: if not conduit.facts.has_key('network.fqdn'): conduit.facts['network.fqdn'] = socket.getfqdn() except AttributeError as e: conduit.facts['network.fqdn'] = socket.getfqdn() And I verified that the fact is actually available in subscription-manager as well sudo subscription-manager facts | grep fqdn network.fqdn: fedora-desktop.bne-home.net python3.7 Python 3.7.1 (default, Nov 23 2018, 10:01:49) [GCC 8.2.1 20181105 (Red Hat 8.2.1-5)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> socket.getfqdn() 'fedora-desktop.bne-home.net'
Current master branch of subscription-manager does not include any 'os.errno'. It was replaced by 'errno' module. 'subscription-manager facts | grep fqdn' works for me too.
Fedora 29 is still listing 1.24.2-1 as the latest version, so this is still problematic when installing subscription-manager through yum.
I've also edited the files: - /usr/lib/python3.7/site-packages/syspurpose/utils.py - /usr/lib/python3.7/site-packages/syspurpose/files.py To get rid of the "module 'os' has no attribute 'errno'" error. I'm attaching these files if anyone needs them in the future. I've looked at the repo and it seems that it's already been corrected. It's just a matter of applying the fix for F29. [1] https://github.com/candlepin/subscription-manager/tree/master/syspurpose/src/syspurpose Cheers!
Created attachment 1536711 [details] utils.py fixed /usr/lib/python3.7/site-packages/syspurpose/utils.py fixed
Created attachment 1536713 [details] files.py fixed /usr/lib/python3.7/site-packages/syspurpose/files.py with the fixes
subscription-manager-1.25.5-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2019-6663f52736
subscription-manager-1.25.5-1.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-3928f88562
subscription-manager-1.25.5-1.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-10f8c3b13d
subscription-manager-1.25.5-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-10f8c3b13d
subscription-manager-1.25.5-1.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-6663f52736
subscription-manager-1.25.5-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-3928f88562
subscription-manager-1.25.5-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.
FEDORA-2019-3928f88562 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-3928f88562
subscription-manager-1.25.9-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-3928f88562
subscription-manager-1.25.9-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.