【Linux】【Advanced Packaging Tools】Ubuntu下 sudo apt update 常见问题及处理

本文记录在使用 Ubuntu 过程中,处理 sudo apt update 报错的笔记.

Q&A 1.

1.问题详情:

$ sudo apt update
Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

 
2.解决方法:

sudo rm -rf /var/lib/apt/lists/

如果仍未解决,继续输入下面的命令

sudo rm -f /var/cache/apt/archives/lock
sudo rm -f /var/lib/dpkg/lock
sudo dpkg --configure -a

Q&A 2.

1.问题详情:

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

 
2.解决方法:

sudo killall apt apt-get
sudo rm -rf /var/lib/dpkg/lock*
sudo dpkg --configure -a

Q&A 3.

1.问题详情:

$ sudo apt update
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease [247 kB]
    ...
    ...               
Get:80 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/multiverse DEP-11 64x64 Icons [2,638 B]                               
Fetched 44.6 MB in 24s (1,800 kB/s)                                                                                                      
*** Error in `appstreamcli': double free or corruption (fasttop): 0x00000000027c2b30 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7f55b0090725]
/lib/x86_64-linux-gnu/libc.so.6(+0x7ff4a)[0x7f55b0098f4a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f55b009cabc]
/usr/lib/x86_64-linux-gnu/libappstream.so.3(as_component_complete+0x439)[0x7f55b0414d19]
/usr/lib/x86_64-linux-gnu/libappstream.so.3(as_data_pool_update+0x44a)[0x7f55b0415f0a]
/usr/lib/x86_64-linux-gnu/libappstream.so.3(as_cache_builder_refresh+0x1c2)[0x7f55b040b272]
appstreamcli(ascli_refresh_cache+0x12e)[0x4049de]
appstreamcli(as_client_run+0x6fb)[0x403ceb]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f55b0039830]
appstreamcli(_start+0x29)[0x403519]
======= Memory map: ========
00400000-00408000 r-xp 00000000 08:06 395814                             /usr/bin/appstreamcli
00607000-00608000 r--p 00007000 08:06 395814                             /usr/bin/appstreamcli
    ...
    ...
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi'
E: Sub-process returned an error code

 
2.解决方法:

sudo pkill -KILL appstreamcli
wget -P /tmp https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb
sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb

Q&A 4.

1.问题详情:

$ sudo apt-get update
Hit:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
    ...
    ...
Get:12 https://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,093 B]
Fetched 6,195 B in 3s (1,887 B/s)     
Reading package lists... Done
W: GPG error: https://repo.fdzh.org/chrome/deb stable Release: The following signatures were invalid: KEYEXPIRED 1555048520  KEYEXPIRED 1579833932  KEYEXPIRED 1555048520  KEYEXPIRED 1555048520  KEYEXPIRED 1579833932  KEYEXPIRED 1555048520  KEYEXPIRED 1579833932
W: The repository 'https://repo.fdzh.org/chrome/deb stable Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.

这是由于 /etc/apt/sources.list.d/google-chrome.list 签名验证无效导致的. 在安装 Chrome 完成后删除即可.
 
2.解决方法:
 
直接删除,

sudo rm -rf /etc/apt/sources.list.d/google-chrome.list

或者,以备份形式保存,

sudo mv /etc/apt/sources.list.d/google-chrome.list /etc/apt/sources.list.d/google-chrome.list.save

Q&A 5.

1.问题详情:

E: The repository 'http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial Release' does not have a Release file.

这是由于 'http://ppa.launchpad.net/fcitx-team/nightly/ubuntu xenial Release' 失效导致的. 在安装 Sogou Pinyin 的时候,可以换源安装,可参考 Ubuntu 16.04 安装搜狗中文输入法安装.

2.解决方法:
 
直接删除,

sudo rm -f /etc/apt/sources.list.d/fcitx-team-ubuntu-nightly-xenial.list

或者,以备份形式保存,

sudo mv /etc/apt/sources.list.d/fcitx-team-ubuntu-nightly-xenial.list /etc/apt/sources.list.d/fcitx-team-ubuntu-nightly-xenial.list.save

Q&A 6.

1.问题详情:

Err:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic Release
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification.

使用了基于 https 协议的镜像源,所以需要额外的安装关于 https 的包. 但是此时 apt 是无法使用的,需要将镜像源临时修改为 http 协议.

2.解决方法:

修改 /etc/apt/sources.list.

sudo vim /etc/apt/sources.list

https 修改为 http.

sudo apt update

安装关于 https 的包.

sudo apt install apt-transport-https
sudo apt install ca-certificates

最后将 /etc/apt/sources.list 中的http 修改为 https.

Q&A 7.

1.问题详情:

dpkg: error: dpkg frontend is locked by another process

2.解决方法:

找出保存锁文件的进程

sof /var/lib/dpkg/lock-frontend

终止进程

sudo kill -9 PID

移除锁定并重新配置 dpkg

sudo rm /var/lib/dpkg/lock-frontend
sudo dpkg --configure -a
  • 7
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值