由于权限被拒绝,APT 升级失败

由于权限被拒绝,APT 升级失败

执行此操作时sudo apt-get upgrade出现此错误。请问有人能帮助我摆脱此错误吗?

Err:29 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 DEP-11 Metadata
  Could not open file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_restricted_dep11_Components-amd64.yml.gz - open (13: Permission denied)
Hit:42 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 DEP-11 Metadata
Ign:45 http://security.ubuntu.com/ubuntu xenial-security/multiverse DEP-11 64x64 Icons
Get:49 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [516 kB]
Get:50 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [220 kB]
Get:51 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [173 kB]
Ign:52 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons
Get:53 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [15.8 kB]
Get:54 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse i386 Packages [15.0 kB]
Get:55 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [7,644 B]
Ign:56 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata
Ign:57 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-11 64x64 Icons
Get:58 http://in.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,328 B]
Get:59 http://in.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 DEP-11 Metadata [4,584 B]
Get:30 http://in.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [611 kB]
Ign:40 http://in.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons
Ign:47 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 DEP-11 Metadata
Ign:52 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons
Ign:56 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata
Ign:57 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-11 64x64 Icons
Err:40 http://in.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons
  Could not open file /var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_dep11_icons-64x64.tar.gz - open (13: Permission denied)
Ign:47 http://in.archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 DEP-11 Metadata
Ign:52 http://in.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons
Get:56 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [6,341 B]
Ign:57 http://in.archive.ubuntu.com/ubuntu xenial-updates/multiverse DEP-11 64x64 Icons
Fetched 3,600 kB in 41s (87.2 kB/s)                                            
Reading package lists... Done
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/restricted/dep11/Components-amd64.yml  Could not open file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_restricted_dep11_Components-amd64.yml.gz - open (13: Permission denied)
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/xenial-updates/main/dep11/icons-64x64.tar  Could not open file /var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_dep11_icons-64x64.tar.gz - open (13: Permission denied)
E: Some index files failed to download. They have been ignored, or old ones used instead.   

我用脚步:-

sudo -i 
rm /var/lib/apt/lists/partial/*
exit
sudo apt update   

然后它给了我以下错误:-

179 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: http://security.ubuntu.com/ubuntu/dists/xenial-security/restricted/binary-amd64/by-hash/SHA256/81b9f032b48cdd473075f9798b299617d9628050291cd0cd27c140f86fc21005: Automatically disabled Acquire::http::Pipeline-Depth due to incorrect response from server/proxy. (man 5 apt.conf)
W: http://in.archive.ubuntu.com/ubuntu/dists/xenial-updates/restricted/binary-amd64/by-hash/SHA256/b9e26643ccf26941d9979437df6983487fcc21a2ef80ba4a59ab4447f339b321: Automatically disabled Acquire::http::Pipeline-Depth due to incorrect response from server/proxy. (man 5 apt.conf)   

之后我运行sudo apt upgrade但它给出了以下警告:-

W: http://in.archive.ubuntu.com/ubuntu/pool/main/s/systemd/systemd_229-4ubuntu21_amd64.deb: Automatically disabled Acquire::http::Pipeline-Depth due to incorrect response from server/proxy. (man 5 apt.conf)

答案1

我终于找到了问题所在:-
1.使用删除部分包

sudo -i 
rm /var/lib/apt/lists/partial/*
exit

2.然后更新和升级包

sudo apt update    
sudo apt upgrade  

3.pipeline broken warning通过在以下行中添加以下行来修复/etc/apt/apt.conf

Acquire::http::No-Cache true;
Acquire::http::Pipeline-Depth 0;

相关内容