博客园  :: 首页  :: 管理

我们在aws上使用市场提供的RHEL-8.x系统后,license相关的都是由aws官网一起提供了

最近笔者将aws上一台作过系统加固的RHEL-8.x导出到自己本地DC环境,也注册了Redhat官网购买的license订阅

但在使用所有yum命令时,都会报如下一段错误(TypeError: the JSON object must be str, bytes or bytearray, not 'NoneType'):

[root@qq_5201351 ~]# yum repolist
Updating Subscription Management repositories.
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/dnf/plugin.py", line 104, in _caller
    getattr(plugin, method)()
  File "/usr/lib/python3.6/site-packages/dnf-plugins/amazon-id.py", line 111, in config
    aws_region = json.loads(id_doc)['region']
  File "/usr/lib64/python3.6/json/__init__.py", line 348, in loads
    'not {!r}'.format(s.__class__.__name__))
TypeError: the JSON object must be str, bytes or bytearray, not 'NoneType'

repo id                                                                 repo name
rhel-8-for-x86_64-appstream-rpms                                        Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
rhel-8-for-x86_64-baseos-rpms                                           Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
[root@qq_5201351 ~]# 

当然虽然有报错,但其实是可以正常使用yum安装软件的,但毕竟有报错,说明终究还是有一点不正常的 ,笔者准备处理掉这个报错

看到上面的报错中,有一点aws相关的信息,突然想到是不是与aws提供的yum相关的配置与组件有关系呢

通过查询官方文档与分析,发现是与rh-amazon-rhui-client-3.0.32-1.el8.noarch这个软件包有关系

然后具体看了一下,这个软件具体包含的文件列表,如下

[root@qq_5201351 ~]# rpm -ql rh-amazon-rhui-client-3.0.32-1.el8.noarch
/etc/dnf/plugins/amazon-id.conf
/etc/init.d/choose_repo
/etc/init.d/rh-cloud-firstboot
/etc/pki/rhui/cdn.redhat.com-chain.crt
/etc/pki/rhui/content-rhel8.key
/etc/pki/rhui/product/content-rhel8.crt
/etc/pki/rhui/product/rhui-client-config-server-8.crt
/etc/pki/rhui/rhui-client-config-server-8.key
/etc/yum.repos.d/redhat-rhui-beta.repo
/etc/yum.repos.d/redhat-rhui-client-config.repo
/etc/yum.repos.d/redhat-rhui.repo
/usr/bin/rhui-restore-repos
/usr/bin/rhui-set-release
/usr/lib/python3.6/site-packages/dnf-plugins/__pycache__/amazon-id.cpython-36.opt-1.pyc
/usr/lib/python3.6/site-packages/dnf-plugins/__pycache__/amazon-id.cpython-36.pyc
/usr/lib/python3.6/site-packages/dnf-plugins/amazon-id.py
/usr/sbin/choose_repo.py
/usr/sbin/rh-cloud-firstboot.py
[root@qq_5201351 ~]#

分析后,是可以删除的,于是卸载,再测试,发现yum相关的命令再无报错:

[root@qq_5201351 ~]# rpm -e rh-amazon-rhui-client-3.0.32-1.el8.noarch
[root@qq_5201351 ~]# yum repolist
Updating Subscription Management repositories.
repo id repo name
rhel-8-for-x86_64-appstream-rpms Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
rhel-8-for-x86_64-baseos-rpms Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
[root@qq_5201351 ~]# 

补充说明:默认情况下,如果redhat 8.x系统注册了redhat官方订阅后,

即使/etc/yum.repos.d目录没有配置文件,执行yum相关的命令后,也会生成一个默认的redhat.repo

 

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/15602658.html