Bug 1215641

Summary: XDG Portal 0.18.0 requires DEs/WMs to have Portals Configuration
Product: [openSUSE] openSUSE Tumbleweed Reporter: Soc Virnyl Estela <uncomfy+openbuildservice>
Component: XfceAssignee: E-mail List <bnc-team-xfce>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: bjorn.lie, dimstar, fabian, maurizio.galli
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Soc Virnyl Estela 2023-09-24 04:38:31 UTC
Snapshot 20230921 has a bug where a user cannot open a filechooser/filepicker. A snippet of the log through `journalctl -f` is shown below:

```
Sep 24 12:29:37 sentient-slate firefox-bin[3253]: Server is missing xdg_foreign support
Sep 24 12:29:37 sentient-slate firefox-bin[3253]: Failed to export handle, could not set transient for
Sep 24 12:29:37 sentient-slate firefox-bin[3253]: Can't open portal file chooser: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.FileChooser” on object at path /org/freedesktop/portal/desktop
```

I have to rollback for now to a previous snapshot.
Comment 1 Soc Virnyl Estela 2023-09-24 10:42:43 UTC
(In reply to Soc Virnyl Estela from comment #0)
> Snapshot 20230921 has a bug where a user cannot open a
> filechooser/filepicker. A snippet of the log through `journalctl -f` is
> shown below:
> 
> ```
> Sep 24 12:29:37 sentient-slate firefox-bin[3253]: Server is missing
> xdg_foreign support
> Sep 24 12:29:37 sentient-slate firefox-bin[3253]: Failed to export handle,
> could not set transient for
> Sep 24 12:29:37 sentient-slate firefox-bin[3253]: Can't open portal file
> chooser: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such
> interface “org.freedesktop.portal.FileChooser” on object at path
> /org/freedesktop/portal/desktop
> ```
> 
> I have to rollback for now to a previous snapshot.

I also get a PermissionDenied error to `/run/user/1000/doc` when restartig `/usr/libexec/xdg-desktop-portal -r`

I will provide logs later. Need to get back to a previous snapshot for now
Comment 2 Soc Virnyl Estela 2023-09-24 22:18:35 UTC
(In reply to Soc Virnyl Estela from comment #1)
> (In reply to Soc Virnyl Estela from comment #0)
> > Snapshot 20230921 has a bug where a user cannot open a
> > filechooser/filepicker. A snippet of the log through `journalctl -f` is
> > shown below:
> > 
> > ```
> > Sep 24 12:29:37 sentient-slate firefox-bin[3253]: Server is missing
> > xdg_foreign support
> > Sep 24 12:29:37 sentient-slate firefox-bin[3253]: Failed to export handle,
> > could not set transient for
> > Sep 24 12:29:37 sentient-slate firefox-bin[3253]: Can't open portal file
> > chooser: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such
> > interface “org.freedesktop.portal.FileChooser” on object at path
> > /org/freedesktop/portal/desktop
> > ```
> > 
> > I have to rollback for now to a previous snapshot.
> 
> I also get a PermissionDenied error to `/run/user/1000/doc` when restartig
> `/usr/libexec/xdg-desktop-portal -r`
> 
> I will provide logs later. Need to get back to a previous snapshot for now

I am not sure why I am getting this error when trying to open a file picker

```
systemctl --user status xdg-document-portal.service
× xdg-document-portal.service - flatpak document portal service
     Loaded: loaded (/usr/lib/systemd/user/xdg-document-portal.service; static)
     Active: failed (Result: exit-code) since Mon 2023-09-25 06:09:53 PST; 1s ago
   Duration: 3ms
    Process: 21984 ExecStart=/usr/libexec/xdg-document-portal (code=exited, status=6)
   Main PID: 21984 (code=exited, status=6)
        CPU: 9ms

Sep 25 06:09:53 sentient-slate systemd[9078]: Starting flatpak document portal service...
Sep 25 06:09:53 sentient-slate systemd[9078]: Started flatpak document portal service.
Sep 25 06:09:53 sentient-slate xdg-document-portal[21992]: fusermount3: failed to access mountpoint /run/user/1000/doc: Permission denied
Sep 25 06:09:53 sentient-slate xdg-document-portal[21984]: error: fuse init failed: Can't mount path /run/user/1000/doc
Sep 25 06:09:53 sentient-slate systemd[9078]: xdg-document-portal.service: Main process exited, code=exited, status=6/NOTCONFIGURED
Sep 25 06:09:53 sentient-slate systemd[9078]: xdg-document-portal.service: Failed with result 'exit-code'.
```
Comment 3 Soc Virnyl Estela 2023-09-24 22:22:39 UTC
So it's XDG Desktop Portal.

Old version 0.16.0 still uses libfuse2 (unmaintained)

Latest version 0.18.0 now uses libfuse3. So I guess it has something to do with the permission denied error?
Comment 4 Soc Virnyl Estela 2023-09-24 22:25:09 UTC
(In reply to Soc Virnyl Estela from comment #3)
> So it's XDG Desktop Portal.
> 
> Old version 0.16.0 still uses libfuse2 (unmaintained)
> 
> Latest version 0.18.0 now uses libfuse3. So I guess it has something to do
> with the permission denied error?

I might be wrong but I am going to look into this. Seems I was - https://github.com/flatpak/xdg-desktop-portal/pull/634

So I wonder what causes those permission denied errors
Comment 5 Soc Virnyl Estela 2023-09-25 02:41:15 UTC
Found a solution. It seems 0.18.0 requires manual configuration and expects desktop environments to have their own portals.conf as explained in https://github.com/flatpak/xdg-desktop-portal/issues/1077#issuecomment-1688007044

The workaround is to add a custom config like https://github.com/flatpak/xdg-desktop-portal/issues/1077#issuecomment-1715896552

I use river and tested that. It worked.
Comment 6 OBSbugzilla Bot 2023-09-25 04:35:04 UTC
This is an autogenerated message for OBS integration:
This bug (1215641) was mentioned in
https://build.opensuse.org/request/show/1113341 Factory / river
Comment 7 Soc Virnyl Estela 2023-09-25 22:13:13 UTC
With the new configuration requirements, desktop environments and packagers are expected to have in their best guesses, also add a portals.conf corresponding to that environment.
Comment 8 Maurizio Galli 2023-09-27 04:59:27 UTC
I have prepared a patched package [0] for Xfce with the drop-in file however it does not seem to work.

[0]https://build.opensuse.org/package/show/home:mauriziogalli:branches:X11:xfce/xfce4-session

flatpak applications still get errors such as `Args: No such interface “org.freedesktop.portal.FileChooser”`
Comment 9 Maurizio Galli 2023-09-28 05:50:12 UTC
I'm reopening this just so that can keep the tracker around till it's properly resolved
Comment 10 Maurizio Galli 2023-09-29 08:06:57 UTC
running this command at startup fixes the issue on Xfce:

systemctl --user import-environment XDG_CURRENT_DESKTOP && dbus-update-activation-environment --systemd XDG_CURRENT_DESKTOP && systemctl --user restart xdg-desktop-portal.service xdg-desktop-portal-gtk.service
Comment 11 Soc Virnyl Estela 2023-10-02 06:05:34 UTC
It's right to keep this open. So I will update this. Are there any desktop environments affected by this?

Checklist of resolved DEs/WMs:
- [X] RiverWM
- [X] SwayWM
- [X] Hyprland
- [ ] GNOME
- [ ] XFCE
- [ ] KDE Plasma

Please add more that you might find. XDP 0.18.x requires DEs/WMs to provide their own portals.conf.

Thanks!
Comment 12 Maurizio Galli 2023-10-03 05:53:24 UTC
(In reply to Soc Virnyl Estela from comment #11)
> It's right to keep this open. So I will update this. Are there any desktop
> environments affected by this?
> 

Xfce is still affected, I have created the drop-in conf file but there is more that is needed to make it work as described in comment #10.

I'm looking for a cleaner fix/workaround than having a bash script executing that command.
Comment 13 Fabian Vogt 2023-10-03 08:43:52 UTC
(In reply to Soc Virnyl Estela from comment #11)
> It's right to keep this open. So I will update this. Are there any desktop
> environments affected by this?
> 
> Checklist of resolved DEs/WMs:
> - [X] RiverWM
> - [X] SwayWM
> - [X] Hyprland
> - [ ] GNOME
> - [ ] XFCE
> - [ ] KDE Plasma
> 
> Please add more that you might find. XDP 0.18.x requires DEs/WMs to provide
> their own portals.conf.
> 
> Thanks!

Plasma ships /usr/share/xdg-desktop-portal/kde-portals.conf since 5.27.8.
Comment 14 Soc Virnyl Estela 2023-10-03 09:18:34 UTC
(In reply to Fabian Vogt from comment #13)
> (In reply to Soc Virnyl Estela from comment #11)
> > It's right to keep this open. So I will update this. Are there any desktop
> > environments affected by this?
> > 
> > Checklist of resolved DEs/WMs:
> > - [X] RiverWM
> > - [X] SwayWM
> > - [X] Hyprland
> > - [ ] GNOME
> > - [ ] XFCE
> > - [X] KDE Plasma
> > 
> > Please add more that you might find. XDP 0.18.x requires DEs/WMs to provide
> > their own portals.conf.
> > 
> > Thanks!
> 
> Plasma ships /usr/share/xdg-desktop-portal/kde-portals.conf since 5.27.8.

Cool
Comment 15 Soc Virnyl Estela 2023-10-08 09:01:02 UTC
I will help out with XFCE. I think I have an idea but not that sure.
Comment 16 Maurizio Galli 2023-10-26 07:33:42 UTC
(In reply to Soc Virnyl Estela from comment #15)
> I will help out with XFCE. I think I have an idea but not that sure.

Thanks, but I think I found a way around the issue: https://build.opensuse.org/request/show/1120482
Comment 17 Maurizio Galli 2023-10-31 00:46:58 UTC
Xfce is "fixed" too now although the solution implemented is not very elegant. If a better solution comes along then we will address it. and 

Also to my knowledge GNOME is fine so we can close this bug for now and reopen if needed.


Checklist of resolved DEs/WMs:
- [X] RiverWM
- [X] SwayWM
- [X] Hyprland
- [X] GNOME
- [X] XFCE
- [X] KDE Plasma
Comment 18 Soc Virnyl Estela 2023-10-31 10:01:26 UTC
I will add something in openSUSE wiki regarding portals. the list is *my list* that i made since i have experience using those environments. some users may want to use another portal impl other than the intended recommends e.g. xdp-wlr vs xdp-hyprland.

anyway thanks for resolving this. :)