lilyinstarlight / nixos-cosmic

Flake for using COSMIC on NixOS
MIT License
441 stars 27 forks source link

COSMIC Portal is not functioning #406

Closed FriederHannenheim closed 1 month ago

FriederHannenheim commented 1 month ago

The GTK Portal is used for opening files and other options. Also cosmic-screenshot doesn't work because the cosmic portal isn't used.

thread 'main' panicked at src/main.rs:69:10:
failed to send screenshot request: Zbus(MethodError(OwnedErrorName(ErrorName(Str(Owned("org.freedesktop.DBus.Error.UnknownMethod")))), Some("No such interface “org.freedesktop.portal.Screenshot” on object at path /org/freedesktop/portal/desktop"), Msg { type: Error, sender: UniqueName(Str(Borrowed(":1.40"))), reply-serial: 17, body: Signature("s") }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
lilyinstarlight commented 1 month ago

Can you share system logs?

This would imply your xdg-desktop-portal-cosmic is failing to start (which likely is irrelevant to the GTK portal)

FriederHannenheim commented 1 month ago

Which logs exactly? It looks like xdg-desktop-portal-cosmic is running:


[fried@nixoshackbrett:~]$ ps aux | grep portal
fried       1770  0.0  0.1 970444  8688 tty2     Sl+  01:58   0:00 /nix/store/kjksxbpnqxbk3j00pix65jqqc2f7asd1-xdg-desktop-portal-cosmic-1.0.0-alpha.2-unstable-2024-10-10/bin/xdg-desktop-portal-cosmic
fried       1845  0.0  0.1 550844  8288 ?        Ssl  01:58   0:00 /nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-desktop-portal-1.18.4/libexec/xdg-desktop-portal
fried       1879  0.0  0.0 534648  4444 ?        Ssl  01:58   0:00 /nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-desktop-portal-1.18.4/libexec/xdg-document-portal
fried       1885  0.0  0.0 310892  4296 ?        Ssl  01:58   0:00 /nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-desktop-portal-1.18.4/libexec/xdg-permission-store
root        1894  0.0  0.0   2588  1584 ?        Ss   01:58   0:00 fusermount3 -o rw,nosuid,nodev,fsname=portal,auto_unmount,subtype=portal -- /run/user/1000/doc
fried       1899  0.0  0.1 503264 15408 ?        Ssl  01:58   0:01 /nix/store/zsy91qrfknmxpi471k1qsrl8lrr1sy6y-xdg-desktop-portal-gtk-1.15.1/libexec/xdg-desktop-portal-gtk
fried      10455  0.0  0.0 329844  7588 ?        Ssl  10:54   0:00 /nix/store/mwxakg36ha9jmzc82q9lmw442fv59jsx-flatpak-1.14.10/libexec/flatpak-portal
fried      34638  0.0  0.0   9924  2724 pts/3    S+   12:28   0:00 grep portal
lilyinstarlight commented 1 month ago

Which logs exactly?

Journalctl logs, or anything else you have handy about your setup to help debug why your cosmic portal is not working

FriederHannenheim commented 1 month ago

Okay. Here's journalctl --user -xe | grep portal

Okt 12 01:58:30 nixoshackbrett cosmic-session[1674]: starting process ' DISPLAY=:0 WAYLAND_DISPLAY=wayland-1 XDG_SESSION_TYPE=wayland WAYLAND_SOCKET=73 PORTAL_WAYLAND_SOCKET=70 /nix/store/kjksxbpnqxbk3j00pix65jqqc2f7asd1-xdg-desktop-portal-cosmic-1.0.0-alpha.2-unstable-2024-10-10/bin/xdg-desktop-portal-cosmic '
Okt 12 01:58:30 nixoshackbrett systemd[1637]: Started xdg-desktop-portal-cosmic.scope.
Okt 12 01:58:31 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating via systemd: service name='org.freedesktop.portal.Desktop' unit='xdg-desktop-portal.service' requested by ':1.32' (uid=1000 pid=1755 comm="cosmic-launcher" label="kernel")
Okt 12 01:58:31 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating via systemd: service name='org.freedesktop.portal.Documents' unit='xdg-document-portal.service' requested by ':1.40' (uid=1000 pid=1845 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:31 nixoshackbrett systemd[1637]: Starting flatpak document portal service...
Okt 12 01:58:31 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating via systemd: service name='org.freedesktop.impl.portal.PermissionStore' unit='xdg-permission-store.service' requested by ':1.42' (uid=1000 pid=1879 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:31 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Successfully activated service 'org.freedesktop.impl.portal.PermissionStore'
Okt 12 01:58:31 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Successfully activated service 'org.freedesktop.portal.Documents'
Okt 12 01:58:31 nixoshackbrett systemd[1637]: Started flatpak document portal service.
Okt 12 01:58:31 nixoshackbrett .xdg-desktop-po[1845]: Choosing gtk.portal for org.freedesktop.impl.portal.Lockdown as a last-resort fallback
Okt 12 01:58:31 nixoshackbrett .xdg-desktop-po[1845]: The preferred method to match portal implementations to desktop environments is to use the portals.conf(5) configuration file
Okt 12 01:58:31 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating via systemd: service name='org.freedesktop.impl.portal.desktop.gtk' unit='xdg-desktop-portal-gtk.service' requested by ':1.40' (uid=1000 pid=1845 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Successfully activated service 'org.freedesktop.impl.portal.desktop.gtk'
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating service name='org.freedesktop.impl.portal.desktop.cosmic' requested by ':1.40' (uid=1000 pid=1845 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activated service 'org.freedesktop.impl.portal.desktop.cosmic' failed: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Failed to create settings proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.cosmic: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating service name='org.freedesktop.impl.portal.desktop.cosmic' requested by ':1.40' (uid=1000 pid=1845 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activated service 'org.freedesktop.impl.portal.desktop.cosmic' failed: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Failed to create file chooser proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.cosmic: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Choosing gtk.portal for org.freedesktop.impl.portal.AppChooser as a last-resort fallback
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Choosing gtk.portal for org.freedesktop.impl.portal.Print as a last-resort fallback
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Choosing gtk.portal for org.freedesktop.impl.portal.Notification as a last-resort fallback
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Choosing gtk.portal for org.freedesktop.impl.portal.Inhibit as a last-resort fallback
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating service name='org.freedesktop.impl.portal.desktop.cosmic' requested by ':1.40' (uid=1000 pid=1845 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activated service 'org.freedesktop.impl.portal.desktop.cosmic' failed: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Failed to create access proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.cosmic: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating service name='org.freedesktop.impl.portal.desktop.cosmic' requested by ':1.40' (uid=1000 pid=1845 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activated service 'org.freedesktop.impl.portal.desktop.cosmic' failed: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Failed to create access proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.cosmic: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating service name='org.freedesktop.impl.portal.desktop.cosmic' requested by ':1.40' (uid=1000 pid=1845 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activated service 'org.freedesktop.impl.portal.desktop.cosmic' failed: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Failed to create screenshot proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.cosmic: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Choosing gtk.portal for org.freedesktop.impl.portal.Wallpaper as a last-resort fallback
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating service name='org.freedesktop.impl.portal.desktop.cosmic' requested by ':1.40' (uid=1000 pid=1845 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activated service 'org.freedesktop.impl.portal.desktop.cosmic' failed: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Choosing gtk.portal for org.freedesktop.impl.portal.Account as a last-resort fallback
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Choosing gtk.portal for org.freedesktop.impl.portal.Email as a last-resort fallback
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Choosing gtk.portal for org.freedesktop.impl.portal.DynamicLauncher as a last-resort fallback
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating service name='org.freedesktop.impl.portal.desktop.cosmic' requested by ':1.40' (uid=1000 pid=1845 comm="/nix/store/sczai2gv7di38pg5c722n4zpaizy977y-xdg-de" label="kernel")
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activated service 'org.freedesktop.impl.portal.desktop.cosmic' failed: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett .xdg-desktop-po[1845]: Failed to create screen cast proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.cosmic: Failed to execute program org.freedesktop.impl.portal.desktop.cosmic: No such file or directory
Okt 12 01:58:32 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Successfully activated service 'org.freedesktop.portal.Desktop'
Okt 12 01:58:43 nixoshackbrett .xdg-desktop-po[1899]: Failed to associate portal window with parent window 
Okt 12 10:54:49 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Activating via systemd: service name='org.freedesktop.portal.Flatpak' unit='flatpak-portal.service' requested by ':1.146' (uid=1000 pid=10446 comm="/nix/store/8wz4wrpj5i30h27v2dqbjdkq2lq0r73q-xdg-db" label="kernel")
Okt 12 10:54:49 nixoshackbrett systemd[1637]: Starting flatpak portal...
Okt 12 10:54:49 nixoshackbrett dbus-daemon[1684]: [session uid=1000 pid=1684] Successfully activated service 'org.freedesktop.portal.Flatpak'
Okt 12 10:54:49 nixoshackbrett systemd[1637]: Started flatpak portal.
lilyinstarlight commented 1 month ago

Hmmm, those logs do look somewhat helpful. I wonder if this is more dbus-daemon rubbish (dbus-broker by default on NixOS when...)

What nixpkgs revision are you on?

I'll try to poke at it today or tomorrow

FriederHannenheim commented 1 month ago

I'm on 45a553ce828126aefd4cb7cad3af75d93577342b

lilyinstarlight commented 1 month ago

I may be having a brain moment, but I'm not seeing that revision in nixpkgs? https://github.com/NixOS/nixpkgs/commit/45a553ce828126aefd4cb7cad3af75d93577342b

FriederHannenheim commented 1 month ago

Ahh sorry. Looks like I was having the brain moment. I pulled the wrong rev from my flake.lock. This one is right, I checked: 5863c27340ba4de8f83e7e3c023b9599c3cb3c80

If it would help you I can also provide my system config.

lilyinstarlight commented 1 month ago

Apologies for taking a bit to get back to you, I got very sick for a few days

That looks like a very old Nixpkgs commit (like from a nixos-unstable before even the 24.05 release: https://github.com/NixOS/nixpkgs/commit/5863c27340ba4de8f83e7e3c023b9599c3cb3c80), would you be able to update it and try again?

FriederHannenheim commented 1 month ago

Hi. I updated my system to https://github.com/NixOS/nixpkgs/commit/a3c0b3b21515f74fd2665903d4ce6bc4dc81c77c and the issue persists. Also sorry for taking a while to answer. I'm currently still without internet after a move and have to go to places with public wifi to go online

lilyinstarlight commented 1 month ago

No worries, I'll leave this issue open until we can figure out a resolution if it's still an issue :)

Given I'm having trouble still in replicating this issue, is your configuration public so I can poke at it and see if anything there is causing issues?

FriederHannenheim commented 1 month ago

Okay. You can find my config here: https://codeberg.org/Frieder_Hannenheim/nixos_config The host I'm using is called nixoshackbrett and the cosmic setup code is in modues/desktop.nix. If you find anything it would be a great help.

zerotao commented 1 month ago

I was having a similar issue that suddenly 'went away' when I removed Gnome. I didn't dig into it but it could be some conflict with the portal getting hijacked if gnome is installed.

lilyinstarlight commented 1 month ago

I was having a similar issue that suddenly 'went away' when I removed Gnome. I didn't dig into it but it could be some conflict with the portal getting hijacked if gnome is installed.

That's weird. @FriederHannenheim's logs, if I remember correctly, only indicated that xdg-desktop-portal was convinced xdg-desktop-portal-cosmic was not present on/connected to dbus user session and dbus trying to do service activation for some reason (which expectedly fails because xdg-desktop-portal-cosmic is not designed to use service activation)

No "hijacking" or even any indication that xdg-desktop-portal-gnome was taken into consideration at all (which makes sense, even if it's "installed", given the xdg desktop session restriction on it)

I'm still gonna be digging in further with their config when I have a chance, but I'm suspecting a xdg-desktop-portal-cosmic init bug

FriederHannenheim commented 1 month ago

I updated again today and it started working. Thank you for your help regardless