[AWS Technical Support Note] วิธีรับมือกับข้อผิดพลาด “This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.” เมื่อรันคำสั่ง dnf upgrade บน EC2 (RHEL)

เนื่องจาก EC2 ที่มาจาก RHEL AMI มี subscription พื้นฐานเพื่อรองรับการแก้ไขจากการอัพเดทและการ maintenance อยู่แล้วจึงไม่มีความจำเป็นต้องเปิดใช้งาน subscription-manager โดยสามารถตั้งค่า Enable=1 ให้เป็น Enable=0 ในคำสั่ง /etc/yum/pluginconf.d/subscription-manager.conf เพื่อแก้ปัญหาดังกล่าวได้

ปัญหาที่เกิดขึ้น

ทำการอัปเดต EC2 instance ที่เปิดใช้งานจาก Redhat Enterprise Linux AMI

เมื่อรันคำสั่ง dnf upgrade ก็แสดงข้อผิดพลาดดังนี้

$ dnf upgrade
YYYY-MM-DD hh:mm:ss,sss [ERROR] dnf:4883:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
Not root, Subscription Management repositories not updated
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Error: This command has to be run with superuser privileges (under the root user on most systems).

เป็นปัญหาที่ license รึเปล่าครับ ขอวิธีแก้ไขด้วยครับ

วิธีแก้ปัญหา

เนื่องจาก EC2 ที่มาจาก RHEL AMI มี subscription พื้นฐานเพื่อรองรับการแก้ไขจากการอัพเดทและการ
maintenance อยู่แล้วจึงไม่มีความจำเป็นต้องเปิดใช้งาน subscription-manager

โดยสามารถแก้ปัญหานี้ด้วยการตั้งค่า Enable=1 ให้เป็น Enable=0 ใน directory /etc/yum/pluginconf.d/subscription-manager.conf

/etc/yum/pluginconf.d/subscription-manager.conf

[main]
enabled=0 #(★ เปลี่ยนจาก 1 เป็น 0 )

# When following option is set to 1, then all repositories defined outside redhat.repo will be disabled
# every time subscription-manager plugin is triggered by dnf or yum disable_system_repos=0

ผลลัพธ์หลังกำหนดค่า

$ sudo dnf upgrade
Last metadata expiration check: ★วันที่★
Dependencies resolved.
================================================================================
 Package           Arch   Version                 Repository               Size
================================================================================
Installing:
 kernel            x86_64 4.18.0-305.3.1.el8_4    rhel-8-baseos-rhui-rpms 5.9 M
 kernel-core       x86_64 4.18.0-305.3.1.el8_4    rhel-8-baseos-rhui-rpms  36 M
 kernel-modules    x86_64 4.18.0-305.3.1.el8_4    rhel-8-baseos-rhui-rpms  28 M
Upgrading:
 dhcp-client       x86_64 12:4.3.6-44.el8_4.1     rhel-8-baseos-rhui-rpms 318 k
 dhcp-common       noarch 12:4.3.6-44.el8_4.1     rhel-8-baseos-rhui-rpms 207 k
 dhcp-libs         x86_64 12:4.3.6-44.el8_4.1     rhel-8-baseos-rhui-rpms 148 k
 glib2             x86_64 2.56.4-10.el8_4         rhel-8-baseos-rhui-rpms 2.5 M
 kernel-tools      x86_64 4.18.0-305.3.1.el8_4    rhel-8-baseos-rhui-rpms 6.1 M
 kernel-tools-libs x86_64 4.18.0-305.3.1.el8_4    rhel-8-baseos-rhui-rpms 5.9 M
 microcode_ctl     x86_64 4:20210216-1.20210525.1.el8_4
                                                  rhel-8-baseos-rhui-rpms 5.5 M
 polkit            x86_64 0.115-11.el8_4.1        rhel-8-baseos-rhui-rpms 154 k
 polkit-libs       x86_64 0.115-11.el8_4.1        rhel-8-baseos-rhui-rpms  76 k
 python3-perf      x86_64 4.18.0-305.3.1.el8_4    rhel-8-baseos-rhui-rpms 6.0 M
Installing dependencies:
 linux-firmware    noarch 20201218-102.git05789708.el8
                                                  rhel-8-baseos-rhui-rpms 123 MTransaction Summary
================================================================================
Install   4 Packages
Upgrade  10 PackagesTotal download size: 219 M
Is this ok [y/N]:

บทความอ้างอิง

Red Hat Enterprise Linux on Amazon EC2 images include a basic subscription for updates and maintenance fixes that is reflected in the price charged by Amazon Web Services. There is no need for a separate agreement with Red Hat or additional charges.

บนอิมเมจ Amazon EC2 ของ Red Hat Enterprise Linux จะมี subscription พื้นฐานสำหรับการแก้ไขจากการอัพเดทและการ maintenance อยู่ ซึ่งรวมอยู่ในราคาที่ Amazon Web Services เรียกเก็บเงินอยู่แล้ว จึงไม่จำเป็นต้องทำข้อตกลงเพิ่มเติมกับ Red Hat หรือคิดค่าใช้จ่ายเพิ่มเติม

บทความต้นฉบับ