ubuntu -- apt update error

最近在一次ubuntu的例行apt更新中,竟然报错了;在一阵疯狂Google后,总算是解决了,现总结如下:

出现错误

尝试sudo apt update,输出如下错误:

1
2
3
4
5
$ Err:17 http://ppa.launchpad.net/a-v-shkop/chromium/ubuntu bionic Release       
404 Not Found [IP: 91.189.95.83 80]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/a-v-shkop/chromium/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.

解决方案

根据错误提示,可知为ppa源问题,解决如下:

1
sudo add-apt-repository -r http://ppa.launchpad.net/a-v-shkop/chromium/ubuntu

另外,网上还给出了额外的shell脚本解决方法

1.touch ppa-remove 新建一个文本

输入如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
sudo rm /tmp/update.txt; tput setaf 6; echo "Initializing.. Please Wait"
sudo apt-get update >> /tmp/update.txt 2>&1; awk '( /W:/ && /launchpad/ && /404/ ) { print substr($5,26) }' /tmp/update.txt > /tmp/awk.txt; awk -F '/' '{ print $1"/"$2 }' /tmp/awk.txt > /tmp/awk1.txt; sort -u /tmp/awk1.txt > /tmp/awk2.txt
tput sgr0
if [ -s /tmp/awk2.txt ]
then
tput setaf 1
printf "PPA's going to be removed\n%s\n" "$(cat /tmp/awk2.txt)"
tput sgr0
while read -r line; do echo "sudo add-apt-repository -r ppa:$line"; done < /tmp/awk2.txt > out
bash out
else
tput setaf 1
echo "No PPA's to be removed"
tput sgr0
fi

2.赋予文件执行权限

1
sudo chmod +x ppa-remove

3.运行

1
sudo ./ppa-remove