Lỗi another app is currently holding the yum lock năm 2024

The error indicates that another instance is running for the yum update, and it’s PID is 13023. Check for the PID in the ‘ps -ef’ command to see what process is holding yum lock.

ps -ef | grep 13023

root 13023 11813 3 18:31 ? 00:00:04 /usr/bin/python /usr/share/PackageKit/helpers/yum/yumBackend.py refresh-cache yes

A GUI PackageKit utility installed in the system and is holding the yum lock while running regularly. You can use either of the methods given below to resolve the error. Sometimes killing the process ID used by PackageKit utility does not work. In that case, the only solution is to disable PackageKit or remove it completely.

Method 1: killing the process ID used by PackageKit

Kill the process which is holding the yum lock, for instance:

kill -9 13023

OR

pkill PackageKit

then run the yum command again.

Remove/Disable PackageKit utility

Another way is to disable refresh-packagekit yum plug-in by editing refresh-packagekit configuration file /etc/yum/pluginconf.d/refresh-packagekit.conf :

It appears that, as part of the first boot sequence, cloud-init will ensure that any important and critical security issues are addressed (for vulnerabilities that will have come out since the AMI was released). This can be seen by picking through /var/log/cloud-init.log, the following is from an AL2 instance in my account:

Feb 18 12:02:00 cloud-init[2261]: util.py[DEBUG]: Running command ['yum', '-t', '-y', '--exclude=kernel', '--exclude=nvidia*', '--exclude=cuda*', '--security', '--sec-severity=critical', '--sec-severity=important', 'upgrade'] with allowed return codes [0] (shell=False, capture=False)
Feb 18 12:02:57 cloud-init[2261]: handlers.py[DEBUG]: finish: modules-config/config-package-update-upgrade-install: SUCCESS: config-package-update-upgrade-install ran successfully

You can see what changes are made in /var/log/yum.log

This should finish before the User Data script runs, but it's possible that it hasn't quite finished cleaning up after itself, and the lock file still exists on disk even though cloud-init thinks it's been deleted.

If you put the while loop before the yum update -y in your User Data script (as well as the place it's already in) then this should guard against it.

Issue

  • The yum command fails with the below error:

[root@rhel7 ~]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Existing lock /var/run/yum.pid: another copy is running as pid 2438.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  99 M RSS (560 MB VSZ)
    Started: Mon May  9 07:05:51 2022 - 00:15 ago
    State  : Running, pid: 2438
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory : 103 M RSS (568 MB VSZ)
    Started: Mon May  9 07:05:51 2022 - 00:17 ago
    State  : Running, pid: 2438

Environment

  • Red Hat Enterprise Linux 8.
  • Red Hat Enterprise Linux 7.
  • Red Hat Enterprise Linux 6.

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

By proceeding below, I hereby agree to use LiveChat as an external third party technology. This may involve a transfer of my personal data (e.g. IP Address) to third parties in- or outside of Europe. For more information, please see our Privacy Policy.

TRỤ SỞ CHÍNH HÀ NỘI

  • Tầng 4, Tòa nhà số 97 - 99 Láng Hạ, Đống Đa, Hà Nội (Tòa nhà Petrowaco)
  • Tel: (024) 7308 6680
  • Email: [email protected]

VĂN PHÒNG TP. HCM​

  • 927/1 CMT8, Phường 7, Quận Tân Bình, TP.Hồ Chí Minh​
  • Tel: (028) 7308 6680​
  • E-mail: [email protected]

CHI NHÁNH NGHỆ AN​

  • Tầng 2 chung cư saigonsky, Ngõ 26, Nguyễn Thái Học, Phường Đội Cung, TP. Vinh, Nghệ An​
  • Tel: (024) 7308 6680 - nhánh 6​
  • Email: [email protected]