错误地从 ubuntu 18.04.6LTS 升级到 21

错误地从 ubuntu 18.04.6LTS 升级到 21

我尝试将系统从 ubuntu 18.04.6LTS (bionic) 升级到 20.04 LTS (focal)。但我运行了一些与升级到 Ubuntu 21.04 相关的命令,这些命令与我的目标完全无关。我运行的命令如下:

sudo sed -i 's/bionic/**hirsute**/g' /etc/apt/sources.list
sudo sed -i 's/bionic/**hirsute**/g' /etc/apt/sources.list.d/*.list
sudo apt update

似乎有些软件包已升级到“21”。我该如何修复这个问题?我的目标是发布一个 LTS 版本。

通过运行dpkg -l > /tmp/somefile输出/tmp/somefile如下,我粘贴了其中的一部分。它不允许我粘贴所有内容。

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                        Version                                             Architecture Description
+++-===========================================================-===================================================-============-===============================================================================
ii  a11y-profile-manager-indicator                              0.1.11-0ubuntu4                                     amd64        Accessibility Profile Manager - Unity desktop indicator
ii  account-plugin-facebook                                     0.12+16.04.20160126-0ubuntu1                        all          GNOME Control Center account plugin for single signon - facebook
ii  account-plugin-flickr                                       0.12+16.04.20160126-0ubuntu1                        all          GNOME Control Center account plugin for single signon - flickr
ii  account-plugin-google                                       0.12+16.04.20160126-0ubuntu1                        all          GNOME Control Center account plugin for single signon
ii  accountsservice                                             0.6.45-1ubuntu1.3                                   amd64        query and manipulate user account information
ii  acl                                                         2.2.52-3build1                                      amd64        Access control list utilities
ii  acpi-support                                                0.142                                               amd64        scripts for handling many ACPI events
ii  acpid                                                       1:2.0.28-1ubuntu1                                   amd64        Advanced Configuration and Power Interface event daemon
ii  activity-log-manager                                        0.9.7-0ubuntu26                                     amd64        blacklist configuration user interface for Zeitgeist
ii  adduser                                                     3.118ubuntu5                                        all          add and remove users and groups
ii  adium-theme-ubuntu                                          0.3.4-0ubuntu4                                      all          Adium message style for Ubuntu
ii  adwaita-icon-theme                                          3.28.0-1ubuntu1                                     all          default icon theme of GNOME (small subset)
ii  aglfn                                                       1.7-3                                               all          Adobe Glyph List For New Fonts
ii  aisleriot                                                   1:3.22.5-1                                          amd64        GNOME solitaire card game collection
ii  alsa-base                                                   1.0.25+dfsg-0ubuntu5                                all          ALSA driver configuration files
ii  alsa-utils                                                  1.1.3-1ubuntu1                                      amd64        Utilities for configuring and using ALSA
ii  amd64-microcode                                             3.20191021.1+really3.20181128.1~ubuntu0.18.04.1     amd64        Processor microcode firmware for AMD CPUs
ii  anacron                                                     2.3-24                                              amd64        cron-like program that doesn't go by time
ii  apache2-bin                                                 2.4.29-1ubuntu4.19                                  amd64        Apache HTTP Server (modules and other binary files)
ii  apg                                                         2.2.3.dfsg.1-5                                      amd64        Automated Password Generator - Standalone version
ii  app-install-data                                            15.10                                               all          Ubuntu applications (data files)
ii  app-install-data-partner                                    16.04                                               all          Application Installer (data files for partner applications/repositories)
ii  apparmor                                                    2.12-4ubuntu5.1                                     amd64        user-space parser utility for AppArmor
ii  appmenu-qt:amd64                                            0.2.7+14.04.20140305-0ubuntu2                       amd64        application menu for Qt
rc  appmenu-qt5                                                 0.3.0+16.04.20170216-0ubuntu1                       amd64        application menu for Qt5
ii  apport                                                      2.20.9-0ubuntu7.27                                  all          automatically generate crash reports for debugging
ii  apport-gtk                                                  2.20.9-0ubuntu7.27                                  all          GTK+ frontend for the apport crash report system
ii  apport-symptoms                                             0.20                                                all          symptom scripts for apport
ii  appstream                                                   0.12.0-3ubuntu1                                     amd64        Software component metadata management
ii  apt                                                         1.6.14                                              amd64        commandline package manager
ii  apt-config-icons                                            0.12.0-3ubuntu1                                     all          APT configuration snippet to enable icon downloads
rc  apt-show-versions                                           0.22.7ubuntu1                                       all          lists available package versions with distribution
ii  apt-transport-https                                         1.6.14                                              all          transitional package for https support
ii  apt-utils                                                   1.6.14                                              amd64        package management related utility programs
ii  aptdaemon                                                   1.1.1+bzr982-0ubuntu19.5                            all          transaction based package management service
ii  aptdaemon-data                                              1.1.1+bzr982-0ubuntu19.5                            all          data files for clients
ii  aptitude                                                    0.8.10-6ubuntu1                                     amd64        terminal-based package manager
ii  aptitude-common                                             0.8.10-6ubuntu1                                     all          architecture independent files for the aptitude package manager
ii  apturl                                                      0.5.2ubuntu14.2                                     amd64        install packages using the apt protocol - GTK+ frontend
ii  apturl-common                                               0.5.2ubuntu14.2                                     amd64        install packages using the apt protocol - common data
ii  aspell                                                      0.60.7~20110707-4ubuntu0.2                          amd64        GNU Aspell spell-checker
ii  aspell-en                                                   2017.08.24-0-0.1                                    all          English dictionary for GNU Aspell
ii  at-spi2-core                                                2.28.0-1                                            amd64        Assistive Technology Service Provider Interface (dbus core)
ii  atril                                                       1.20.1-2ubuntu2                                     amd64        MATE document viewer
ii  atril-common                                                1.20.1-2ubuntu2                                     all          MATE document viewer (common files)
ii  autoconf                                                    2.69-11                                             all          automatic configure script builder
ii  automake                                                    1:1.15.1-3ubuntu2                                   all          Tool for generating GNU Standards-compliant Makefiles
ii  autotools-dev                                               20180224.1                                          all          Update infrastructure for config.{guess,sub} files
ii  avahi-autoipd                                               0.7-3.1ubuntu1.3                                    amd64        Avahi IPv4LL network address configuration daemon
ii  avahi-daemon                                                0.7-3.1ubuntu1.3                                    amd64        Avahi mDNS/DNS-SD daemon
ii  avahi-utils                                                 0.7-3.1ubuntu1.3                                    amd64        Avahi browsing, publishing and discovery utilities
ii  bamfdaemon                                                  0.5.3+18.04.20180207.2-0ubuntu1                     amd64        Window matching library - daemon
ii  baobab                                                      3.28.0-1                                            amd64        GNOME disk usage analyzer
ii  base-files                                                  10.1ubuntu2.11                                      amd64        Debian base system miscellaneous files
ii  base-passwd                                                 3.5.44                                              amd64        Debian base system master password and group files
ii  bash                                                        4.4.18-2ubuntu1.2                                   amd64        GNU Bourne Again SHell
ii  bash-completion                                             1:2.8-1ubuntu1                                      all          programmable completion for the bash shell
ii  bc                                                          1.07.1-2                                            amd64        GNU bc arbitrary precision calculator language
ii  bind9-host                                                  1:9.11.3+dfsg-1ubuntu1.16                           amd64        DNS lookup utility (deprecated)
ii  binutils                                                    2.36.1-6ubuntu1                                     amd64        GNU assembler, linker and binary utilities
ii  binutils-common:amd64                                       2.36.1-6ubuntu1                                     amd64        Common files for the GNU assembler, linker and binary utilities
ii  binutils-x86-64-linux-gnu                                   2.36.1-6ubuntu1                                     amd64        GNU binary utilities, for x86-64-linux-gnu target
ii  blt                                                         2.5.3+dfsg-4                                        amd64        graphics extension library for Tcl/Tk - run-time
ii  bluez                                                       5.48-0ubuntu3.6                                     amd64        Bluetooth tools and daemons
ii  bluez-cups                                                  5.48-0ubuntu3.6                                     amd64        Bluetooth printer driver for CUPS
ii  bluez-obexd                                                 5.48-0ubuntu3.6                                     amd64        bluez obex daemon
ii  bolt                                                        0.5-0ubuntu0.18.04.1                                amd64        system daemon to manage thunderbolt 3 devices
ii  branding-ubuntu                                             0.10                                                all          Replacement artwork with Ubuntu branding
ii  brltty                                                      5.5-4ubuntu2.0.1                                    amd64        Access software for a blind person using a braille display
ii  bsdmainutils                                                11.1.2ubuntu1                                       amd64        collection of more utilities from FreeBSD
ii  bsdutils                                                    1:2.31.1-0.4ubuntu3.7                               amd64        basic utilities from 4.4BSD-Lite
ii  bubblewrap                                                  0.2.1-1ubuntu0.1                                    amd64        setuid wrapper for unprivileged chroot and namespace manipulation
ii  build-essential                                             12.4ubuntu1                                         amd64        Informational list of build-essential packages
ii  busybox-initramfs                                           1:1.30.1-6ubuntu2                                   amd64        Standalone shell setup for initramfs
ii  busybox-static                                              1:1.27.2-2ubuntu3.3                                 amd64        Standalone rescue shell with tons of builtin utilities
ii  bzip2                                                       1.0.8-4ubuntu3                                      amd64        high-quality block-sorting file compressor - utilities
ii  bzip2-doc                                                   1.0.6-8.1ubuntu0.2                                  all          high-quality block-sorting file compressor - documentation
ii  ca-certificates                                             20210119ubuntu0.21.04.1                             all          Common CA certificates
ii  ca-certificates-java                                        20180516ubuntu1~18.04.1                             all          Common CA certificates (JKS keystore)
ii  caja                                                        1.20.2-4ubuntu1                                     amd64        file manager for the MATE desktop
ii  caja-common                                                 1.20.2-4ubuntu1                                     all          file manager for the MATE desktop (common files)
ii  checkinstall                                                1.6.2-4ubuntu2                                      amd64        installation tracker
ii  cheese                                                      3.28.0-1ubuntu1                                     amd64        tool to take pictures and videos from your webcam
ii  cheese-common                                               3.28.0-1ubuntu1                                     all          Common files for the Cheese tool to take pictures and videos
ii  cmake                                                       3.10.2-1ubuntu2.18.04.2                             amd64        cross-platform, open-source make system
ii  cmake-data                                                  3.10.2-1ubuntu2.18.04.2                             all          CMake data files (modules, templates and documentation)
ii  cockpit                                                     215-1~ubuntu18.04.1                                 all          Web Console for Linux servers
ii  cockpit-bridge                                              215-1~ubuntu18.04.1                                 amd64        Cockpit bridge server-side component
ii  cockpit-dashboard                                           215-1~ubuntu18.04.1                                 all          Cockpit remote servers and dashboard
ii  cockpit-networkmanager                                      215-1~ubuntu18.04.1                                 all          Cockpit user interface for networking
ii  cockpit-packagekit                                          215-1~ubuntu18.04.1                                 all          Cockpit user interface for packages
ii  cockpit-storaged                                            215-1~ubuntu18.04.1                                 all          Cockpit user interface for storage
ii  cockpit-system                                              215-1~ubuntu18.04.1                                 all          Cockpit admin interface for a system
ii  cockpit-ws                                                  215-1~ubuntu18.04.1                                 amd64        Cockpit Web Service
ii  colord                                                      1.3.3-2build1                                       amd64        system service to manage device colour profiles -- system daemon
ii  colord-data                                                 1.3.3-2build1                                       all          system service to manage device colour profiles -- data files
ii  command-not-found                                           18.04.5                                             all          Suggest installation of packages in interactive bash sessions
ii  command-not-found-data                                      18.04.5                                             amd64        Set of data files for command-not-found.
ii  compiz                                                      1:0.9.13.1+18.04.20180302-0ubuntu1                  all          OpenGL window and compositing manager
ii  compiz-core                                                 1:0.9.13.1+18.04.20180302-0ubuntu1                  amd64        OpenGL window and compositing manager
ii  compiz-gnome                                                1:0.9.13.1+18.04.20180302-0ubuntu1                  amd64        OpenGL window and compositing manager - GNOME window decorator
ii  compiz-plugins-default:amd64                                1:0.9.13.1+18.04.20180302-0ubuntu1                  amd64        OpenGL window and compositing manager - default plugins
ii  console-setup                                               1.201ubuntu2                                        all          console font and keymap setup program
ii  console-setup-linux                                         1.201ubuntu2                                        all          Linux specific part of console-setup
ii  coreutils                                                   8.28-1ubuntu1                                       amd64        GNU core utilities
ii  cpio                                                        2.12+dfsg-6ubuntu0.18.04.4                          amd64        GNU cpio -- a program to manage archives of files
ii  cpp                                                         4:7.4.0-1ubuntu2.3                                  amd64        GNU C preprocessor (cpp)
ii  cpp-4.8                                                     4.8.5-4ubuntu8                                      amd64        GNU C preprocessor
ii  cpp-4.9                                                     4.9.4-2ubuntu1~16.04                                amd64        GNU C preprocessor
ii  cpp-5                                                       5.5.0-12ubuntu1                                     amd64        GNU C preprocessor
ii  cpp-6                                                       6.5.0-2ubuntu1~18.04                                amd64        GNU C preprocessor
ii  cpp-7                                                       7.5.0-6ubuntu4                                      amd64        GNU C preprocessor
ii  cpufrequtils                                                008-1build1                                         amd64        utilities to deal with the cpufreq Linux kernel feature
ii  cracklib-runtime                                            2.9.2-5build1                                       amd64        runtime support for password checker library cracklib2
ii  crda                                                        3.18-1build1                                        amd64        wireless Central Regulatory Domain Agent
ii  cron                                                        3.0pl1-128.1ubuntu1                                 amd64        process scheduling daemon
rc  cuda-command-line-tools-9-0                                 9.0.176-1                                           amd64        CUDA command-line tools
rc  cuda-core-9-0                                               9.0.176-1                                           amd64        CUDA core tools

部分输出apt list --installed | awk '{print $1}' | egrep -v bionic

a11y-profile-manager-indicator/hirsute,now
account-plugin-facebook/now
account-plugin-flickr/now
account-plugin-google/now
accountsservice/now
acl/now
acpi-support/now
acpid/now
activity-log-manager/now
adduser/hirsute,hirsute,now
adium-theme-ubuntu/hirsute,hirsute,now
adwaita-icon-theme/now
aglfn/now
aisleriot/now
alsa-base/now
alsa-utils/now
amd64-microcode/now
anacron/now
apache2-bin/now

答案1

这个问题由我来问,在这里,你会发现你做错了什么

供参考: 更新错误是因为 bionic beaver 的一些存储库已从 hirsute 中删除,删除这些存储库并运行 apt upgrade 即可

供参考请不要做这些事情,您不能不应该从 LTS 版本升级到非 LTS 版本(您正在将 18.04 升级到 21.04!!)

首先,在继续之前禁用所有 PPA(sudo mv /etc/apt/sources.list.d/* $HOME

正如你在问题中提到的,你想要一个 LTS 版本

目前,20.04 是最新 LTS 版本,但您已将一些软件包更改为 hirsute。因此,您不能升级到 20.04(因为一些软件包将被降级,而降级是不安全的,可能会破坏系统或使一些软件包无法使用)

让我们升级到 hirsute(非 LTS 版本)

首先,将 * 的内容更改sources.list

deb http://archive.ubuntu.com/ubuntu/ hirsute main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hirsute main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ hirsute-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hirsute-updates main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ hirsute-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hirsute-security main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ hirsute-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

deb http://archive.canonical.com/ubuntu hirsute partner
deb-src http://archive.canonical.com/ubuntu hirsute partner

在那次跑步之后sudo apt update

我不这么认为它会说任何错误

运行此操作后

sudo snap refresh 
sudo mv /etc/apt/sources.list.d/* $HOME
sudo apt dist-upgrade && sudo apt full-upgrade 

您已完成!它将起作用


*-sources.list中可用/etc/apt/,完整路径为/etc/apt/sources.listman sources.list也会有所帮助。

答案2

好的,我们可以尝试一些东西。

首先备份您的个人数据!然后为 focal 绘制一个 iso 并制作一个可启动的 usb-stick/dvd。我们首先尝试将软件包恢复为 bionic 版本。删除 /etc/apt/sources.list.d/ 中的任何 ppa 文件,制作一个干净的 /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.canonical.com/ubuntu bionic partner  

现在到了棘手的部分。

创造/etc/apt/preferences.d/bionic.pref

Package: *
Pin: release v=18.04, a=bionic-security
Pin-Priority:1001

Package: *
Pin: release v=18.04,a=bionic-updates
Pin-Priority: 1001

Package: *
Pin: release v=18.04,o=Ubuntu,a=bionic
Pin-Priority: 1001

Package: *
Pin: release v=18.04,o=Canonical,a=bionic,n=bionic,c=partner 
Pin-Priority: 1001
   

现在运行

sudo apt update && apt -s upgrade

最后只是一个模拟。没有错误

sudo apt upgrade && sudo apt full-upgrade

它有可能起作用,但也可能不起作用。

检查/etc/update-manager/release-upgrades 一下

Prompt=lts

已设置!!

sudo apt install apt-show-versions

现在我们删除不再可用的包。首先概述一下这些包是什么。

apt-show-versions | egrep avail  | awk '{print $1}'
apt -s remove $(apt-show-versions | egrep avail  | awk '{print $1}')

这也是一个模拟。这将移除它们

apt purge $(apt-show-versions | egrep avail  | awk '{print $1}')

移除/etc/apt/preferences.d/bionic.pref 然后查看

do-release-upgrade

工作中。

我交叉手指。

相关内容