﷽
I had the following error when running apt update command on my Linux machine based on Ubuntu Bionic Beaver 18.04.6.
root@sikupa :~# apt update
Hit:1 http://my.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://my.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://my.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
(appstreamcli:9895): GLib-CRITICAL **: 08:08:35.802: g_variant_builder_end: assertion '!GVSB(builder)->uniform_item_types || GVSB(builder)->prev_item_type != NULL || g_variant_type_is_definite (GVSB(builder)->type)' failed
(appstreamcli:9895): GLib-CRITICAL **: 08:08:35.802: g_variant_new_variant: assertion 'value != NULL' failed
(appstreamcli:9895): GLib-ERROR **: 08:08:35.802: g_variant_new_parsed: 11-13:invalid GVariant format string
Trace/breakpoint trap (core dumped)
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi'
E: Sub-process returned an error code
And the following step solve the case :
root@sikupa :~# apt clean
root@sikupa :~# apt-get install --reinstall libappstream4
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
libappstream4
1 upgraded, 0 newly installed, 0 to remove and 310 not upgraded.
1 not fully installed or removed.
Need to get 97.2 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://my.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libappstream4 amd64 0.12.0-3ubuntu1 [97.2 kB]
Fetched 97.2 kB in 0s (775 kB/s)
(Reading database ... 189359 files and directories currently installed.)
Preparing to unpack .../libappstream4_0.12.0-3ubuntu1_amd64.deb ...
Unpacking libappstream4:amd64 (0.12.0-3ubuntu1) over (0.12.0-3) ...
Setting up libappstream4:amd64 (0.12.0-3ubuntu1) ...
root@sikupa :~# apt update
Hit:1 http://my.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://my.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://my.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
310 packages can be upgraded. Run 'apt list --upgradable' to see them.
I hope this information is useful.
Barakallahu fiikum.