APT 源列表问题

APT 源列表问题

我正在 Debian 6.0 服务器上工作,我认为服务器上的存储库是错误的。

deb http://ftp.uk.debian.org/debian/ stable main
deb-src http://ftp.uk.debian.org/debian/ stable main

我比较了一个新的 docker 镜像,正确的似乎是

deb http://archive.debian.org/debian squeeze main
deb http://archive.debian.org/debian squeeze-lts main

由于他们已经使用了错误的存储库,我认为大多数软件包都已更新到较新的版本。现在,当我尝试安装 build-essentials 或 libc6-dev 时,出现以下错误。

旧的仓库出了什么问题?分布条目似乎是“稳定”而不是“挤压”,我想知道发生了什么......?现在可以做什么?我当然可以使用旧的存储库,但有些软件包在那里不可用,或者我可以构建一个新的操作系统并使用正确的存储库。我不确定是否可以选择降级 libc6...上次我弄乱它时,操作系统已损坏。

sudo apt-get install libc6-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.11.3-4+deb6u11) but 2.19-18+deb8u7 is to be installed
         Depends: libc-dev-bin (= 2.11.3-4+deb6u11) but it is not going to be installed
E: Broken packages

sudo apt-cache madison libc6
 libc6 | 2.11.3-4+deb6u11 | http://archive.debian.org/debian/ squeeze-lts/main amd64 Packages
 libc6 |   2.11.3-4 | http://archive.debian.org/debian/ squeeze/main amd64 Packages

答案1

手头上的问题

如您所知,您的sources.list设置是退出stable而不是退出squeeze。因此,您升级了软件包并创建了弗兰肯Debian。这个问题是可以解决的,希望从那以后你没有运行过另一个apt upgrade或类似的东西。

解决方案

因此,首先,您需要回滚所有更新。我找到了这个堆栈交换帖子这可以帮助回滚您的更改。以 root (sudo) 身份运行以下命令:

apt-get -s install $(apt-history rollback | tr '\n' ' ')

如果这有效,那么您可以删除该-s选项。正如其他用户在该帖子的评论中指出的那样,您可能需要添加脚本或使用脚本awk。这应该会让你回到之前的状态。这是另一个网站的链接,提供有关如何回滚的指南。我还将包括一个关于回滚软件包的 Debian 官方 Wiki 链接。我建议您在运行任何命令之前仔细阅读这些链接并确定最适合自己的内容。

回滚所有坏包后,您需要修复您的sources.list.

遵循 Debian Wiki 上概述的指南您的sources.listDebian 6.0 系统应该如下所示:

deb http://archive.debian.org/debian/ squeeze main 
deb-src http://archive.debian.org/debian/ squeeze main 

deb http://archive.debian.org/debian-security/ squeeze/updates main 
deb-src http://archive.debian.org/debian-security/ squeeze/updates main 

进行这些更改后运行apt update,如果您收到有关缺少 gpg 密钥的错误,apt install debian-archive-keyring请运行apt update。对于本节,我参考了这篇博文。再次强调,在采取任何行动之前请仔细查看链接。

结论

从这里您应该拥有一个可以工作的 Debian Squeeze 系统。如果您对此答案有任何疑问或疑问,请发表评论。我感谢您提供反馈来纠正任何误解并改进我的帖子。我可以根据需要更新我的答案。

祝你好运!

相关内容