Ubuntu18.10 sudo apt-get update 报错

nodesource

Posted by 婷 on October 2, 2021 本文总阅读量

问题

今天准备安装一个Linux下的苹果手机录屏软件,结果输入sudo apt-get update发生了错误,现象如下

copyright@copyright-Vostro-3559:/etc/apt$ sudo apt-get update
[sudo] copyright 的密码: 
命中:1 http://archive.ubuntukylin.com:10006/ubuntukylin xenial InRelease
命中:2 http://dl.google.com/linux/chrome/deb stable InRelease                                                                    
忽略:3 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic InRelease                                                   
命中:4 http://packages.microsoft.com/repos/vscode stable InRelease                                                               
忽略:5 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-updates InRelease                                           
忽略:6 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-backports InRelease                                         
忽略:7 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-security InRelease                                          
忽略:8 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-proposed InRelease                                          
错误:9 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic Release                                                     
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
错误:10 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-updates Release                                            
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
错误:11 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-backports Release                                
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
命中:12 http://linux.teamviewer.com/deb stable InRelease                                                               
错误:13 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-security Release                                           
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
错误:14 https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-proposed Release                                           
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification. [IP: 202.141.160.110 443]
命中:15 http://ppa.launchpad.net/voldyman/markmywords/ubuntu cosmic InRelease                     
忽略:16 https://deb.nodesource.com/node_8.x cosmic InRelease                                      
错误:17 https://deb.nodesource.com/node_8.x cosmic Release
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification. [IP: 23.63.74.51 443]
正在读取软件包列表... 完成                        
E: 仓库 “https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-updates Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-backports Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-security Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu cosmic-proposed Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “https://deb.nodesource.com/node_8.x cosmic Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。

其实一般情况下,有些库如果无法命中,刚好要下载的东西不在里面也是可以下载的,所以一开始没当回事,但是当我输入sudo apt-get install gstreamer1.0-vaapi的时候发现下载不了,然后去Ubuntu自带的软件中心发现提示我证书错误,看来得解决这个问题了。

1.png

解决方法

原本的/etc/apt/sources.list文件内容

##中科大源
deb  https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic main restricted universe multiverse
deb  https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-updates main restricted universe multiverse
deb-src  https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-updates main restricted universe multiverse
deb  https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-backports main restricted universe multiverse
deb  https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-security main restricted universe multiverse
deb  https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-proposed main restricted universe multiverse

步骤一

一开始定位问题是在证书的问题上,搜索到的很多做法就是修改/etc/apt/sources.list文件,比如按照这个链接所说增加[trusted=yes]等,但是并没有用。然后搜了很久,找到个博客的做法直接把自己https换成http,是个狠人,不得不说nb。不过修改了之后,确实报错少了几个,而且其实一般到这里应该没问题了,但是我还是无法下载gstreamer1.0-vaapi

到了这一步的etc/apt/sources.list文件是这样的

##中科大源
deb [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic main restricted universe multiverse
deb-src [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic main restricted universe multiverse
deb [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-updates main restricted universe multiverse
deb-src [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-updates main restricted universe multiverse
deb [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-backports main restricted universe multiverse
deb-src [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-backports main restricted universe multiverse
deb [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-security main restricted universe multiverse
deb-src [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-security main restricted universe multiverse
deb [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-proposed main restricted universe multiverse
deb-src [trusted=yes] http://mirrors.ustc.edu.cn/ubuntu-old-releases/ubuntu/ cosmic-proposed main restricted universe multiverse

然后报错的问题显示是跟deb.nodesource有关

2.png

步骤二

定位到nodesource上,其实也可以通过修改 /etc/apt/sources.list.d/nodesource.list,改成http的方法,但是我没有尝试,而是根据这个博客采取了另外一个做法。

sudo apt-get purge nodejs

3.png

sudo rm -r /usr/lib/node_modules/
sudo rm /etc/apt/sources.list.d/nodesource.list
sudo apt-get update

4.png

发现成功了,不出现报错了,然后再输入sudo apt-get install gstreamer1.0-vaapi也可以正常下载了

5.png

最后

突然莫名其妙出现了这个问题,感觉能想到的应该是跟我前几天升级了三年多没更新的谷歌浏览器有关系,而且我的Ubuntu系统是18.10版本的,很多都不维护了,也是很麻烦。这次修改其实治标不治本,感觉我也没有搞清楚原理,如果改成https还是会报错,但是并不妨碍我可以正常下载软件。

参考链接