PureOS: apt update fails


#1

Good evening,

I am unable to update my pureos installation on my Librem 15v3. When I run the update command, it fails on the pureos repo,

> sudo apt update
https://repo.puri.sm/pureos green/main Translation-en [5,739 kB]         
https://repo.puri.sm/pureos green/main amd64 DEP-11 Metadata [2,511 kB] 
https://repo.puri.sm/pureos green/main DEP-11 64x64 Icons [7,328 kB]    
Fetched 22.1 MB in 20s (1,084 kB/s)                                            
(appstreamcli:60241): GLib-CRITICAL **: 23:23:22.417: 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:60241): GLib-CRITICAL **: 23:23:22.417: g_variant_new_variant: assertion 'value != NULL' failed
(appstreamcli:60241): GLib-ERROR **: 23:23:22.417: g_variant_new_parsed: 11-13:invalid GVariant format string
Trace/breakpoint trap
Reading package lists... Done

I found this thread which reported a similar problem, but the solution listed there does not work for me.

Searching online, I found a recent post that reports on a bug in the appstream package, which apparently is fixed in the latest debian unstable release appstream_0.12.2-2_amd64.deb.

However, I tried to manually install the latest appstream, but I am still getting the error.

Can someone point out how I can fix this?


Apt update fails
How to install a working browser?
Just got the Librem 13 can't update
#2

have you tried
sudo apt update && sudo apt full-upgrade && sudo apt dist-upgrade


#3

Hi, thanks for the suggestion.

I finally managed to fix my problem using this answer and the following steps,
> sudo apt purge libappstream4

sudo apt update now completes without an error.


#4

You could as well do sudo apt install --reinstall libappstream4


#5

I got a new Librem 13 today and am trying to install scdaemon to use the Librem Key. However both sudo apt update and sudo apt-get update fail with glib errors. I’ve seen previous forum posts about updates failing and don’t know if this is related. I’d be happy to post any additional information.

omsai@xm2:~$ sudo apt install scdaemon
[sudo] password for omsai:
Reading package lists... Done
Building dependency tree    
Reading state information... Done
The following NEW packages will be installed:
  scdaemon
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 564 kB of archives.
After this operation, 849 kB of additional disk space will be used.
Err:1 https://repo.puri.sm/pureos green/main amd64 scdaemon amd64 2.2.8-3
  404  Not Found [IP: 138.201.228.45 443]
E: Failed to fetch https://repo.puri.sm/pureos/pool/main/g/gnupg2/scdaemon_2.2.8-3_amd64.deb  404  Not Found [IP: 138.201.228.45 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
omsai@xm2:~$ sudo apt-get update
Get:1 https://repo.puri.sm/pureos green InRelease [10.5 kB]
Get:2 https://repo.puri.sm/pureos green/main amd64 Packages [6,702 kB]
Get:3 https://repo.puri.sm/pureos green/main Translation-en [5,867 kB]      
Get:4 https://repo.puri.sm/pureos green/main amd64 DEP-11 Metadata [2,528 kB]
Get:5 https://repo.puri.sm/pureos green/main DEP-11 64x64 Icons [7,358 kB]  
Fetched 22.5 MB in 21s (1,093 kB/s)                                        

(appstreamcli:3521): GLib-CRITICAL **: 12:45:03.615: 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:3521): GLib-CRITICAL **: 12:45:03.615: g_variant_new_variant: assertion 'value != NULL' failed

(appstreamcli:3521): GLib-ERROR **: 12:45:03.615: g_variant_new_parsed: 11-13:invalid GVariant format string
Trace/breakpoint trap
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
omsai@xm2:~$

#6

(edit: I see the accepted answer has now been updated to suggest using --reinstall, but I’m leaving this post unedited to document both approaches).

Using install --reinstall works for me and is a lot less scary than the accepted answer of using purge which would remove a lot of other important packages:

omsai@xm2:~$ sudo apt purge libappstream4
Reading package lists... Done
Building dependency tree    
Reading state information... Done
The following packages were automatically installed and are no longer required:
  flatpak gnome-software-common libflatpak0 libostree-1-1 python-apt python-gi
  xdg-desktop-portal xdg-desktop-portal-gtk
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  appstream* gir1.2-appstream-1.0* gnome-software*
  gnome-software-plugin-flatpak* isenkram-cli* libappstream4* packagekit*
  packagekit-tools* pureos-desktop* pureos-gnome*
0 upgraded, 0 newly installed, 10 to remove and 1066 not upgraded.
After this operation, 10.4 MB disk space will be freed.
Do you want to continue? [Y/n] ^C
omsai@xm2:~$ sudo apt install --reinstall libappstream4
Reading package lists... Done
Building dependency tree    
Reading state information... Done
The following additional packages will be installed:
  gir1.2-appstream-1.0
The following packages will be upgraded:
  gir1.2-appstream-1.0 libappstream4
2 upgraded, 0 newly installed, 0 to remove and 1071 not upgraded.
Need to get 127 kB of archives.
After this operation, 8,192 B of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://repo.puri.sm/pureos green/main amd64 gir1.2-appstream-1.0 amd64 0.12.3-1 [18.1 kB]
Get:2 https://repo.puri.sm/pureos green/main amd64 libappstream4 amd64 0.12.3-1 [109 kB]
Fetched 127 kB in 1s (100 kB/s)      
(Reading database ... 201225 files and directories currently installed.)
Preparing to unpack .../gir1.2-appstream-1.0_0.12.3-1_amd64.deb ...
Unpacking gir1.2-appstream-1.0 (0.12.3-1) over (0.12.1-1) ...
Preparing to unpack .../libappstream4_0.12.3-1_amd64.deb ...
Unpacking libappstream4:amd64 (0.12.3-1) over (0.12.1-1) ...
Setting up libappstream4:amd64 (0.12.3-1) ...
Setting up gir1.2-appstream-1.0 (0.12.3-1) ...
Processing triggers for libc-bin (2.27-3) ...
omsai@xm2:~$ sudo apt update
Hit:1 https://repo.puri.sm/pureos green InRelease
Reading package lists... Done              
Building dependency tree    
Reading state information... Done
1071 packages can be upgraded. Run 'apt list --upgradable' to see them.
omsai@xm2:~$