gmodena / nix-flatpak

Install flatpaks declaratively
Apache License 2.0
320 stars 10 forks source link

nix-flatpak keeps on uninstalling a remote before adding the remote from a flatpakref #90

Open SpiderUnderUrBed opened 2 weeks ago

SpiderUnderUrBed commented 2 weeks ago

What I stated on the title is what I am assuming to happen given that until the recent pull request, I got a diffrent kind of error on how it was unable to remove the remote. I realize that I need to figure out why nix-flatpak wants to remove the remote from my flatpakref and I cannot figure it out. I stated I had a issue like this earlier, here is the error:

× flatpak-managed-install.service
     Loaded: loaded (/etc/systemd/system/flatpak-managed-install.service; enabled; preset: ignored)
     Active: failed (Result: exit-code) since Tue 2024-10-22 07:06:22 NZDT; 286ms ago
 Invocation: 63a7fa1b138344b389ebca6c11d44305
    Process: 111503 ExecStart=/nix/store/3w9yrhksarir324f0r01nvg349x7xlvg-flatpak-managed-install (code=exited, status=1/FAILURE)
   Main PID: 111503 (code=exited, status=1/FAILURE)
         IP: 1.5M in, 25.8K out
   Mem peak: 37.7M
        CPU: 899ms

Oct 22 07:06:11 daspidercave systemd[1]: Starting flatpak-managed-install.service...
Oct 22 07:06:16 daspidercave flatpak[112474]: system: Removed remote sober
Oct 22 07:06:18 daspidercave 3w9yrhksarir324f0r01nvg349x7xlvg-flatpak-managed-install[112478]: Skipping: moe.launcher.the-honkers-railway-launcher/x86_64/master is already installed
Oct 22 07:06:20 daspidercave 3w9yrhksarir324f0r01nvg349x7xlvg-flatpak-managed-install[112507]: Skipping: moe.launcher.an-anime-game-launcher/x86_64/master is already installed
Oct 22 07:06:22 daspidercave 3w9yrhksarir324f0r01nvg349x7xlvg-flatpak-managed-install[112519]: error: No remote refs found for ‘org.vinegarhq.Sober’
Oct 22 07:06:22 daspidercave systemd[1]: flatpak-managed-install.service: Main process exited, code=exited, status=1/FAILURE
Oct 22 07:06:22 daspidercave systemd[1]: flatpak-managed-install.service: Failed with result 'exit-code'.
Oct 22 07:06:22 daspidercave systemd[1]: Failed to start flatpak-managed-install.service.
Oct 22 07:06:22 daspidercave systemd[1]: flatpak-managed-install.service: Consumed 899ms CPU time, 37.7M memory peak, 1.5M incoming IP traffic, 25.7K outgoing IP traffic.
warning: error(s) occurred while switching to the new configuration

And here is the flatpak.nix file: https://pastebin.com/XMY5iwmu

Is this expected behavior from uninstallUnmanaged when a remote suggested from a flatpakref file isnt also listed explictly under "remotes"?

gmodena commented 1 week ago

hey @SpiderUnderUrBed

Is this expected behavior from uninstallUnmanaged when a remote suggested from a flatpakref file isnt also listed explictly under "remotes"?

What you experience is not expected behaviour, and unfortunately I am unable to reproduce it in my test envs.

Could you maybe share some more verbose systemd/journald logs, and the whole content of /nix/store/3w9yrhksarir324f0r01nvg349x7xlvg-flatpak-managed-install ?

As a last resort, could you try starting from a fresh system? Meaning: manually removing all unmanaged remotes and deleting /nix/var/nix/gcroots/flatpak-state.json?

SpiderUnderUrBed commented 1 week ago

https://pastebin.com/hqDp4Cda ^ content of /nix/store/3w9yrhksarir324f0r01nvg349x7xlvg-flatpak-managed-install https://pastebin.com/BPs4zLhk ^ journalctl logs going back 500.

This is what happens which I tried what you said: https://pastebin.com/RDMJ6Ywe

Also uninstalled remotes should have been removed automatically, and to my knowlage they have, given this happens with my flatpakref install, the error must lie with that.

gmodena commented 1 week ago

This is what happens which I tried what you said: https://pastebin.com/RDMJ6Ywe

You removed nix-flatpak's state file, but I'm afraid you may still have 'org.vinegarhq.Sober' installed from previous installations (either manually or via nix-flatpak).

Oct 30 09:09:48 daspidercave f3szjfavynaafcvixr7jxyyhqcf50a3c-flatpak-managed-install[12356]: error: No remote refs found for ‘org.vinegarhq.Sober’

You are seeing this message because nix-flatpak found 'org.vinegarhq.Sober' already present in your system (using flatpak list --app) and is attempting to reinstall it from the URI rather than the provided flatpakref file (and thus also installing the remote).

I was able to repro under these conditions.

Could you:

And just to be sure: point nix-flatpak to https://sober.vinegarhq.org/sober.flatpakref, instead of a local file (unlikely to be an issue, unless you modified sober.flatpakref).

SpiderUnderUrBed commented 1 week ago

I will test all of that later, I suspect another issue is happening when it comes to flatpak refs updating, I have to manually uninstall the flatpak then re-install the flatpak ref when i want to update, any idea on why this is?

gmodena commented 2 days ago

I'm testing a fix. I should have patch incoming sometimes this week.