Ubuntu 19.04 不正确的 sources.list

Ubuntu 19.04 不正确的 sources.list

我升级了WSL 上的 Ubuntu从 18.10 到 19.04 do-release-upgrade

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="19.04 (Disco Dingo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.04"
VERSION_ID="19.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=disco
UBUNTU_CODENAME=disco

但现在我注意到 repositories/sources.list 仍然指向 cosmic。

$ grep -li cosmic /etc/apt/sources.list /etc/apt/sources.list* /etc/apt/sources.list*/*
/etc/apt/sources.list
/etc/apt/sources.list
grep: /etc/apt/sources.list.d: Is a directory
/etc/apt/sources.list.distUpgrade
/etc/apt/sources.list.save


$ grep -li disco /etc/apt/sources.list /etc/apt/sources.list* /etc/apt/sources.list*/*
grep: /etc/apt/sources.list.d: Is a directory 

所以我猜想升级过程中一定出现了我没有注意到的故障。

我如何找出升级错误并修复它们?
我在哪里可以找到 19.04 的源列表?

答案1

在哪里可以找到 19.04 的源列表?

所需步骤:

  • 仅在 WSL 控制台中运行这些命令。否则,文件/文件夹权限将不正确。此外,用于chmod更正任何文件权限。
  • 打开Ubuntu云镜像网站:https://cloud-images.ubuntu.com/releases/19.04/release/
  • 下载ubuntu-19.04-server-cloudimg-amd64-root.TAR.XZ文件。因为它比其他文件小;)
  • /etc/apt使用命令提取文件夹tar -xvf ubuntu-19.04-server-cloudimg-amd64-root.tar.xz etc/apt。请勿在文件夹路径中添加前导斜杠。
  • sources.list现在根据需要复制该文件或任何其他所需文件。

答案2

如果您只是想sources.list在升级后更新现有的版本以指向新的发行版,您可以执行以下操作:

警告:谨慎行事!务必先备份您的文件。

sudo sed -i "s/cosmic/$(lsb_release -cs)/" /etc/apt/sources.list

该命令的形式sed为:"s/<old value>/<new value>/"

要首先备份您的文件,您只需执行以下操作:sudo cp /etc/apt/sources.list ~/

您还可以查看这个答案以了解其sources.list外观:

cat /etc/apt/sources.list 的正确输出是什么?

答案3

按照@Biswaprio 的回答,我在这里放了 ubuntu 19.04 的 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/ disco main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ disco main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ disco-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ disco-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/ disco universe
# deb-src http://archive.ubuntu.com/ubuntu/ disco universe
deb http://archive.ubuntu.com/ubuntu/ disco-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ disco-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/ disco multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ disco multiverse
deb http://archive.ubuntu.com/ubuntu/ disco-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ disco-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/ disco-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ disco-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 disco partner
# deb-src http://archive.canonical.com/ubuntu disco partner

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

相关内容