我无法使用“apt install”扩展我的 WSL

我无法使用“apt install”扩展我的 WSL

在我的 Windows PC 上,我有一个用于 Linux 的 Windows 子系统 (WSL),更确切地说是 Canonical Group Limited 的 Ubunto 应用程序。

当我想安装新的工具或程序时,我会使用apt install但这似乎不起作用:

Linux Prompt>sudo apt install libxml2-utils
[sudo] password for <username>:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libxml2-utils

以我个人拙见,这可能是由两件事造成的:

  1. WSL 有问题
  2. 我的 Windows 机器(托管 WSL)阻止了 WSL 请求。

就第一个而言,此命令没有给出任何结果:

Linux Prompt>sudo find /var -mtime -5

也就是说,/var目录中不会有过去 5 天的任何日志?别指望我会相信这一点。那么,/var/adm/messages我的 WSL 在哪里?

就第二个问题而言,我在这里考虑的是防火墙,但是尽管日志设置提到每个需要记录的内容,但“pfirewall.log”文件是空的(大小=0Kb)。

乍一看,Windows 的事件日志也没有提供任何信息。

有人知道发生了什么事以及如何在我的 WSL 上安装更新吗?

提前致谢

修改于姆塔克的回答

我已经启动了apt get-update,但它没有工作,因为一些互联网网站据称是不正确的(我非常怀疑:我相信我的电脑无法连接该网站,导致错误消息),以下是输出apt-get update

Get:1 http://archive.ubuntu.com/ubuntu focal InRelease
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://archive.ubuntu.com/ubuntu focal InRelease' is not signed.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://security.ubuntu.com/ubuntu focal-security InRelease' is not signed.
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates InRelease' is not signed.
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: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://archive.ubuntu.com/ubuntu focal-backports InRelease' is not signed.
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.

我发现StackOverflow 问题关于这个问题,我的印象是苏巴什·库马尔可能简单而且正确,但我不知道该怎么做。(其他答案包括从名为“playonlinux”的 URL 下载并安装某些内容,这听起来不太可靠)

下一步编辑:/etc/apt/sources.list 的内容

我的是这个样子/etc/apt/sources.list的。香草版是什么样的?

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ focal main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted
deb http://security.ubuntu.com/ubuntu/ focal-security universe
# deb-src http://security.ubuntu.com/ubuntu/ focal-security universe
deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse

下次更新:sources.list 更新和“sudo apt update”
Sources.list 现在如下所示:

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ focal main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted
deb http://security.ubuntu.com/ubuntu/ focal-security universe
# deb-src http://security.ubuntu.com/ubuntu/ focal-security universe
deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse

# Added: SuperUser URL : superuser.com/questions/1671403
deb http://it.archive.ubuntu.com/ubuntu/ focal main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ focal main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu focal-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu focal-security main universe restricted multiverse

deb http://it.archive.ubuntu.com/ubuntu/ focal-updates main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ focal-updates main universe restricted multiverse
# Finished adding from SuperUser

启动后sudo apt update产生以下结果:

[sudo] password for <username>:
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:2 http://it.archive.ubuntu.com/ubuntu focal InRelease
Err:2 http://it.archive.ubuntu.com/ubuntu focal InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease
Err:3 http://security.ubuntu.com/ubuntu focal-security InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Err:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:5 http://it.archive.ubuntu.com/ubuntu focal-updates InRelease
Err:5 http://it.archive.ubuntu.com/ubuntu focal-updates InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://archive.ubuntu.com/ubuntu focal InRelease' is not signed.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://it.archive.ubuntu.com/ubuntu focal InRelease' is not signed.
E: Failed to fetch http://it.archive.ubuntu.com/ubuntu/dists/focal/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://security.ubuntu.com/ubuntu focal-security InRelease' is not signed.
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates InRelease' is not signed.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Failed to fetch http://it.archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://it.archive.ubuntu.com/ubuntu focal-updates InRelease' is not signed.
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: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://archive.ubuntu.com/ubuntu focal-backports InRelease' is not signed.
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.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target Packages (universe/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:46 and /etc/apt/sources.list:55
W: Target Packages (universe/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:46 and /etc/apt/sources.list:55
W: Target Translations (universe/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:46 and /etc/apt/sources.list:55
W: Target CNF (universe/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:46 and /etc/apt/sources.list:55
W: Target CNF (universe/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:46 and /etc/apt/sources.list:55
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target CNF (restricted/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target CNF (restricted/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:44 and /etc/apt/sources.list:55
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:48 and /etc/apt/sources.list:55
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:48 and /etc/apt/sources.list:55
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:48 and /etc/apt/sources.list:55
W: Target CNF (multiverse/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:48 and /etc/apt/sources.list:55
W: Target CNF (multiverse/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:48 and /etc/apt/sources.list:55

答案1

这基本上是 Ubuntu 的基本用法,让我们尝试一下:

当我想安装新工具或程序时,我使用 apt install 但这似乎不起作用

您必须首先使用以下命令更新本地软件包存储库缓存:

sudo apt-get update

此后,你的apt install意志就会实现。


就第一个而言,此命令没有给出任何结果

它很可能不会产生任何结果。在我的 WSL 上也是如此。

那么,我的 WSL 的 /var/adm/messages 在哪里?

/var/adm/messagessystemd自从推出以来就已消失。journalctl是检索系统和应用程序日志的新方法。

答案2

检查此文件: /etc/apt/sources.list ,备份它并用原始文件替换它。

确保访问“archive.ubuntu.com”

将其放入 sources.list 中:

deb http://it.archive.ubuntu.com/ubuntu/ focal main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ focal main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu focal-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu focal-security main universe restricted multiverse

deb http://it.archive.ubuntu.com/ubuntu/ focal-updates main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ focal-updates main universe restricted multiverse

相关内容