Ubuntu – How to get software updates working in 16.04? It broke after a failed upgrade to 18.04

aptpackage-managementupgrade

I tried to upgrade from 16.04 to 18.04, but if failed with the message "Aborting" and "restoring previous state". I followed up on several similar reports here, without success, and finally decided to plan a clean install of a newer release in the year 2022. But now my 16.04 system fails when I try to update software.It had no such problem before that.

How to get back to previous state?

At this time, "sudo apt-get update" gives these messages:

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

And, "sudo apt-get upgrade" fails as follows:

~> 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)

Requested current partners list file:

$ 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

The system cannot download libc, due to a permissions issue:

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:~$ 

Best Answer

I see the following moments:

  1. You have warning messages about duplicate entries - remove them by removing the partners' repository file and updating APT again:

    sudo rm /etc/apt/sources.list.d/xenial-partner.list
    sudo apt-get update
    
  2. Your libc is somewhere broken, we need to fix it before upgrade

    apt-get download libc-bin
    sudo dpkg -x libc-bin*.deb /
    sudo apt-get install --reinstall ./libc-bin*.deb
    
  3. Upgrade all packages of current release to latest versions

    sudo apt dist-upgrade
    
  4. Upgrade the system to 18.04 LTS

    sudo do-release-upgrade