如何让 16.04 中的软件更新正常运行?升级到 18.04 失败后,软件更新就失效了

如何让 16.04 中的软件更新正常运行?升级到 18.04 失败后,软件更新就失效了

我尝试从 16.04 升级到 18.04,但失败了,并显示“中止”和“恢复先前状态”消息。我跟踪了这​​里的几份类似报告,但没有成功,最后决定计划在 2022 年全新安装新版本。但现在,当我尝试更新软件时,我的 16.04 系统失败了。在此之前没有这样的问题。

如何恢复之前的状态?

此时,“sudo apt-get update”会出现以下信息:

Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease                                                                   
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease                                                                        
Get:4 http://packages.microsoft.com/repos/vscode stable InRelease [3,181 B]                                                         
Hit:5 http://ppa.launchpad.net/flacon/ppa/ubuntu xenial InRelease                                                                   
Hit:6 http://dl.google.com/linux/chrome/deb stable Release                                                                          
Hit:7 https://download.sublimetext.com apt/stable/ InRelease                                                                        
Hit:8 http://us.archive.ubuntu.com/ubuntu xenial InRelease                                                         
Hit:9 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease                                                 
Hit:10 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease   
Hit:11 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu xenial InRelease
Hit:12 https://repo.skype.com/deb stable InRelease                            
Hit:13 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease      
Get:14 http://packages.microsoft.com/repos/vscode stable/main amd64 Packages [93.1 kB]
Get:15 https://deb.nodesource.com/node_8.x xenial InRelease [4,646 B]
Fetched 101 kB in 1s (58.4 kB/s)                     
Reading package lists... Done
W: Target Packages (partner/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Packages (partner/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Packages (partner/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target DEP-11 (partner/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target DEP-11-icons (partner/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Packages (partner/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Packages (partner/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Packages (partner/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target DEP-11 (partner/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target DEP-11-icons (partner/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:39 and /etc/apt/sources.list.d/xenial-partner.list:4

并且,“sudo apt-get upgrade”失败,如下所示:

~> sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libarchive13 openssh-client ssh-askpass-gnome
3 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
1 not fully installed or removed.
Need to get 0 B/866 kB of archives.
After this operation, 8,192 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up libc-bin (2.23-0ubuntu10) ...
Bus error (core dumped)
/sbin/ldconfig.real: Can't stat /lib/i686-linux-gnu: No such file or directory
/sbin/ldconfig.real: Can't stat /usr/lib/i686-linux-gnu: No such file or directory
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/usr/lib/x86_64-linux-gnu/libfakeroot:
    libfakeroot-0.so -> libfakeroot-tcp.so
/lib/i386-linux-gnu:
Bus error (core dumped)
dpkg: error processing package libc-bin (--configure):
subprocess installed post-installation script returned error exit status 135
Errors were encountered while processing:
 libc-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)

请求的当前合作伙伴列表文件:

$ cat xenial-partner.list
# channel for the xenial (16.04) partner channel
#:description:This channel contains the partner software for xenial
deb archive.canonical.com/ubuntu xenial partner

由于权限问题,系统无法下载 libc:

OptiPlex-755:~$ sudo apt-get download libc-bin 
Get:1 us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libc-bin amd64 2.23-0ubuntu10 [641 kB] 
Fetched 641 kB in 0s (1,643 kB/s) 
W: Can't drop privileges for downloading as file '/home/rich/libc-bin_2.23-0ubuntu10_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) 
OptiPlex-755:~$ 

答案1

我看到了以下几个时刻:

  1. 您收到有关重复条目的警告消息 - 通过删除合作伙伴的存储库文件并再次更新 APT 来删除它们:

    sudo rm /etc/apt/sources.list.d/xenial-partner.list
    sudo apt-get update
    
  2. 你的 libc 某个地方损坏了,我们需要在升级之前修复它

    apt-get download libc-bin
    sudo dpkg -x libc-bin*.deb /
    sudo apt-get install --reinstall ./libc-bin*.deb
    
  3. 将当前版本的所有软件包升级至最新版本

    sudo apt dist-upgrade
    
  4. 将系统升级到 18.04 LTS

    sudo do-release-upgrade
    

相关内容