从 12.04 升级到 14.04 时,如何修复命令行中的“无法计算升级”问题?

从 12.04 升级到 14.04 时,如何修复命令行中的“无法计算升级”问题?

我在 DigitalOcean 服务器上运行 Ubuntu 12.04。

我想将其升级到更高版本(12.04->14.04->16.04),但由于上述错误而无法升级。DigitalOcean 提供了升级教程,但它没有帮助,因为它没有解释如何解决问题。我也尝试了类似问题中的所有答案,这些答案都使用命令行。问题本质上与这里这里

"An unresolvable problem occurred while calculating the upgrade: E:Unable to correct problems, you have held broken packages. This can be caused by:
* Upgrading to a pre-release version of Ubuntu
* Running the current pre-release version of Ubuntu
* Unofficial software packages not provided by Ubuntu"
  • 我没有添加 ppa
  • 我没有添加任何额外的来源/etc/apt/sources.list但我必须提到,这里只列出了 DigitalOcean 镜像,没有 ubuntu 默认服务器。
  • 我有超过 900 个包裹被列为损坏/var/log/dist-upgrade/apt.log。(好像它们都坏了)
  • 我尝试了这些命令(按正确的顺序)apt-get update, apt-get upgrade, apt-get dist-upgrade, apt-get --purge autoremove, apt-get autoclean, apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }')等等,它们在类似问题的答案中列出,但它们什么也不做,因为它们认为一切正常。

您还有其他关于如何解决该问题的建议吗?

更新:我认为 sources.list 中的 DigitalOcean 服务器可能存在问题,因此我将其更改为原始 Ubuntu 服务器。现在我在 apt.log 中只收到 2 个错误:

ERROR getting the encoding failed
Traceback (most recent call last):
  File "/tmp/update-manager-cwZhf2/DistUpgrade/DistUpgradeView.py", line 40, in <module>
    locale.setlocale(locale.LC_ALL, "")
  File "/usr/lib/python2.7/locale.py", line 539, in setlocale
    return _setlocale(category, locale)
Error: unsupported locale setting
ERROR Dist-upgrade failed: 'E:Unable to correct problems, you have held broken packages.

我不知道是否是语言环境错误导致的。我尝试通过导出和来修复它LANG,但没有帮助。我会尝试修复它,如果有帮助的话,我会更新问题。LANGUAGELC_ALL"en_US.utf8"

更新2: 区域设置命令的输出:

$locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

更新 3: 将区域设置设置为“C”后(感谢 Gunnar Hjalmarsson),区域设置错误消失apt.log,但调用do-release-upgrade仍然会导致错误:

DEBUG /openCache(), new cache size 47033
DEBUG need_server_mode(): can not find a desktop meta package or key deps, running in server mode
DEBUG Installing 'locales' (priority in required set 'required' but not scheduled for install)
ERROR Dist-upgrade failed: 'E:Unable to correct problems, you have held broken packages.'

仍然没有升级。

答案1

评论中长篇讨论的总结:

do-release-upgradelocales由于包不存在,因此无法运行。因此解决方案是安装locales,这是必需的包。

OP 在尝试locales通过以下方式安装时处理了依赖性问题安装通过使用资质而是提出解决方案,而不是简单地拒绝安装。

相关内容