Any way to restore or fast reinstall an installed flatpak?

Robin Lee robinlee.sysu at gmail.com
Thu Apr 5 13:03:02 UTC 2018


$ ostree fsck --repo=$HOME/.local/share/flatpak/repo --delete
Validating refs...
Enumerating objects...
Verifying content integrity of 16 commit objects...

fsck objects (48647/72169) [========     ]  67%fsck content object
b5eeec19a429c594e684f64c1bc84f717b9b6596e3f75fc8197421d94f560c61:
Corrupted file object; checksum
expected='b5eeec19a429c594e684f64c1bc84f717b9b6596e3f75fc8197421d94f560c61'
actual='b7431d71c722e8edb2f4f11b1603ebcfa281e7a598757fa7631355a40fbac986'
fsck objects (72169/72169) [=============] 100%
6 partial commits not verified
error: Repository corruption encountered

After running this, runtime reinstall will fail:

$ flatpak --user install  flathub org.freedesktop.Sdk/x86_64/1.6
Installing for user: org.freedesktop.Sdk/x86_64/1.6 from flathub
[####################] 1 metadata, 0 content objects fetched; 569 B
transferred in 6 seconds
error: While trying to checkout
07b0e89b0f6c4f72bbeb101f89d5c16ffab2a1f3d2e317b5ecc2adf8ead585ba into
/home/cheese/.local/share/flatpak/runtime/org.freedesktop.Sdk/x86_64/1.6/.07b0e89b0f6c4f72bbeb101f89d5c16ffab2a1f3d2e317b5ecc2adf8ead585ba-68YTGZ:
Couldn't find file object
'b5eeec19a429c594e684f64c1bc84f717b9b6596e3f75fc8197421d94f560c61'

So the file is still not recovered.

By the way, shall flatpak prevents apps from modifying files under /etc?

On Thu, Apr 5, 2018 at 8:40 PM, Alexander Larsson <alexl at redhat.com> wrote:
> This is tricky, especially if you edited a shared file. For example
> say you have both the freedesktop.org and a gnome runtime installed.
> The later is based on the former, so it contains all its files. You'll
> have two different checkout for these two plus a repo, and any shared
> file will be hardlinked in all of these. If you modify the file itself
> you run into two issues:
>
> 1) ostree assumes that all files in the repo are valid (i.e. they are
> named by the sha256 of the content and the content doesn't match that
> if it changed without renaming it). So, ostree will never re-download
> such a file.
> 2) If the invalid file is shared, then even uninstalling one of the
> runtimes will not get rid of the invalid object.
>
> Maybe you can try ostree fsck --repo=$HOME/.local/share/flatpak/repo --delete
>
>
> On Thu, Apr 5, 2018 at 1:23 PM, Robin Lee <robinlee.sysu at gmail.com> wrote:
>> Yes, I am facing the exact case as you said.
>> Using install --reinstall does not recover some config file.
>> So, how can I recover it under this situation?
>>
>> On Tue, Apr 3, 2018 at 4:13 PM, Alexander Larsson <alexl at redhat.com> wrote:
>>> By the way, when you do something like this, make sure you replace the
>>> file you're editing, rather than edit it in place, because the files
>>> in ~/.local/share/flatpak/runtime/... are hardlinked to the ostree
>>> repo, so an in-place change will break the ostree repo.
>>>
>>> Most tools like e.g. editors do this, but some might not.
>>>
>>> On Tue, Apr 3, 2018 at 8:29 AM, Robin Lee <robinlee.sysu at gmail.com> wrote:
>>>> On Tue, Apr 3, 2018 at 2:17 PM, Bartłomiej Piotrowski <b at bpiotrowski.pl> wrote:
>>>>> On 2018-04-02 18:53, Robin Lee wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I deleted and modified some files under
>>>>>> ~/.local/share/flatpak/runtime/org.freedesktop.Platform/x86_64/1.6/active/files/
>>>>>> .
>>>>>> Is there any special method to restore the original whole tree of an
>>>>>> installed flatpak?
>>>>>>
>>>>>> -robin
>>>>>> _______________________________________________
>>>>>> Flatpak mailing list
>>>>>> Flatpak at lists.freedesktop.org
>>>>>> https://lists.freedesktop.org/mailman/listinfo/flatpak
>>>>>>
>>>>>
>>>>> flatpak install --reinstall org.freedesktop.Platform//1.6 should do that.
>>>> Thanks! I missed this since it is not in the man page (0.10.4).
>>>>>
>>>>> Bartłomiej
>>>> _______________________________________________
>>>> Flatpak mailing list
>>>> Flatpak at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/flatpak
>>>
>>>
>>>
>>> --
>>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>>  Alexander Larsson                                Red Hat, Inc
>>>        alexl at redhat.com         alexander.larsson at gmail.com
>
>
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>  Alexander Larsson                                Red Hat, Inc
>        alexl at redhat.com         alexander.larsson at gmail.com


More information about the Flatpak mailing list