Ubuntu 16.04 上的 ESM 401 未经授权错误

Mar*_*ane 7 upgrade do-release-upgrade 16.04 esm

我想将我的 Ubuntu 16.04 服务器升级到 Ubuntu 18.04,我正在运行以下命令来执行此操作;

apt update -y
apt upgrade -y
do-release-upgrade
Run Code Online (Sandbox Code Playgroud)

apt update命令运行良好,输出如下;

# apt update -y
Hit:1 https://esm.ubuntu.com/infra/ubuntu bionic-infra-security InRelease
Hit:2 https://esm.ubuntu.com/infra/ubuntu bionic-infra-updates InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.
Run Code Online (Sandbox Code Playgroud)

但是,运行该apt upgrade命令时,它会返回以下错误;

# apt upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done

*The following packages could receive security updates with UA Infra: ESM service enabled:
  libkrb5-3 libgssapi-krb5-2 libk5crypto3 libkrb5support0 libzstd1
Learn more about UA Infra: ESM service for Ubuntu 16.04 at https://ubuntu.com/16-04

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

The following packages have been kept back:
  libk5crypto3 libkrb5support0
The following packages will be upgraded:
  libzstd1
1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
1 esm-infra security update
Need to get 189 kB of archives.
After this operation, 132 kB of additional disk space will be used.
Err:1 https://esm.ubuntu.com/infra/ubuntu bionic-infra-security/main amd64 libzstd1 amd64 1.3.3+dfsg-2ubuntu1+esm1
  401  Unauthorized
E: Failed to fetch https://esm.ubuntu.com/infra/ubuntu/pool/main/libz/libzstd/libzstd1_1.3.3+dfsg-2ubuntu1+esm1_amd64.deb  401  Unauthorized

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Run Code Online (Sandbox Code Playgroud)

我不知道此时该怎么办。我该如何解决这个问题?

N0r*_*ert 11

根据当前运行的 Ubuntu 版本,存在两种方法。

(a) Ubuntu 16.04 LTS 作为当前运行的版本

你必须备份你sources.list

sudo mv /etc/apt/sources.list ~/
sudo mv /etc/apt/sources.list.d/*.list ~/
Run Code Online (Sandbox Code Playgroud)

然后sources.list使用以下命令之一用正确的 URL 填充 main:

  • 简单sources.list替换

    cat <<EOF | sudo tee /etc/apt/sources.list
    deb http://archive.ubuntu.com/ubuntu/ xenial-backports main universe multiverse restricted
    deb http://archive.ubuntu.com/ubuntu/ xenial main universe multiverse restricted
    deb http://archive.ubuntu.com/ubuntu/ xenial-updates main universe multiverse restricted
    deb http://security.ubuntu.com/ubuntu/ xenial-security main universe multiverse restricted
    EOF
    
    Run Code Online (Sandbox Code Playgroud)
  • 使用add-apt-repository

    sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ xenial-backports main universe multiverse restricted"
    sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ xenial main universe multiverse restricted"
    sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ xenial-updates main universe multiverse restricted"
    sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu/ xenial-security main universe multiverse restricted"
    
    Run Code Online (Sandbox Code Playgroud)

然后恢复升级到 18.04 LTS:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get purge ubuntu-advantage-tools --autoremove
sudo rm /etc/apt/sources.list.d/ubuntu-esm-infra.list
sudo do-release-upgrade
Run Code Online (Sandbox Code Playgroud)

然后检查~/*.list以前版本的文件并将部分行移动到/etc/apt/sources.list.

(b) Ubuntu 18.04 LTS 作为当前运行的版本

你必须备份你sources.list

sudo mv /etc/apt/sources.list ~/
sudo mv /etc/apt/sources.list.d/*.list ~/
Run Code Online (Sandbox Code Playgroud)

然后sources.list使用以下命令之一用正确的 URL 填充 main:

  • 简单sources.list替换

    cat <<EOF | sudo tee /etc/apt/sources.list
    deb http://archive.ubuntu.com/ubuntu/ bionic-backports main universe multiverse restricted
    deb http://archive.ubuntu.com/ubuntu/ bionic main universe multiverse restricted
    deb http://archive.ubuntu.com/ubuntu/ bionic-updates main universe multiverse restricted
    deb http://security.ubuntu.com/ubuntu/ bionic-security main universe multiverse restricted
    EOF
    
    Run Code Online (Sandbox Code Playgroud)
  • 使用add-apt-repository

    sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ bionic-backports main universe multiverse restricted"
    sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ bionic main universe multiverse restricted"
    sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ bionic-updates main universe multiverse restricted"
    sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu/ bionic-security main universe multiverse restricted"
    
    Run Code Online (Sandbox Code Playgroud)

然后通过以下方式安装所有必要的升级:

sudo apt-get purge ubuntu-advantage-tools --autoremove
sudo rm /etc/apt/sources.list.d/ubuntu-esm-infra.list

sudo apt-get update
sudo apt-get upgrade
Run Code Online (Sandbox Code Playgroud)

然后检查~/*.list以前版本中的文件,并将部分行移动到,同时用bionic/etc/apt/sources.list替换xenial

  • 谢谢您的回答。非常详细。就我而言,仅运行命令“sudo apt-get purge ubuntu-advantage-tools --autoremove”就解决了我的问题。我不需要做其他的改变。 (3认同)