解决Wsl2中Ubuntu无法更新软件的问题

本文排版不太好,详情可见笔记 有道云笔记

安装wsl2之后,在Ubuntu中更新软件,执行apt-get update命令报错,如下

root@jiangcheng01:~# sudo apt-get update Ign:1 http://mirrors.aliyun.com/ubuntu groovy InRelease Ign:2 http://mirrors.aliyun.com/ubuntu groovy-security InRelease Ign:3 http://mirrors.aliyun.com/ubuntu groovy-updates InRelease Ign:4 http://mirrors.aliyun.com/ubuntu groovy-backports InRelease Err:5 http://mirrors.aliyun.com/ubuntu groovy Release 404 Not Found [IP: 124.239.239.226 80] Err:6 http://mirrors.aliyun.com/ubuntu groovy-security Release 404 Not Found [IP: 124.239.239.226 80] Err:7 http://mirrors.aliyun.com/ubuntu groovy-updates Release 404 Not Found [IP: 124.239.239.226 80] Err:8 http://mirrors.aliyun.com/ubuntu groovy-backports Release 404 Not Found [IP: 124.239.239.226 80] Reading package lists... Done E: The repository 'http://mirrors.aliyun.com/ubuntu groovy Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'http://mirrors.aliyun.com/ubuntu groovy-security Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'http://mirrors.aliyun.com/ubuntu groovy-updates Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'http://mirrors.aliyun.com/ubuntu groovy-backports Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. root@jiangcheng01:~# sudo vim /etc/apt/sources.list root@jiangcheng01:~# sudo apt-get update Ign:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy InRelease Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-updates InRelease Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-backports InRelease Ign:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-security InRelease Err:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy Release 404 Not Found [IP: 101.6.15.130 443] Err:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-updates Release 404 Not Found [IP: 101.6.15.130 443] Err:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-backports Release 404 Not Found [IP: 101.6.15.130 443] Err:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-security Release 404 Not Found [IP: 101.6.15.130 443] Reading package lists... Done E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-updates Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-backports Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-security Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. root@jiangcheng01:~# apt-get update Ign:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy InRelease Ign:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-updates InRelease Ign:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-backports InRelease Ign:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-security InRelease Err:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy Release 404 Not Found [IP: 101.6.15.130 443] Err:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-updates Release 404 Not Found [IP: 101.6.15.130 443] Err:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-backports Release 404 Not Found [IP: 101.6.15.130 443] Err:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-security Release 404 Not Found [IP: 101.6.15.130 443] Reading package lists... Done E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-updates Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-backports Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'https://mirrors.tuna.tsinghua.edu.cn/ubuntu groovy-security Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. root@jiangcheng01:~# apt-get install xvfb Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package xvfb root@jiangcheng01:~# sudo vim /etc/apt/sources.list root@jiangcheng01:~# apt-get update Ign:1 http://cn.archive.ubuntu.com/ubuntu groovy InRelease Ign:2 http://security.ubuntu.com/ubuntu groovy-security InRelease Ign:3 http://cn.archive.ubuntu.com/ubuntu groovy-security InRelease Ign:4 http://cn.archive.ubuntu.com/ubuntu groovy-updates InRelease Err:5 http://security.ubuntu.com/ubuntu groovy-security Release 404 Not Found [IP: 185.125.190.39 80] Err:6 http://cn.archive.ubuntu.com/ubuntu groovy Release 404 Not Found [IP: 91.189.91.38 80] Err:7 http://cn.archive.ubuntu.com/ubuntu groovy-security Release 404 Not Found [IP: 91.189.91.38 80] Err:8 http://cn.archive.ubuntu.com/ubuntu groovy-updates Release 404 Not Found [IP: 91.189.91.38 80] Reading package lists... Done E: The repository 'http://security.ubuntu.com/ubuntu groovy-security Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'http://cn.archive.ubuntu.com/ubuntu groovy Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'http://cn.archive.ubuntu.com/ubuntu groovy-security Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. E: The repository 'http://cn.archive.ubuntu.com/ubuntu groovy-updates Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.

替换阿里镜像和清华镜像都不管用,最终替换为中科大镜像成功更新了软件源。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: WSL 2是Windows Subsystem for Linux的第二个版本,可以在Windows操作系统上运行Linux发行版。WSL 2提供了更好的性能和兼容性,可以用于开发和运行Linux应用程序。 UbuntuWSL 2最受欢迎的Linux发行版之一,拥有强大的功能和广泛的应用支持。在WSL 2安装和配置Ubuntu非常简单,只需从Microsoft Store下载并安装。安装完成后,可以通过命令行访问Ubuntu,然后开始使用Linux命令和工具。 然而,在WSL 2运行Ubuntu的命令行界面可能对一些用户来说不够友好,因为他们习惯于使用图形用户界面(GUI)。为了解决这个问题,可以安装并配置一个可选的GUI包,如X Server或VcXsrv,以在WSL 2使用Ubuntu的图形界面。 这些GUI包允许用户在WSL 2运行图形应用程序,并使用鼠标和键盘进行交互。用户可以通过在WSL 2安装所需的图形应用程序和依赖项,然后通过GUI包在Windows的桌面环境打开它们。这样,用户就可以同时享受Windows和Ubuntu的优势,无需切换操作系统或使用虚拟机。 需要注意的是,使用GUI包可能需要进行一些配置和调整,以确保图形应用程序能够正确显示并与WSL 2进行良好的集成。具体操作可以在网络上搜索相关教程或参考官方文档。值得一提的是,GUI包的性能可能不如在本机Linux系统上运行应用程序,但对于一些简单的图形任务和开发环境来说已经足够了。 总的来说,通过安装和配置GUI包,用户可以在WSL 2使用Ubuntu的图形界面,同时充分利用Windows操作系统的优势和功能。 ### 回答2: WSL 2是一种在Windows操作系统上运行Linux发行版的技术,其包括Ubuntu。在WSL 2,用户可以通过命令行界面访问并操作Ubuntu系统。 在WSL 2,默认情况下是没有图形用户界面(Graphical User Interface,GUI)的,因为它更专注于为开发者提供类似Linux环境的终端界面。然而,如果用户希望在WSL 2使用GUI,可以进行一些额外的配置来实现。 要在WSL 2安装和使用Ubuntu的GUI包,首先需要安装一个X Server应用程序,例如VcXsrv或Xming。这些软件允许将Linux图形应用程序的显示发送到Windows主机上的屏幕上。 安装X Server后,可以通过在WSL 2的Ubuntu终端设置DISPLAY环境变量,将图形应用程序路由到X Server。在Ubuntu终端输入以下命令进行设置: export DISPLAY=localhost:0 接下来,可以使用命令行安装和运行所需的Ubuntu图形应用程序。只需在Ubuntu终端输入相应的命令即可。例如,可以使用apt-get命令安装图形应用程序,然后通过在终端输入应用程序的名称来运行它。 请注意,WSL 2提供的图形支持仍然存在一些限制和局限性。由于WSL 2是一个虚拟化技术,图形应用程序在Windows宿主机和Ubuntu系统之间的显示和交互可能会有一些延迟和性能损失。另外,不是所有的图形应用程序都能在WSL 2正常工作,特别是那些对硬件加速有依赖的应用程序。 总的来说,通过安装X Server和适当的配置,用户可以在WSL 2的Ubuntu系统使用图形用户界面(GUI)包来运行图形应用程序。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值