rharish101/ReGreet

Regreet not detecting greetd at boot

wikiker opened this issue · 4 comments

When updating my NixOS, which included upgrading greetd to the latest version, I noticed a problem with regreet. When started by greetd at boot, I get the following error:

ERROR regreet: panicked at src/client.rs:42:13:
Missing environment variable 'GREETD_SOCK'. Is greetd running?

But when I restart the greetd service, regreet starts just fine; so the problem is only at boot.

My greetd config is this:

	services.greetd =
		let
			sway-config = pkgs.writeText "greetd-sway-config" ''
				exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK

				bindsym Mod4+m exec swaynag \
					-t warning \
					-m 'What do you want to do?' \
					-b 'Poweroff' 'systemctl poweroff' \
					-b 'Reboot' 'systemctl reboot'

				input * {
					xkb_layout "cz"
				}

				output DP-1 pos 0 0
				output HDMI-A-2 disable

				exec "${pkgs.greetd.regreet}/bin/regreet; swaymsg exit"

				include /etc/sway/config.d/*
			'';
			session = {
				command = "${pkgs.sway}/bin/sway --config ${sway-config}";
				user = "greeter";
			};
		in
		{
			enable = true;
			settings = {
				default_session = session;
				initial_session = session;
				# terminal.vt = 1;
			};
		};

Sounds like greetd isn't started properly at boot, since it's not exporting the GREETD_SOCK environment variable that greetd greeters need. Can you check your bootloader/greetd setup?

Oh I see where the issue is:

initial_session = session;

This is for a user session, like

[initial_session]
command = "Hyprland"
user = "max_ishere"

Basically remove initial session, and just have default session

https://man.archlinux.org/man/greetd.5.en#default_session