Bug 474540 - Freshly installed Neon doesn't have a populated Appstream os-catalog (/var/lib/swcatalog/yaml is empty)
Summary: Freshly installed Neon doesn't have a populated Appstream os-catalog (/var/li...
Status: RESOLVED FIXED
Alias: None
Product: neon
Classification: KDE Neon
Component: Live/Install images (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Neon Bugs
URL: https://github.com/ximion/appstream/i...
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-15 08:46 UTC by Malte S. Stretz
Modified: 2023-09-16 08:31 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Malte S. Stretz 2023-09-15 08:46:46 UTC
SUMMARY

I digged a bit to find out what was the actual root cause for the crash in bug 474402 since I couldn't reproduce it on an existing Neon which was installed a while ago.

Here the ddebs component is found even if I purge all caches (both global and for my user):

> # rm -r .cache/appstream/; appstreamcli get --verbose org.kde.neon.com.ubuntu.ddebs 2>&1 | grep '[.]xb'
> ** (appstreamcli:10325): DEBUG: 10:27:35.367: Writing cache file: /home/mss/.cache/appstream/en-US-flatpak-flathub-x86_64.xb
> ** (appstreamcli:10325): DEBUG: 10:27:37.160: Writing cache file: /home/mss/.cache/appstream/en-US-os-catalog.xb
> ** (appstreamcli:10325): DEBUG: 10:27:37.449: Writing cache file: /home/mss/.cache/appstream/en-US-local-metainfo.xb
> # appstreamcli get --verbose org.kde.neon.com.ubuntu.ddebs
> ** (appstreamcli:10328): DEBUG: 10:27:41.264: run appstreamcli: get
> ** (appstreamcli:10328): DEBUG: 10:27:41.264: run AsPool:load
> ** (appstreamcli:10328): DEBUG: 10:27:41.264: Pruning old cache data.
> (appstreamcli:10328): GLib-GIO-DEBUG: 10:27:41.264: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ‘gio-vfs’
> ** (appstreamcli:10328): DEBUG: 10:27:41.265: Not adding metadata catalog location '/usr/share/swcatalog': Not a directory, or does not exist.
> ** (appstreamcli:10328): DEBUG: 10:27:41.265: Using cached metadata: flatpak-flathub-x86_64
> ** (appstreamcli:10328): DEBUG: 10:27:41.265: Using cache file: /home/mss/.cache/appstream/en-US-flatpak-flathub-x86_64.xb
> ** (appstreamcli:10328): DEBUG: 10:27:41.265: Using cached metadata: os-catalog
> ** (appstreamcli:10328): DEBUG: 10:27:41.265: Using cache file: /home/mss/.cache/appstream/en-US-os-catalog.xb
> ** (appstreamcli:10328): DEBUG: 10:27:41.266: Using cached metadata: local-metainfo
> ** (appstreamcli:10328): DEBUG: 10:27:41.266: Using cache file: /home/mss/.cache/appstream/en-US-local-metainfo.xb
> ** (appstreamcli:10328): DEBUG: 10:27:41.266: run AsPool:get_components_by_id
> ** (appstreamcli:10328): DEBUG: 10:27:41.266: Querying `components/component/id[lower-case(text())=?]/..` in system:en-US-flatpak-flathub-x86_64
> ** (appstreamcli:10328): DEBUG: 10:27:41.273: Querying `components/component/id[lower-case(text())=?]/..` in system:en-US-os-catalog
> ** (appstreamcli:10328): DEBUG: 10:27:41.276: Querying `components/component/id[lower-case(text())=?]/..` in system:en-US-local-metainfo
> Identifier: org.kde.neon.com.ubuntu.ddebs [repository]
> Name: Ubuntu Debug Symbols
> Summary: Debug Symbols for Ubuntu
> Package: neon-repositories-ubuntu-ddebs

According to xb-tool dump is this id found in $HOME/.cache/appstream/en-US-os-catalog.xb and based on a wild guess I found /var/lib/swcatalog/yaml/archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz which seems to be the source for this.

That file is a symlink which does not exist on the freshly installed Neon.


STEPS TO REPRODUCE
1. Install Neon user edition 20230907-0716, reboot into new system
1a. this should affect the Live ISO itself as well but I didn't check
2. ls -l /var/lib/swcatalog/yaml/

OBSERVED RESULT
Empty directory

EXPECTED RESULT
> total 44
> lrwxrwxrwx 1 root root  91 Okt 24  2022 archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root 104 Feb  7  2023 de.archive.ubuntu.com_ubuntu_dists_jammy-backports_main_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_jammy-backports_main_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root 108 Okt 24  2022 de.archive.ubuntu.com_ubuntu_dists_jammy-backports_universe_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_jammy-backports_universe_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root  94 Okt 24  2022 de.archive.ubuntu.com_ubuntu_dists_jammy_main_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_jammy_main_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root 100 Okt 24  2022 de.archive.ubuntu.com_ubuntu_dists_jammy_multiverse_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_jammy_multiverse_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root  98 Okt 24  2022 de.archive.ubuntu.com_ubuntu_dists_jammy_universe_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_jammy_universe_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root 102 Okt 24  2022 de.archive.ubuntu.com_ubuntu_dists_jammy-updates_main_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_jammy-updates_main_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root 108 Okt 24  2022 de.archive.ubuntu.com_ubuntu_dists_jammy-updates_multiverse_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_jammy-updates_multiverse_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root 106 Okt 24  2022 de.archive.ubuntu.com_ubuntu_dists_jammy-updates_universe_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_jammy-updates_universe_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root 101 Okt 24  2022 security.ubuntu.com_ubuntu_dists_jammy-security_main_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_jammy-security_main_dep11_Components-amd64.yml.gz
> lrwxrwxrwx 1 root root 105 Okt 24  2022 security.ubuntu.com_ubuntu_dists_jammy-security_universe_dep11_Components-amd64.yml.gz -> /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_jammy-security_universe_dep11_Components-amd64.yml.gz


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Neon 5.27
(available in About System)
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
Comment 1 Malte S. Stretz 2023-09-15 09:00:33 UTC
I tried to find out who is responsible for creating those symlinks but failed.

One thing I found though is https://bugs.launchpad.net/snap-store-desktop/+bug/1966142/comments/6 which mentions that /var/lib/swcatalog was called /var/lib/app-info before appstream 0.15.2 (yay for changing stuff like this in patch releases!) and a symlink should exist. /var/lib/app-info is indeed a symlink on the old system but is missing on the new one.

Maybe apt or whatever tries to put the symlinks into the old location and since that one can't be found it fails silently?
Comment 2 Malte S. Stretz 2023-09-15 09:12:06 UTC
Some more spelunking brought me to /etc/apt/apt.conf.d/50appstream which contains a call to appstreamcli refresh --source=os and when I execute that in debug mode it looks like it should create the symlinks but fails because... it thinks they exist already??? But that's not the case... WTF?

> sudo appstreamcli refresh --source=os --verbose
> ** (appstreamcli:22014): DEBUG: 11:06:54.638: run appstreamcli: refresh
> • Updating software metadata cache for the operating system.
> ** (appstreamcli:22014): DEBUG: 11:06:54.638: Scanning for metadata changes in the APT cache.
> (appstreamcli:22014): GLib-GIO-DEBUG: 11:06:54.638: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ‘gio-vfs’
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: File '/var/lib/swcatalog/yaml/security.ubuntu.com_ubuntu_dists_jammy-security_main_dep11_Components-amd64.yml.gz' missing, cache update is needed.
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Unable to set symlink (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_jammy-security_main_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/security.ubuntu.com_ubuntu_dists_jammy-security_main_dep11_Components-amd64.yml.gz): File exists
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Unable to set symlink (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_jammy-security_universe_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/security.ubuntu.com_ubuntu_dists_jammy-security_universe_dep11_Components-amd64.yml.gz): File exists
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Unable to set symlink (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy-updates_main_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/archive.ubuntu.com_ubuntu_dists_jammy-updates_main_dep11_Components-amd64.yml.gz): File exists
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Unable to set symlink (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy-updates_universe_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/archive.ubuntu.com_ubuntu_dists_jammy-updates_universe_dep11_Components-amd64.yml.gz): File exists
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Unable to set symlink (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy-updates_multiverse_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/archive.ubuntu.com_ubuntu_dists_jammy-updates_multiverse_dep11_Components-amd64.yml.gz): File exists
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Unable to set symlink (/var/lib/apt/lists/archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz): File exists
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Unable to set symlink (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_main_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/archive.ubuntu.com_ubuntu_dists_jammy_main_dep11_Components-amd64.yml.gz): File exists
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Unable to set symlink (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_multiverse_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/archive.ubuntu.com_ubuntu_dists_jammy_multiverse_dep11_Components-amd64.yml.gz): File exists
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Unable to set symlink (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_universe_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/archive.ubuntu.com_ubuntu_dists_jammy_universe_dep11_Components-amd64.yml.gz): File exists
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: run AsPool:load
> ** (appstreamcli:22014): DEBUG: 11:06:54.640: Pruning old cache data.
> ** (appstreamcli:22014): DEBUG: 11:06:54.641: Not adding metadata catalog location '/usr/share/swcatalog': Not a directory, or does not exist.
> ** (appstreamcli:22014): DEBUG: 11:06:54.641: run AsPool:load_catalog_data
> ** (appstreamcli:22014): DEBUG: 11:06:54.641: Searching for YAML data in: /var/lib/swcatalog/yaml
> ** (appstreamcli:22014): DEBUG: 11:06:54.641: Storing cache data for section: system:en-US-os-catalog
> ** (appstreamcli:22014): DEBUG: 11:06:54.641: Writing cache file: /var/cache/swcatalog/cache/en-US-os-catalog.xb
> ** (appstreamcli:22014): DEBUG: 11:06:54.652: Using cached metadata: local-metainfo
> ** (appstreamcli:22014): DEBUG: 11:06:54.653: Using cache file: /var/cache/swcatalog/cache/en-US-local-metainfo.xb
> ✔ Metadata cache was updated successfully.
> # ls -l /var/lib/swcatalog/yaml/security.ubuntu.com_ubuntu_dists_jammy-security_main_dep11_Components-amd64.yml.gz
> ls: cannot access '/var/lib/swcatalog/yaml/security.ubuntu.com_ubuntu_dists_jammy-security_main_dep11_Components-amd64.yml.gz': No such file or directory
Comment 3 Malte S. Stretz 2023-09-15 09:18:21 UTC
Oh, I got it! It is the good old "symlink argument order is confusing to some people" issue:

> # sudo strace appstreamcli refresh --source=os --verbose 2>&1 | grep /var/lib/swcatalog/yaml/archive.neon
> access("/var/lib/swcatalog/yaml/archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz", F_OK) = -1 ENOENT (No such file or directory)
> symlink("/var/lib/swcatalog/yaml/archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz", "/var/lib/apt/lists/archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz") = -1 EEXIST (File exists)
> write(1, "** (appstreamcli:22100): DEBUG: "..., 275** (appstreamcli:22100): DEBUG: 11:15:06.968: Unable to set symlink (/var/lib/apt/lists/archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz -> /var/lib/swcatalog/yaml/archive.neon.kde.org_user_dists_jammy_main_dep11_Components-amd64.yml.gz): File exists
Comment 4 Malte S. Stretz 2023-09-15 09:20:12 UTC
Great and here is the upstream bug filed by Harald already: https://github.com/ximion/appstream/issues/513
Comment 5 Malte S. Stretz 2023-09-16 08:31:34 UTC
I am closing this as fixed since upstream has merged the fix and I am sure this will be picked up by neon once it is released.

For now, this is the workaround (amend the line for other arches than amd64):

sudo true && ls -1 /var/lib/apt/lists/*_Components-amd64.yml.gz | sudo xargs -r ln -s -t /var/lib/swcatalog/yaml/