Ubuntu 16.04 至 18.04 升级失败

Ubuntu 16.04 至 18.04 升级失败

我正在尝试从 16.04 升级到 18.04。输出结果sudo do-release-upgrade如下:

 ubuntu-desktop
Exception during pm.DoInstall():  E:Sub-process /usr/bin/dpkg returned an error code (1)

Could not install the upgrades 

The upgrade has aborted. Your system could be in an unusable state. A 
recovery will run now (dpkg --configure -a). 

dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on gdm3; however:
  Package gdm3 is not installed.
 ubuntu-desktop depends on gnome-shell; however:
  Package gnome-shell is not installed.
 ubuntu-desktop depends on software-properties-gtk; however:
  Package software-properties-gtk is not installed.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of software-properties-common:
 gnupg (2.2.4-1ubuntu1) breaks software-properties-common (<= 0.96.24.3) and is installed.
  Version of software-properties-common to be configured is 0.96.20.10.

dpkg: error processing package software-properties-common (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 ubuntu-desktop
 software-properties-common

Upgrade complete 

The upgrade has completed but there were errors during the upgrade 
process. 

To continue please press [ENTER]

的输出为sudo apt update

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://archive.ubuntu.com/ubuntu bionic/main DEP-11 48x48 Icons [118 kB]
Fetched 118 kB in 2s (49.3 kB/s)      
Reading package lists... Done
E: No priority (or zero) specified for pin

sudo dpkg --configure -a给出:

dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on gdm3; however:
  Package gdm3 is not installed.
 ubuntu-desktop depends on gnome-shell; however:
  Package gnome-shell is not installed.
 ubuntu-desktop depends on software-properties-gtk; however:
  Package software-properties-gtk is not installed.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of software-properties-common:
 gnupg (2.2.4-1ubuntu1) breaks software-properties-common (<= 0.96.24.3) and is installed.
  Version of software-properties-common to be configured is 0.96.20.10.

dpkg: error processing package software-properties-common (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 ubuntu-desktop
 software-properties-common

最后,输出apt-cache policy

Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://archive.ubuntu.com/ubuntu bionic/main i386 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=main,b=i386
     origin archive.ubuntu.com
 500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=main,b=amd64
     origin archive.ubuntu.com
Pinned packages:
E: No priority (or zero) specified for pin

我还没有重启电脑。如何确保一切(或至少是包管理)正常运行?

答案1

要删除“ E: No priority (or zero) specified for pin”消息,您必须通过以下方式删除 Ubuntu Advantage (UA) ESM 文件:

sudo rm /etc/apt/preferences.d/ubuntu-esm-infra
sudo rm /etc/apt/sources.list.d/ubuntu-esm-infra.list

因为 Ubuntu 18.04 LTS 是受支持的版本,所以这里实际上不需要 UA ESM。

然后检查 中的行是否正确/etc/apt/sources.list。将行更改为包含以下内容:

deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse

sudo apt-get update然后再次运行:

sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get upgrade # rerun upgrade
sudo apt-get dist-upgrade # install newest dependencies

最后删除 UA

sudo apt-get purge ubuntu-advantage-tools --autoremove

相关内容