Linux apt-get update Error: Error in `appstreamcli‘: double free or corruption … Aborted (core dumped)

Reason:
the built-in libappstream of Ubuntu 16.0.4 is a version before 2.0. We must update it to a version above 3.0

Solution:

Clear libappstream3 (purge cleans more configuration files than remove)

sudo apt-get purge libappstream3

Operation results:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gnome-software-common libgtkspell3-3-0
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  appstream* gnome-software* libappstream3* ubuntu-software*
0 upgraded, 0 newly installed, 4 to remove and 281 not upgraded.
After this operation, 1,759 kB disk space will be freed.
Do you want to continue?[Y/n] y
(Reading database ... 214637 files and directories currently installed.)
Removing ubuntu-software (3.20.1+git20160420.1.ca63436.ubuntu-xenial-0ubuntu2) ...
Removing gnome-software (3.20.1+git20160420.1.ca63436.ubuntu-xenial-0ubuntu2) ...
Purging configuration files for gnome-software (3.20.1+git20160420.1.ca63436.ubuntu-xenial-0ubuntu2) ...
Removing appstream (0.9.4-1) ...
Purging configuration files for appstream (0.9.4-1) ...
rmdir: failed to remove '/var/cache/app-info/': Directory not empty
Removing libappstream3:amd64 (0.9.4-1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for libglib2.0-0:amd64 (2.48.2-0ubuntu4.8) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160415-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu11.3) ...
yg@ubuntu:~$ 

Continue:

sudo apt autoremove

result:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  gnome-software-common libgtkspell3-3-0
0 upgraded, 0 newly installed, 2 to remove and 280 not upgraded.
After this operation, 2,744 kB disk space will be freed.
Do you want to continue?[Y/n] y
(Reading database ... 214577 files and directories currently installed.)
Removing gnome-software-common (3.20.1+git20160420.1.ca63436.ubuntu-xenial-0ubuntu2) ...
Removing libgtkspell3-3-0:amd64 (3.0.7-2) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu11.3) ...

Execution:

sudo apt-get update

result:

yg@ubuntu:~$ sudo apt-get update
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://mirrors.aliyun.com/ubuntu xenial InRelease
Hit:3 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease                  
Hit:4 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease                
Hit:5 http://mirrors.aliyun.com/ubuntu xenial-security InRelease                 
Reading package lists... Done                     
W: Target Sources (restricted/source/Sources) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:4
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Translations (restricted/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Translations (restricted/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Translations (restricted/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Translations (multiverse/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
W: Target Translations (restricted/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
W: Target Sources (restricted/source/Sources) is configured multiple times in /etc/apt/sources.list:2 and /etc/apt/sources.list:4
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Translations (restricted/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:3 and /etc/apt/sources.list:24
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Translations (restricted/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:5 and /etc/apt/sources.list:29
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Translations (restricted/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (multiverse/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Translations (multiverse/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:53
W: Target Packages (restricted/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
W: Target Packages (restricted/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
W: Target Packages (restricted/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
W: Target Translations (restricted/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
W: Target Translations (restricted/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:15 and /etc/apt/sources.list:63
yg@ubuntu:~$ 

No more mistakes

Read More: