apognu / tuigreet

Graphical console greeter for greetd
GNU General Public License v3.0
977 stars 45 forks source link

Add notice on possible missing cache dir and link to cache instr. #146

Closed braun-steven closed 5 months ago

braun-steven commented 5 months ago

Some distributions (e.g., Arch, Fedora, OpenSUSE Tumbleweed) happen to be missing the setup of /var/cache/tuigreet, which leads to the --remember* options not working without running the cache instructions that are only mentioned for manual installs.

apognu commented 5 months ago

This is a good idea.

Now, you say that the package installs on Arch are missing the directory, that does not seem right to me, since they should all contain the tmpfiles.d definition to have it created. Which package did you encounter this with?

braun-steven commented 5 months ago

Sorry, I think something went wrong on my initial test for Arch. I've tested them via distrobox (podman):

Arch

$ distrobox create --name tuigreet-test-cache --pull -i quay.io/toolbx/arch-toolbox:latest
$ distrobox enter tuigreet-test-cache -- sudo pacman -S --noconfirm greetd-tuigreet
$ distrobox enter tuigreet-test-cache -- ls -lha /var/cache
total 0
drwxr-xr-x 1 root    root    44 Jun  5 11:10 .
drwxr-xr-x 1 root    root    22 May 27 02:09 ..
drwx------ 1 root    root    18 Jun  5 11:12 ldconfig
drwxr-xr-x 1 root    root     0 May 27 02:09 man
drwxr-xr-x 1 root    root     6 Jan  1 20:05 pacman
drwx------ 1 root    root     0 May 27 02:09 private
drwxr-xr-x 1 greeter greeter  0 Jun  5 11:10 tuigreet  # <--------- Works

Fedora 40

$ distrobox create --name tuigreet-test-cache-fedora --pull -i registry.fedoraproject.org/fedora-toolbox:40
$ distrobox enter tuigreet-test-cache-fedora -- sudo dnf install -y tuigreet
$ distrobox enter tuigreet-test-cache-fedora -- ls -lha /var/cache
total 0
drwxr-xr-x 1 root root  22 Jun  5 07:48 .
drwxr-xr-x 1 root root  28 Jun  5 07:48 ..
drwxr-xr-x 1 root root   0 Jan 24 01:00 bpf
drwxr-xr-x 1 root root 440 Jun  5 11:17 dnf
drwx------ 1 root root  18 Jun  5 11:16 ldconfig
drwxr-xr-x 1 root root  14 Jun  5 07:48 libX11
drwxr-xr-x 1 root root   0 Jan 29 01:00 man
drwx------ 1 root root   0 Jun  5 07:48 private

OpenSUSE Tumbleweed

$ distrobox create --name tuigreet-test-cache-opensuse --pull -i registry.opensuse.org/opensuse/distrobox:latest
$ distrobox enter tuigreet-test-cache-opensuse -- sudo zypper install -y tuigreet
$ distrobox enter tuigreet-test-cache-opensuse -- ls -lha /var/cache
total 0
drwxr-xr-x 1 root root   8 Jun  1 11:20 .
drwxr-xr-x 1 root root  34 Jun  1 11:19 ..
drwxrwx--- 1 root lp     0 Feb 26 11:48 cups
drwxr-xr-x 1 root root   0 Mar  9 20:58 fontconfig
drwxr-xr-x 1 root root 190 Jun  1 11:19 gio-2.0
drwx------ 1 root root  18 Jun  1 11:20 ldconfig
drwxr-xr-x 1 man  man  294 Jun  1 11:20 man
drwxr-xr-x 1 root root  44 Jun  5 11:19 zypp

So Arch works, but Fedora and OpenSUSE don't.

apognu commented 5 months ago

Okay, makes more sense. 🙏 I will merge this, and see if I can contact the maintainers for the packages in the other distributions.

braun-steven commented 5 months ago

Awesome, thank you!

I tried to add a function that ensures that the cache dir exists before writes to the cache happen (e.g. here https://github.com/apognu/tuigreet/blob/86bf7bbc156bf38a0ca8be08804c1a4cc99cffa5/src/info.rs#L107) only to find out that the tuigreet process, started by greetd, doesn't have permissions to create directories in /var/cache. I guess there is no simply workaround for this, or any other place (besides /tmp) which the greetd process has rw access to, right? This would alleviate the need for package maintainers to ensure that the directory exists and has the correct permissions.

apognu commented 5 months ago

Yes, as far as I know, there is no way to create it ourself because of the user the greeter runs as. So we are dependent on the packagers.