Search code examples
linuxamazon-web-servicescentosredhatamazon-linux

Yum Install is taking forever to read default repositories in Amazon Linux


[root@ip-172-31-27-95 rpm]# yum -d 10 install munin-node
Loading "priorities" plugin
Loading "update-motd" plugin
Loading "upgrade-helper" plugin
Config time: 0.007
Yum version: 3.4.3
rpmdb time: 0.000
Setting up Package Sacks
amzn-main/latest                                                                                                                                                                 
| 2.1 kB     00:00     
amzn-main/latest/group                                                                                                                                                               
|  35 kB     00:00     
amzn-main/latest/primary_db                                                                                                                                                          
| 3.6 MB     00:00     
amzn-updates/latest                                                                                                                                                                  
| 2.3 kB     00:00     
amzn-updates/latest/group                                                                                                                                                            
|  35 kB     00:00     
amzn-updates/latest/updateinfo                                                                                                                                                       
| 384 kB     00:00     
amzn-updates/latest/primary_db                                                                                                                                                       
| 167 kB     00:00     
pkgsack time: 0.767

I'm trying to install munin-node into my Amazon Linux. Unfortunately every time I run yum install munin-node, it'll get stuck on reading the repositories as shown in the snippet above.

I already tried the following troubleshooting:

  1. Kill yum process
  2. rpm --rebuilddb
  3. rm /var/run/yum.pid
  4. yum clean all

Solution

  • I had the same problem so I checked for any shared file lock using:
    lslocks
    and found out that 3 processes where acquiring the same system lock files /var/lib/rpm/.dbenv.lock

    it was:

    1. rpm
    2. yum
    3. package-cleanup

    so I deleted the file:
    sudo rm /var/lib/rpm/.dbenv.lock

    tried to install again and it worked!!!