Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flatpak-managed-install.service fails to start properly when update.onactivation set to true (v0.2.0) #30

Closed
8bitbuddhist opened this issue Feb 1, 2024 · 11 comments · Fixed by #37
Assignees

Comments

@8bitbuddhist
Copy link

8bitbuddhist commented Feb 1, 2024

When starting up my laptop, I get an error that flatpak-managed-install.service fails to start. When I pull up the service logs, it says it couldn't reach dl.flathub.org. My first guess is that it was trying to start before the network was active (I'm on a laptop with Wi-Fi), but the same thing happened in a virtual machine. Restarting the service using systemctl fixes the issue.

My config:

inputs = {
    nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.2.0";
}

...

services.flatpak = {
		enable = true;

		# Enable automatic updates
		update = {
			onActivation = true;

			# Check for updates daily
			auto = {
				enable = true;
				onCalendar = "daily";
			};
		};

		# Add remote(s)
		remotes = [
			{ name = "flathub"; location = "https://dl.flathub.org/repo/flathub.flatpakrepo"; }
			{ name = "kdeapps"; location = "https://distribute.kde.org/kdeapps.flatpakrepo"; }
		];

		# Install Flatpaks. For details, see https://github.com/gmodena/nix-flatpak
		packages = [ ...];
        };
};

systemd logs:

➜  nix-configuration git:(main) ✗ systemctl status flatpak-managed-install.service
× flatpak-managed-install.service
     Loaded: loaded (/etc/systemd/system/flatpak-managed-install.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Wed 2024-01-31 19:03:10 EST; 14min ago
TriggeredBy: ● flatpak-managed-install.timer
    Process: 1035 ExecStart=/nix/store/5ha0n1hqf2ialvy84k8hx52aavmv4gl2-flatpak-managed-install (code=exited, status=1/FAILURE)
   Main PID: 1035 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 25ms

Jan 31 19:03:10 legion systemd[1]: Starting flatpak-managed-install.service...
Jan 31 19:03:10 legion 5ha0n1hqf2ialvy84k8hx52aavmv4gl2-flatpak-managed-install[1044]: error: Can't load uri https://dl.flathub.org/repo/flathub.flatpakrepo: While fetching https://dl.flathub.org/>
Jan 31 19:03:10 legion systemd[1]: flatpak-managed-install.service: Main process exited, code=exited, status=1/FAILURE
Jan 31 19:03:10 legion systemd[1]: flatpak-managed-install.service: Failed with result 'exit-code'.
Jan 31 19:03:10 legion systemd[1]: Failed to start flatpak-managed-install.service.
@gmodena
Copy link
Owner

gmodena commented Feb 1, 2024

Hey @8bitbuddhist,

Are you tracking main or a release?

@gmodena gmodena self-assigned this Feb 1, 2024
@8bitbuddhist
Copy link
Author

Hey @8bitbuddhist,

Are you tracking main or a release?

I'm using v0.2.0

@8bitbuddhist 8bitbuddhist changed the title flatpak-managed-install.service fails to start properly when update.onactivation set to true flatpak-managed-install.service fails to start properly when update.onactivation set to true (v0.2.0) Feb 1, 2024
@8bitbuddhist
Copy link
Author

8bitbuddhist commented Feb 1, 2024

I just tried booting a build without onActivation and the service started up just fine. And I have daily updates configured anyway, so it's not like this is a major issue for me. Thanks for your work on this!

@ReedClanton
Copy link
Contributor

I'm also seeing this issue.

@ReedClanton
Copy link
Contributor

I did some more testing, and I get the bellow when I have nothing in services.flatpak.update... set:

[FAILED] Failed to start flatpak-managed-install.service.
See `systemctl status flatpak-managed-install.service` for details.

but when I have anything set in services.flatpak.update... then I also get:

[FAILED] Failed to start Home Manager environment for reedclanton.
See `systemctl status home-manager-reedclanton.service` for details.

@gmodena
Copy link
Owner

gmodena commented Feb 5, 2024

I was able to replicate on a nixos 23.11 vm. Working on a fix.

@gmodena
Copy link
Owner

gmodena commented Feb 7, 2024

Hey @8bitbuddhist @ReedClanton. I think the issue was an incorrect dependency
on systemd unit boot order. I required the flatpak-managed-install to start after network.target was
reached, but that alone does not guarantee that connectivity has been established.

There a tentative fix in the linked PR (#37). Tagged as WIP since I'd like to do a bit more testing.

@ReedClanton
Copy link
Contributor

@gmodena Stupid question, how would I test this in my setup? What URL would I change inputs.nix-flatpak.url to in my flake.nix?

@ReedClanton
Copy link
Contributor

@gmodena Stupid question, how would I test this in my setup? What URL would I change inputs.nix-flatpak.url to in my flake.nix?

nvm, figured it out. I used inputs.nix-flatpak.url = "hithub:gnodena/nix-flatpak/fix-boot-activation";

@ReedClanton
Copy link
Contributor

@gmodena & @8bitbuddhist No more failures during boot! Seems like it fixed it. Also, pretty sure that getting ride of those failures decrease my boot time!

@gmodena
Copy link
Owner

gmodena commented Feb 8, 2024

thanks for testing the patch @ReedClanton !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants