개요

yum update 나 yum check-update 를 실행했는데 "loaded plugins: fastestmirror" 라는 메시지가 나오고 Hang on 되는 현상이 있어서 구글링한 결과 정리

처리

Red Hat Customer 포털에 있는 내용대로 하면 됨.

  1. Make sure the RPM database is functional.

    cp -arv /var/lib/rpm /var/lib/rpm.bak
    rm -f /var/lib/rpm/__db*
    /usr/lib/rpm/rpmdb_verify /var/lib/rpm/Packages
    CODE
  2. Remove the external repos and test again

    mkdir /etc/yum.repos.d/old
    mv /etc/yum.repos.d/*repo /etc/yum.repos.d/old
    rm -rf /var/cache/yum/*
    yum repolist -v
    CODE
  3. yum 다시 실행해서 증상 종료 확인

 

 

아래는 보관 차원에서 남겨둔 것이며 위에 있는 Red hat customer 포탈 내용대로 하면 증상이 사라짐.

 

다음 절차를 하나씩 실행한 후에 수행하려던 yum 명령어를 재실행 해보면서 증상이 사라졌는지 확인한다.

  1. DNS 설정이 제대로 되었는지 네트웍은 정상적으로 동작하는지 확인한다. 다음 명령어로 확인 가능하다.

    nslookup google.com
    telnet google.com 80
    CODE
  2. fastmirror 캐쉬 파일을 삭제한다.

    rm /var/cache/yum/timedhosts.txt
    CODE
  3. yum update yum 실행
  4. yum clean all 로 모든 cache 파일 삭제
  5. rpm db 를 삭제하고 재생성

    rm -f /var/lib/rpm/__*
    rpm --rebuilddb -v -v   
    yum clean all 
    BASH
  6. /etc/yum.conf 의 timeout 및 debug, error level 항목 조정 (기본 timeout 은 30초)

    /etc/yum.conf

    [main]
    debugelevel=1
    errorlevel=1
    timeout=1
    BASH
  7. fastmirror plugin 사용 임시 중지 (영구 중지는 /etc/yum/pluginconf.d/fastestmirror.conf 를 열어서 enabled=0 으로 설정)

     yum --verbose --noplugins  info gcc 
    ## 다음과 같은 결과가 나오면 정상 동작중임
    Config time: 0.006
    Yum Version: 3.2.29
    Setting up Package Sacks
    pkgsack time: 0.027
    rpmdb time: 0.000
    Available Packages
    Name        : gcc
    Arch        : x86_64
    Version     : 4.4.7
    Release     : 4.el6
    Size        : 10 M
    Repo        : base
    Committer   : Jakub Jelinek <jakub@redhat.com>
    Committime  : Thu Jul 18 21:00:00 2013
    Buildtime   : Fri Nov 22 04:47:41 2013
    Summary     : Various compilers (C, C++, Objective-C, Java, ...)
    URL         : http://gcc.gnu.org
    License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions
    Description : The gcc package contains the GNU Compiler Collection version 4.4.
                : You'll need this package in order to compile C code.
    BASH
  8. CentOS 의 mirrorlist 를 사용하지 않고 속도가 빠른 가까운 곳의 미러 사이트를 등록(참고 - CentOS yum 과 Ubuntu apt Mirror를 국내 사이트로 설정하기)

 

기타

webtatic 저장소 사용시

webtatic 저장소를 설치할 경우 위와 같은 증상이 발생하는 경우가 있다. 아마 mirrorlist 항목을 제대로 처리 못해서 그렇지 않을까 추측되며 다음과 같이 /etc/yum.repos.d/webtatic.repo  내 mirrorlist 를 주석 처리하고 baseurl 을 설정하면 해결되는 경우가 있다.

[webtatic]
name=Webtatic Repository EL6 - $basearch
baseurl=http://us-east.repo.webtatic.com/yum/el6/$basearch/
#mirrorlist=http://mirror.webtatic.com/yum/el6/$basearch/mirrorlist
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy
CODE

 

중복되는 repo 주소

특정 서버에서 위 증상이 지속적으로 발생하여 확인해 본 결과 /etc/yum.repos.d 에 CentOS-Base.repo 와 centos-base.repo 두 개의 파일이 존재하고 동일한 repository 를 가르키고 있었고 중복되는 저장소 파일중 하나를 삭제하니 정상 동작하였다.

Ref