当我尝试将 Ubuntu 16.04 升级到 18.04 时出现“无法获取...哈希总和不匹配”错误

当我尝试将 Ubuntu 16.04 升级到 18.04 时出现“无法获取...哈希总和不匹配”错误

如何将 Ubuntu 16.04 升级到 18.04?

Failed to fetch 
http://bd.archive.ubuntu.com/ubuntu/pool/main/l/llvm-toolchain-6.0/libllvm6.0_6.0-1ubuntu2_amd64.deb 
Hash Sum mismatch 

Failed to fetch 
http://bd.archive.ubuntu.com/ubuntu/pool/main/u/ubuntu-wallpapers/ubuntu-wallpapers-bionic_18.04.1-0ubuntu1_all.deb 
Hash Sum mismatch 

Failed to fetch 
http://bd.archive.ubuntu.com/ubuntu/pool/universe/f/fonts-takao/fonts-takao-pgothic_00303.01-2ubuntu1_all.deb 
Hash Sum mismatch 

答案1

升级 Ubuntu,请按照以下步骤操作

步骤 1:更新 UBUNTU 16.04 服务器

在升级到 Ubuntu 18.04 之前,您应该先更新当前的 16.04。建议在升级之前更新/升级所有已安装的软件包。要更新 Ubuntu,请连接到服务器并运行以下命令:

sudo apt update && sudo apt dist-upgrade && sudo apt autoremove

步骤 2:安装 UBUNTU 更新管理器

更新 Ubuntu 16.04 服务器后,如果尚未安装,请运行以下命令来安装 update-manager-core。

sudo apt-get install update-manager-core

然后打开 update-manager 配置文件,并确保提示行设置为 lts

sudo nano /etc/update-manager/release-upgrades

确认提示符等于 lts

# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting behavior, valid options:
#
#  never  - Never check for a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the release that immediately succeeds the currently-running
#           release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that this option should not be
#           used if the currently-running release is not itself an LTS
#           release, since in that case the upgrader won't be able to
#           determine if a newer release is available.
Prompt=lts

如果不是,请将其更改为 lts 并保存文件。

步骤 3:执行 UBUNTU 18.04 LTS 升级

现在您的系统已准备就绪,请运行以下命令开始将 Ubuntu 升级到最新开发版本。

sudo do-release-upgrade -d

按照屏幕上的说明进行操作... y = 是且 N = 否。当系统提示您是否希望升级时,请输入 y 以表示是。

Do you want to start the upgrade?

1 installed package is no longer supported by Canonical. You can
still get support from the community.

2 packages are going to be removed. 64 new packages are going to be
installed. 394 packages are going to be upgraded.

You have to download a total of 234 M. This download will take about
1 minute with your connection.

Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.

 Continue [yN]  Details [d] y

等待所有较新的软件包下载…这可能需要一段时间,具体取决于您的互联网连接速度。下载完所有软件包后,您的系统将立即开始升级……

新软件包安装完成后,系统会询问您是否要删除过时的软件包。在此处输入 y。如果您有自定义的系统,您可能希望输入 d 来查看列表……以防万一您需要重新安装。

Remove obsolete packages?

53 packages are going to be removed.

 Continue [yN]  Details [d]y

等待该过程完成,重启完成..您将收到重启通知。

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN] y

当一切设置正确后,您的系统应该升级到最新的 Ubuntu 版本。

欢迎使用 Ubuntu 18.04 LTS(GNU/Linux 4.15.0-19-generic x86_64)

链接 -->将 UBUNTU 16.04 LTS 升级至 UBUNTU 18.04 LTS 服务器

答案2

我已从 16.04 安全地升级到 18.04,以下是我所做的:

编辑 repo 文件:

sudo nano /etc/apt/sources.list

将代号替换为您要升级到的实际代号:

如果你使用 nano^\作为快捷方式,因为我是从 16.04 开始的,所以我将单词替换xenialbionic

保存文件。

然后让 Ubuntu 知道这个变化:

sudo apt update

然后进行升级:

sudo apt dist-upgrade

然后,如果您愿意,您可以只让 3 个内核版本通过:

sudo apt autoremove

答案3

什么都没用。在尝试了建议的解决方案后,我最终手动下载了软件包,将它们复制到 /var/cache/apt/archives 中,并从 /var/cache/apt/archives/partial 中删除了损坏的软件包。

相关内容