Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?

本文介绍了如何通过查找并终止卡住的APT进程来解决Linux中常见的APT锁文件问题。提供了实用命令,如使用ps aux | grep apt来查找相关进程,并通过kill命令安全地终止APT或APTITUDE进程。

I see pretty much all the answers recommend deleting the lock. I don't recommend doing that as a first measure; maybe if there is no alternative. The lock is placed when an apt process is running, and is removed when the process completes. If there is a lock with no apparent process running, this may mean the process got stuck for some reason.

If you try

ps aux | grep apt

that will catch processes containing the word apt, at least. If you see an apt-get process or an aptitude process that looks stuck, you can try

kill processnumber

and if that doesn't work try

kill -9 processnumber

This should kill the process and may remove the lock. Killing an apt or aptitude process is harmless unless it is actually in the middle of package installation. In any case, if the process got stuck, you probably don't have a choice but to kill it.

Killing a dpkg process directly, if present, is not a good idea, because if dpkg is active, it is probably manipulating the package database, and killing it may leave the package database in an inconsistent state; i.e. corrupted.

Killing an apt-get or aptitude process is in general much safer.

转载于:https://www.cnblogs.com/oxspirt/p/9017115.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值