sudo apt update 在 Ubuntu 上不起作用?

sudo apt update 在 Ubuntu 上不起作用?
sudo apt update
Get:1 file:/var/cuda-repo-ubuntu2004-11-6-local  InRelease
Ign:1 file:/var/cuda-repo-ubuntu2004-11-6-local  InRelease
Get:2 file:/var/cuda-repo-ubuntu2204-12-4-local  InRelease [1572 B]
Get:3 file:/var/cuda-repo-ubuntu2004-11-6-local  Release [564 B]
Get:2 file:/var/cuda-repo-ubuntu2204-12-4-local  InRelease [1572 B]
Get:3 file:/var/cuda-repo-ubuntu2004-11-6-local  Release [564 B]
Hit:5 nvidia.github.io/libnvidia-container/stable/deb/amd64  InRelease
Hit:6 developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease
Hit:7 developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  InRelease
Hit:8 download.docker.com/linux/ubuntu focal InRelease
Hit:9 artifacts.elastic.co/packages/7.x/apt stable InRelease
Hit:10 download.docker.com/linux/ubuntu jammy InRelease
Hit:11 in.archive.ubuntu.com/ubuntu jammy InRelease
Ign:12 example.com/repo stable InRelease
Hit:13 in.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:14 in.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:15 in.archive.ubuntu.com/ubuntu jammy-security InRelease
Ign:12 example.com/repo stable InRelease
Ign:12 example.com/repo stable InRelease
Err:12 example.com/repo stable InRelease
  500  Internal Server Error [IP: 93.184.215.14 80]
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

2 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: file:/var/cuda-repo-ubuntu2004-11-6-local/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

W: developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

W: download.docker.com/linux/ubuntu/dists/focal/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

W: download.docker.com/linux/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

W: in.archive.ubuntu.com/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: in.archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

W: in.archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

W: in archive.ubuntu.com/ubuntu/dists/jammy-security/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

W: Failed to fetch example.com/repo/dists/stable/InRelease  500  Internal Server Error [IP: 93.184.215.14 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

答案1

这就是问题:

(...)
Err:12 example.com/repo stable InRelease
  500  Internal Server Error [IP: 93.184.215.14 80]
(...)

您添加了“example.com/repo”,可能是来自某些作为示例的指南,但它不是实际的存储库,它只是一个占位符。

删除它并apt应该可以正常工作(现在可以忽略所有其他警告)。

答案2

删除不存在的存储库条目:

打开源列表文件:

使用文本编辑器(如 nano 或 vim)编辑源列表文件。该文件通常位于目录/etc/apt/sources.list内的文件中/etc/apt/sources.list.d/

识别并删除有问题的条目:

在源列表文件中查找包含“example.com/repo”条目的行。

通过在行开头添加“#”来删除或注释掉此行。

保存并退出:

保存对文件所做的更改。

关闭文本编辑器。

更新APT:

删除有问题的条目后,运行以下命令来更新 APT 并刷新包缓存:

sudo apt update

相关内容