Bug 1981776

Summary: Flatpak cannot handle empty /var/lib/flatpak
Product: Red Hat Enterprise Linux 9 Reporter: Martin Krajnak <mkrajnak>
Component: flatpakAssignee: Debarshi Ray <debarshir>
Status: CLOSED ERRATA QA Contact: Martin Krajnak <mkrajnak>
Severity: high Docs Contact:
Priority: unspecified    
Version: 9.0CC: debarshir, lmiksik, mcatanza, mihai, pcfe, tpelka, tpopela, travier
Target Milestone: betaKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: flatpak-1.12.5-2.el9_0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2062806 (view as bug list) Environment:
Last Closed: 2022-05-17 12:32:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2062806    

Description Martin Krajnak 2021-07-13 11:36:33 UTC
Description of problem:
Since we are not shipping any remote with RHEL by default so far, every RHEL9 installation has empty /var/lib/flatpak.

This causes 2 kinds of issues:

1. Every start of gnome-software greets users with error message:
Sorry, Something went wrong:
error: Creating repo: mkdirat: Permission denied

2. The same error is preventing users to make operation with added --user remotes:
$ flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
$ flatpak remote-info flathub 
error: Creating repo: mkdirat: Permission denied
$ flatpak remote-ls flathub 
error: Creating repo: mkdirat: Permission denied
$ flatpak remote-delete flathub
error: Creating repo: mkdirat: Permission denied
   
Version-Release number of selected component (if applicable):
flatpak-1.10.2-4.el9.x86_64

How reproducible:
always

Additional info:
I reproduced this with Fedora 35 (https://github.com/flatpak/flatpak/issues/4111#issuecomment-878226675) as well. 

As mentioned in upstream issue running "# flatpak repair" populates /var/lib/flatpak and solves the situation.

Comment 1 Debarshi Ray 2021-09-21 23:14:00 UTC
*** Bug 2003810 has been marked as a duplicate of this bug. ***

Comment 2 Timothée Ravier 2022-03-01 14:54:14 UTC
*** Bug 2057584 has been marked as a duplicate of this bug. ***

Comment 3 Timothée Ravier 2022-03-01 14:59:39 UTC
It looks like this is only triggered when the 'repo' subfolder is missing.
Two short term workarounds available:
- Do not create /var/lib/flatpak by default
- Create /var/lib/flatpak/repo by default

Comment 11 Debarshi Ray 2022-03-07 22:39:52 UTC
Merge request: https://gitlab.com/redhat/centos-stream/rpms/flatpak/-/merge_requests/13

Comment 18 Debarshi Ray 2022-03-10 16:17:10 UTC
Built flatpak-1.12.5-2.el9_0:
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=43719286

Comment 19 Martin Krajnak 2022-03-14 07:53:45 UTC
flatpak-1.12.5-2.el9_0.x86_64

1. I tried both reproducers in the bug Description and the error message is no longer there.

2. Removing contents of /var/lib/flatpak/ does not cause the error message to occur.

Comment 23 errata-xmlrpc 2022-05-17 12:32:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: flatpak), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2334