문제 개요
Oracle Cloud에서 DB 서버를 설정하고 MySQL Workbench로 접속하려 할 때, CentOS 8 librepo 오류가 나타났다. 순조롭게 클라우드 DB가 만들어지나 했는데 아니나 다를까 똑같은 에러만 몇백번을 봤다… 혹시나 다른 사람도 나와 같은 곳에 헤메고 있을까 “Failed loading plugin osmplugin: No module named ‘librepo’” 오류 해결 방법을 포스팅한다.
증상 및 원인
아래 코드가 몇백번이나 본 오류이다.
Failed loading plugin "osmplugin": No module named 'librepo'
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
이 오류는 CentOS 서비스 중단으로 인해 발생하는데 정석적인 해결을 위해서는 CentOS Stream으로 업그레이드해야 합니다. 그런데 이미 서버를 사용하고 있을 때 혹시나 혹시나 다른 오류가 생길까 해서 아래 과정을 거쳐서 해결한다.
해결 과정
루트 권한 획득
sudo -s
리포지토리 설정 확인 및 변경
- 리포지토리 폴더로 이동:
[root@localhost etc]# cd yum.repos.d
- 리포지토리 목록 확인:
[root@localhost yum.repos.d]# ls
total 84
-rw-r--r--. 1 root root 715 Sep 29 12:26 CentOS-Base.repo
-rw-r--r--. 1 root root 723 Sep 29 12:26 CentOS-Stream-AppStream.repo
-rw-r--r--. 1 root root 708 Sep 29 12:26 CentOS-Stream-BaseOS.repo
-rw-r--r--. 1 root root 316 Sep 29 12:26 CentOS-Stream-Debuginfo.repo
-rw-r--r--. 1 root root 754 Sep 29 12:26 CentOS-Stream-Extras-common.repo
-rw-r--r--. 1 root root 710 Sep 29 12:26 CentOS-Stream-Extras.repo
-rw-r--r--. 1 root root 744 Sep 29 12:26 CentOS-Stream-HighAvailability.repo
-rw-r--r--. 1 root root 696 Sep 29 12:26 CentOS-Stream-Media.repo
-rw-r--r--. 1 root root 693 Sep 29 12:26 CentOS-Stream-NFV.repo
-rw-r--r--. 1 root root 728 Sep 29 12:26 CentOS-Stream-PowerTools.repo
-rw-r--r--. 1 root root 700 Sep 29 12:26 CentOS-Stream-RealTime.repo
-rw-r--r--. 1 root root 758 Sep 29 12:26 CentOS-Stream-ResilientStorage.repo
-rw-r--r--. 1 root root 1771 Sep 29 12:26 CentOS-Stream-Sources.repo
-rw-r--r--. 1 root root 1680 Aug 31 05:48 epel-modular.repo
-rw-r--r--. 1 root root 1332 Aug 31 05:48 epel.repo
-rw-r--r--. 1 root root 1779 Aug 31 05:48 epel-testing-modular.repo
-rw-r--r--. 1 root root 1431 Aug 31 05:48 epel-testing.repo
-rw-r--r--. 1 root root 2325 Oct 24 2023 mysql-community-debuginfo.repo
-rw-r--r--. 1 root root 3361 Oct 24 2023 mysql-community.repo
-rw-r--r--. 1 root root 3466 Oct 24 2023 mysql-community-source.repo
-rw-r--r--. 1 root root 100 Sep 29 10:16 nginx.repo
- CentOS-Base.repo 파일 내용 확인:
[root@localhost yum.repos.d]# vi CentOS-Base.repo
파일 내용(만약에 없으면 따라 채워넣어 주자.):
a를 누르면 insert 모드, esc를 누르면 맨 아래로 이동, 이후 “:wq!” 나 “:qa!”로 나갈 수 있음.
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[BaseOS]
name=CentOS-$releasever - Base
mirrorlist=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- 리포지토리 설정 변경:
mirrorlist= 를 주석처리 하고
아래 baseurl 주석을 제외시키고 mirror.centos.org에서 vault.centos.org로 변경하는 코드
[root@localhost yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# sed -i 's|#baseurl=|baseurl=|g' /etc/yum.repos.d/CentOS-*
- 변경 사항 확인:
[root@localhost yum.repos.d]# vi CentOS-Base.repo
변경된 내용:
[BaseOS]
name=CentOS-$releasever - Base
#mirrorlist=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
baseurl=/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
패키지 업데이트 및 설치
- 패키지 저장소 불러오기:
[root@localhost yum.repos.d]# dnf repolist
CentOS-8 - AppStream 8.2 MB/s | 8.4 MB 00:01
CentOS-8 - Base 9.1 MB/s | 4.6 MB 00:00
repo id repo name status
AppStream CentOS-8 - AppStream 5,596
BaseOS CentOS-8 - Base 1,896
extras CentOS-8 - Extras 38
- CentOS 기본 패키지 설치:
[root@localhost yum.repos.d]# dnf -y install epel-release
마지막 메타 데이터 만료 확인 : 0:00:25 전에 2023년 04월 25일 (화) 오전 11시 06분 02초.
Dependencies resolved.
=============================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================
Installing:
epel-release noarch 8-11.el8 extras 24 k
Transaction Summary
=============================================================================================================================================
설치 1 Package
Total download size: 24 k
Installed size: 35 k
패키지 다운로드중:
epel-release-8-11.el8.noarch.rpm 328 kB/s | 24 kB 00:00
---------------------------------------------------------------------------------------------------------------------------------------------
합계 322 kB/s | 24 kB 00:00
경고: /var/cache/dnf/extras-841cbf2e55745cba/packages/epel-release-8-11.el8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
CentOS-8 - Extras 1.6 MB/s | 1.6 kB 00:00
GPG키 0x8483C65D를 불러옵니다:
사용자 ID : "CentOS (CentOS Official Signing Key) <[email protected]>"
지문: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
출처: /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
...
- 패키지 업데이트(약 10분 소요):
[root@localhost /]# yum -y update
Extra Packages for Enterprise Linux Modular 8 - x86_64 175 kB/s | 733 kB 00:04
Extra Packages for Enterprise Linux 8 - x86_64 6.0 MB/s | 14 MB 00:02
마지막 메타 데이터 만료 확인 : 0:00:01 전에 2023년 04월 25일 (화) 오전 11시 07분 17초.
Dependencies resolved.
=============================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================
Installing:
centos-linux-release noarch 8.5-1.2111.el8 BaseOS 22 k
replacing centos-release.x86_64 8.1-1.1911.0.8.el8
replacing centos-repos.x86_64 8.1-1.1911.0.8.el8
kernel x86_64 4.18.0-348.7.1.el8_5 BaseOS 7.0 M
...
- 리포지토리 설정 재변경:
[root@localhost yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
CentOS Stream으로 업그레이드
- CentOS Stream으로 업그레이드:
[root@localhost /]# sudo dnf install centos-release-stream -y
[root@localhost /]# sudo dnf swap centos-{linux,stream}-repos -y
[root@localhost /]# sudo dnf distro-sync -y
문제 해결 후 확인
- CentOS 버전 확인:
[root@localhost /]# cat /etc/redhat-release
CentOS Stream release 8
결론 및 참고 자료
“Failed loading plugin osmplugin” 는 여전히 나타날 때도 있지만 실행되는 것이 천만 다행인것 같다..
참고 자료
- CentOS 8 오류 해결(이 분 덕분에 살았다..)