sudo apt-get update 中途取消,现在无法运行 sudo apt-get update

chr*_*ris 5 updates apt repository

我是 ubuntu 的新用户。到目前为止,它运行得相当好。今天我尝试过“sudo apt-get update”,但在获取数据后它冻结了。这是输出:

sudo apt-get update 
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]    
Hit:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease                     
Hit:5 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [92.2 kB]
Fetched 187 kB in 0s (225 kB/s)  
Run Code Online (Sandbox Code Playgroud)

使用sudo apt-get clean然后sudo apt-get update,我得到以下问题:

E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
Run Code Online (Sandbox Code Playgroud)

使用sudo rm -rf /var/lib/apt/lists/lock然后sudo apt-get update我得到一个新问题:

** (appstreamcli:3466): WARNING **: Exception: Unable to get write lock on /var/cache/app-info/xapian/default: already locked
Run Code Online (Sandbox Code Playgroud)
sudo fuser /var/cache/app-info/xapian/default 
Run Code Online (Sandbox Code Playgroud)

什么都不显示。

file /var/cache/app-info/xapian/default 
Run Code Online (Sandbox Code Playgroud)

显示

/var/cache/app-info/xapian/default: directory   
Run Code Online (Sandbox Code Playgroud)

小智 0

查看此链接。前几天我遇到了无法获取锁定的问题,并使用 Faheem Mitha 使用的相同答案解决了该问题。

ps aux | grep apt
Run Code Online (Sandbox Code Playgroud)

这将返回 apt 使用 PID 执行的操作的列表。然后运行:

kill processnumber
Run Code Online (Sandbox Code Playgroud)

或者

kill -9 processnumber
Run Code Online (Sandbox Code Playgroud)

您可能需要也可能不需要调用 sudo 权限来终止进程,具体取决于您的设置。


小智 0

是的,我有同样的问题,我的解决方案(我不确定是)是:

  1. 重新启动系统
  2. killall相关过程
  3. sudo apt-get upgrade
  4. 然后就可以正常安装了
  5. 完毕!有用。