我开始使用具有以下 source.list 文件的预装操作系统:
deb http://archive.ubuntu.com/ubuntu natty main
deb http://ro.archive.ubuntu.com/ubuntu/ oneiric universe
deb-src http://ro.archive.ubuntu.com/ubuntu/ oneiric universe
deb http://ro.archive.ubuntu.com/ubuntu/ oneiric-updates universe
deb-src http://ro.archive.ubuntu.com/ubuntu/ oneiric-updates universe
Run Code Online (Sandbox Code Playgroud)
我正在尝试将其升级为:
###### Ubuntu Main Repos
deb http://ro.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
###### Ubuntu Update Repos
deb http://ro.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://ro.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://ro.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
Run Code Online (Sandbox Code Playgroud)
但是当我尝试运行 apt-get upgrade 它给了我这个:
root@syrius:/etc/apt# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
libc-dev-bin : Depends: libc6 (> 2.15) but 2.13-20ubuntu5.2 is installed
libc6 : Depends: libc-bin (= 2.13-20ubuntu5.2)
libc6-dev : Depends: libc6 (= 2.15-0ubuntu10.4) but 2.13-20ubuntu5.2 is installed
libnih-dbus1 : Depends: libnih1 (= 1.0.3-4ubuntu9.1) but 1.0.3-4ubuntu2 is installed
E: Unmet dependencies. Try using -f.
Run Code Online (Sandbox Code Playgroud)
如果我尝试运行 apt-get -f install,我会收到以下消息:
root@syrius:/etc/apt# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
nagios-images nagios3-core nagios3-cgi nagios3-common
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libc6 libnih1
Suggested packages:
glibc-doc
The following packages will be upgraded:
libc6 libnih1
2 upgraded, 0 newly installed, 0 to remove and 611 not upgraded.
4 not fully installed or removed.
Need to get 0 B/4708 kB of archives.
After this operation, 58.4 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
locale: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by locale)
locale: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by locale)
debconf: DbDriver "config": could not open /var/cache/debconf/config.dat
(Reading database ... 121436 files and directories currently installed.)
Preparing to replace libc6 2.13-20ubuntu5.2 (using .../libc6_2.15-0ubuntu10.4_amd64.deb) ...
locale: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by locale)
locale: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by locale)
debconf: DbDriver "config": could not open /var/cache/debconf/config.dat
dpkg: error processing /var/cache/apt/archives/libc6_2.15-0ubuntu10.4_amd64.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/libc6_2.15-0ubuntu10.4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
我负担不起从头开始重新安装服务器。谁能帮我让它工作?
非常感谢。
9 月 8 日更新:
root@localhost:/etc/apt# cat /etc/debian_version
wheezy/sid
root@localhost:/etc/apt# lsb_release -ac
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.10
Release: 11.10
Codename: oneiric
root@localhost:/etc/apt# cat /etc/issue.net
Ubuntu 11.1
Run Code Online (Sandbox Code Playgroud)
更新来源列表回到
deb http://old-releases.ubuntu.com/ubuntu natty main
deb http://old-releases.ubuntu.com/ubuntu/ oneiric universe
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric universe
deb http://old-releases.ubuntu.com/ubuntu/ oneiric-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric-updates universe
Run Code Online (Sandbox Code Playgroud)
Ran: http ://pastebin.com/3Z2GZ347(@admins:我没有发布链接的声誉=> apt-get update 有链接,甚至在标签中也考虑了它们)
仍然无法摆脱这个错误。我应该自己创建固定文件吗?
您似乎正在尝试通过手动编辑sources.list和运行apt-get命令将 Ubuntu 从一个版本升级到另一个版本。请不要那样做,特别是如果对您来说能够成功升级而不必重新安装很重要的话。该技术是升级Debian系统的推荐方法(尽管与您所做的不完全相同),但它既不受支持,也不可能适用于Ubuntu系统。
幸运的是,当您尝试升级时,似乎没有发生任何事情。所以您的系统可能没有损坏,并且可能仍然可以以正确的方式升级。
从一个版本的 Ubuntu 升级到另一个版本的正确方法是运行sudo do-release-upgrade. 但是,在您的情况下,必须首先处理一些事情。
如果您不愿意重新安装,则应先备份。
如果您只是希望避免重新安装,那么您应该重新安装,因为您的系统可能存在一些您不知道的问题,直到您将其用于某些重要任务(见下文)时才会出现这些问题。
但是,如果您希望避免重新安装(但愿意这样做)并且该系统不会用于任何重要的事情,那么您是否先进行完整备份将取决于对您来说是否值得采取额外的努力进行备份,以避免重新安装。
从头开始重新安装真的没有多少努力。但是备份也很简单。
(一旦您将服务器用于某些重要目的,那么在尝试升级到后续版本之前进行备份通常是一个很好的主意,并且无论如何都要保留定期备份。)
sources.list以代表当前安装的系统。首先,编辑/etc/apt/sources.list回当前安装的系统的正确描述。
如何做到这一点有点不清楚,因为不清楚当前安装的是什么系统。它是Natty还是Oneiric?预先存在的sources.list文件不一致(即,错误)。如果你知道它到底是什么版本,那就太好了——让所有的版本代号都sources.list指向那个版本。
否则,您将不得不弄清楚。如果您显示的不是完整 sources.list文件,请提供。它应该适合您的问题,或者您可以使用http://paste.ubuntu.com。
运行lsb_release -a通常会告诉您当前安装的版本。但是对于不一致的sources.list文件,所有的赌注都被取消了——如果提供所用文件的包lsb_release来自与系统中安装的其他包不同的 Ubuntu 版本,那么系统可能不会真正运行 Ubuntulsb_release报告的版本。或者它可能没有运行任何一个明确定义的 Ubuntu 版本。
因此——我知道你不想听到这个:除非你自己引入了 Precise/Oneiric 的不一致,否则你真的应该重新安装,特别是如果你想使用这个服务器来处理任何不可预测的随机故障的重要事情会有问题。
但是,如果您真的愿意,我们可以尝试处理这种情况。当然,即使一切看起来都非常成功,仍然无法知道是否有什么严重错误会在以后引起问题。当您从其他人那里获得服务器时,通常会出现这种情况,但其配置却一团糟。
libc6是一个非常重要的包。(即使它没有出现在您运行的某些命令的输出中,我也会提到这一点。)您可以用来确定真正安装的 Ubuntu 版本的另一个启发式方法是检查libc6包的版本( apt-cache policy libc6) 并查看它对应的 Ubuntu 版本。(如果它不一定是最新的,那么使用它在网络上搜索通常是解决这个问题的最佳方法,但您可以在此处对照版本信息进行检查。)
一旦您弄清楚当前安装的系统实际上是什么 - 并随时寻求更多帮助和/或在您的问题中发布更多可能相关的信息 - 然后编辑sources.list和更改所有版本代号到那个版本的代号。
因此natty,如果您决定当前系统是 11.04,或者如果您决定它是 11.10 ,那么每个、oneiric、precise或任何其他版本的代号都将更改为。nattyoneiric
old-releases存储库。现在您已经修复了文件中的版本信息sources.list,您必须将其中的下载服务器更改为old-releases.ubuntu.com. 这是必要的,因为 Natty 和 Oneiric 都是生命周期终止版本。(精确不是,所以达到这个目标是一个很好的目标,尽管我仍然建议考虑全新安装。)
关于如何切换到old-releases服务器的详细信息,请参见:
不过说真的,你只是要更换主机名在服务器的URL sources.list(之间的部分http://和下/带old-releases.ubuntu.com)。
如果您的系统在您尝试升级到下一个版本之前在其自己的版本中尽可能完全升级,则升级可能更有可能成功。
尝试安装更新的另一个好处是,如果它失败,它可能会显示有关问题的信息,这些信息比在尝试升级到不同版本时发现的问题更容易修复。
所以,运行:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get dist-upgrade
Run Code Online (Sandbox Code Playgroud)
请注意,dist-upgrade并没有尝试升级到新版本。(在 Debian 中,您可以编辑sources.list文件并运行apt-get dist-upgrade。但这不是 Debian;这在 Ubuntu 中通常不起作用。)
不过,它可能会提示您安装新软件包或删除现有软件包。(这就是和之间的区别。)所以要小心——在按下 之前注意它在问什么。upgradedist-upgradey
仅支持 Ubuntu 版本之间的升级(并且仅可能有效):
11.04 和 11.10 都不是 LTS 版本。所以11.04 Natty只能升级到11.10 Oneiric,11.10 Oneric只能升级到12.04 LTS Precise。
因此,如果您的系统是 Natty 而不是 Oneiric,那么您需要这样做两次。
要尝试升级,请运行:
sudo do-release-upgrade
Run Code Online (Sandbox Code Playgroud)
就是这样。无需手动编辑配置文件。
在do-release-upgrade未安装该实用程序的异常情况下,您可以使用以下命令安装它:
sudo apt-get install update-manager-core
Run Code Online (Sandbox Code Playgroud)
(在 12.10 Quantal 及更高版本上,它由 提供ubuntu-release-upgrader-core,以防有人使用最近的版本想知道为什么update-manager-core是错误的包。)
如果您有问题,请随时编辑您的问题或发布新问题(取决于它们是否似乎与该问题的主题相关——它们可能是相关的)。当然,其他有问题的人应该发布或编辑他们自己的问题。此外,您可能想对此答案发表评论,以便我了解问题并尝试提供帮助。
如果有效,那就太好了!然后:
如果您刚刚从 Oneiric 升级到 Precise,您就大功告成了!
如果您刚刚从 Natty 升级到 Oneiric,请do-release-upgrade再试一次。但首先,我建议您:
sudo reboot) 将使用内核等新软件。您可以在升级前排查问题,下次升级将在完全运行被升级版本的系统上进行。| 归档时间: |
|
| 查看次数: |
6623 次 |
| 最近记录: |