Skip to content

With multiple remotes having the same collection ID, flatpak can fail to pull ostree-metadata #1832

Closed

Description

@mwleeds

In Endless, the default /ostree/repo/config, which is shared by flatpak and ostree, has two remotes configured that point to the same repository, eos and eos-runtimes. The former is used for OS updates and has xa.disable=true so flatpak is supposed to ignore it, and the latter is used by flatpak for legacy runtimes. When collection IDs are enabled, both have the same one, com.endlessm.Os. This leads to a problem when flatpak tries to pull the ostree-metadata ref for eos-runtimes.

Specifically _flatpak_dir_fetch_remote_state_metadata_branch tries to fetch eos-runtimes:ostree-metadata and it's successful but the pull code actually fetches it from the eos remote. The libostree API used by flatpak, ostree_repo_find_remotes_async/ostree_repo_pull_from_remotes_async ignores xa.disable=true (as it should, otherwise OS updates would be disabled). So in _flatpak_dir_get_remote_state after the successful pull into refs/remotes/eos/ostree-metadata, flatpak_dir_read_latest is called which looks in refs/remotes/eos-runtimes and fails to find the ostree-metadata, which eventually leads to eos-updater failing with the message Fetch: failed to pull necessary new flatpaks for update: Refspec 'eos-runtimes:ostree-metadata' not found. (because eos-updater uses libflatpak to autoinstall flatpaks).

One solution to this would be to communicate to libostree which remotes are disabled, but per #1447 (comment) having multiple remotes with the same collection ID is a valid configuration, and then the issue would remain.

A better solution would be for flatpak to use refs/mirrors instead of refs/remotes for ostree-metadata, appstream refs, and perhaps everything coming from a remote with a collection ID. This way you have to worry less about constantly translating between collection IDs and remote names, and you're able to disambiguate staging and prod refs from the same remote, e.g. (com.endlessm.Os, ostree-metadata) vs (com.endlessm.Dev.Os, ostree-metadata), which would also fix #1477. However this requires invasive changes to flatpak (basically, making more liberal use of ostree_repo_resolve_collection_ref and OSTREE_REPO_PULL_FLAGS_MIRROR), and this might change the behavior with respect to, for example, updating apps from prod to dev.

Activity

  1. mwleeds commented on Feb 25, 2019

    @mwleeds
    ContributorAuthor

    I think what's left to do here which would fix this and #1477 is:

  2. mwleeds commented on Mar 26, 2020

    @mwleeds
    ContributorAuthor

    This is still a limitation of the libostree API (ostree_repo_find_remotes_async/ostree_repo_pull_from_remotes_async) but flatpak no longer uses that after #3476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions