flatpak / xdg-desktop-portal

Desktop integration portal
https://flatpak.github.io/xdg-desktop-portal/
GNU Lesser General Public License v2.1
605 stars 195 forks source link

[Bug]: "The folder contents could not be displayed" "Error" "/run/user/1000/doc/". Related to "xdg-document-portal". #1410

Open Francewhoa opened 7 months ago

Francewhoa commented 7 months ago

Checklist

Flatpak version

1.14.4

What Linux distribution are you using?

Debian

Linux distribution version

12 Bookworm. 6.1.0-18-amd64. Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux.

What architecture are you using?

x86_64

How to reproduce

  1. After a fresh reboot, use either LibreWolf 124.0.1-1 or Firefox 124.0.2 to print to a PDF file any web page. This works smooth and fine for now.

  2. Continue using the same device and apps above for multiple days without reboot. Do daily Flatpak updates without reboot.

  3. Until when you use either LibreWolf 124.0.1-1 or Firefox 124.0.2, when you print the same web page to a PDF.

    1. This error message is displayed:

      1. The folder contents could not be displayed Error[…] /run/user/1000/doc/ […]

        1. This screenshot below shows this error in French. With steps to reproduce.

        Screenshot-38---cropped

      2. This error message above is the first challenge. Then the PDF file creation failed. This is the second challenge.

The same challenge can be reproduced the other way around with an incoming file instead of an outgoing file. For example, but not limited to, using the same Flatpak apps, uploading a PNG file to any webpages. The upload failed without an error message displayed. The same workaround below temporarily resolved this challenge.

Using:

Expected Behavior

  1. Error message is not displayed.

  2. File is created. Such as, but not limited to PDF file.

Actual Behavior

  1. The error message is displayed

  2. Then the PDF file creation failed

Additional Information


Temporary Workaround

For those facing this challenge, the steps below temporary fixed this challenge. But the same challenge comes back after a few hours or days.

Steps:

  1. Using GNOME System Monitor or equivalent, kill this process xdg-document-portal

  2. Fully exit the Flatpak app. Including all its windows.

  3. Start the Flatpak app

  4. Error is gone


Related Ticket

bwrap: Can't find source path /run/user/1000/doc/by-app/com.spotify.Client: Permission denied flatpak/flatpak#5580

rkfg commented 6 months ago

Happens on 1.18.4-1 as well, Debian testing. Restarting the service with systemctl --user restart xdg-document-portal makes it work. It works for some time until it doesn't, there are no error messages in systemd's log (checked with journalctl --user --unit xdg-document-portal) except Ignoring invalid max threads value 4294967295 > max (100000). that's printed right after starting it.

This bug is very inconvenient and unpredictable. The root user can't access /run/user/1000/doc either when this happens. I overrode the launch command and added -v so hopefully when this happens next time (tomorrow?) there will be some info.

rkfg commented 6 months ago

Well, this is awkward...

May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: RELEASE d51fa1543a443a63
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: RELEASE d51fa1543a443a63
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: RELEASE 60d589f582bf7490
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: RELEASE d51fa1543a443a63
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: RELEASE 60d589f582bf7490
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: RELEASE d51fa1543a443a63
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: FORGET d51fa1543a443a63 53
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: FORGET 60d589f582bf7490 41
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: LOOKUP 1:by-app
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: LOOKUP 1:by-app => 2
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: LOOKUP 2:org.kde.krita
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: LOOKUP 2:org.kde.krita => 9
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: GETATTR 1
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: STATFS 1
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: STATFS -> error EPERM
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: GETATTR 1
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: GETATTR 1
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: ACCESS 1
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: LOOKUP 1:.Trash
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: LOOKUP -> error ENOENT
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: LOOKUP 1:.Trash-1000
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: LOOKUP -> error ENOENT
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: GETATTR 1
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: STATFS 1
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: STATFS -> error EPERM
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: GETATTR 1
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: GETATTR 1
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: DESTROY
May 26 21:05:47 homecomp xdg-document-portal[2513880]: XDP: fuse fs unmounted externally
May 26 21:05:47 homecomp systemd[14732]: xdg-document-portal.service: Main process exited, code=exited, status=21/n/a
May 26 21:05:47 homecomp systemd[14732]: xdg-document-portal.service: Failed with result 'exit-code'.
May 28 12:08:28 homecomp systemd[14732]: Starting xdg-document-portal.service - flatpak document portal service...
May 28 12:08:28 homecomp systemd[14732]: Started xdg-document-portal.service - flatpak document portal service.
May 28 12:08:28 homecomp xdg-document-portal[659814]: fusermount3: failed to access mountpoint /run/user/1000/doc: Permission denied
May 28 12:08:28 homecomp xdg-document-portal[659807]: error: fuse init failed: Can't mount path /run/user/1000/doc
May 28 12:08:28 homecomp xdg-document-portal[659807]: XDP: Providing portal org.freedesktop.portal.Documents
May 28 12:08:28 homecomp xdg-document-portal[659807]: XDP: Providing portal org.freedesktop.portal.FileTransfer
May 28 12:08:28 homecomp xdg-document-portal[659807]: XDP: org.freedesktop.portal.Documents acquired
May 28 12:08:28 homecomp systemd[14732]: xdg-document-portal.service: Main process exited, code=exited, status=6/NOTCONFIGURED
May 28 12:08:28 homecomp systemd[14732]: xdg-document-portal.service: Failed with result 'exit-code'.

The programs work for now but the unit doesn't start anymore. Also /usr/libexec/xdg-document-portal is running, no idea what started it exactly. Seems like something stopped the systemd service and started another instance instead. Any ideas what can cause XDP: fuse fs unmounted externally? I certainly didn't unmount that manually.

rkfg commented 5 months ago

It seems that xdg-document-portal launches automatically with every DBus instance which can cause problems when using dbus-launch. The problem here is that the second instance (using the other DBus) shadows the /run/user/1000/doc/ directory for the new flatpak processes ran with the main DBus instance. My setup is a little special but I need some processes to use a separate DBus instance. Before I started using Flatpak I had no issues with it. Theoretically, I don't need these xdg processes to run with DBus because I already have a systemd unit that starts them for me. It might be an issue if I ran flatpaks as another (not currently logged in) user but I don't do that.

Ferlinuxdebian commented 3 months ago

I am facing the same issue, see the output of the command (journalctl --user -b -u xdg-document-portal)

ago 05 10:59:53 fedora systemd[1976]: Starting xdg-document-portal.service - flatpak document portal service...
ago 05 10:59:53 fedora systemd[1976]: Started xdg-document-portal.service - flatpak document portal service.
ago 05 18:30:34 fedora systemd[1976]: Stopping xdg-document-portal.service - flatpak document portal service...
ago 05 18:30:34 fedora systemd[1976]: Stopped xdg-document-portal.service - flatpak document portal service.
ago 05 18:30:34 fedora systemd[1976]: Starting xdg-document-portal.service - flatpak document portal service...
ago 05 18:30:34 fedora systemd[1976]: Started xdg-document-portal.service - flatpak document portal service.
ago 05 18:31:06 fedora systemd[1976]: Stopping xdg-document-portal.service - flatpak document portal service...
ago 05 18:31:51 fedora systemd[1976]: xdg-document-portal.service: State 'stop-sigterm' timed out. Aborting.
ago 05 18:31:51 fedora systemd[1976]: xdg-document-portal.service: Killing process 34861 (xdg-document-po) with signal SIGABRT.
ago 05 18:31:51 fedora systemd-coredump[35071]: [🡕] Process 34861 (xdg-document-po) of user 1000 dumped core.

                                                Module libblkid.so.1 from rpm util-linux-2.40.1-1.fc40.x86_64
                                                Module libzstd.so.1 from rpm zstd-1.5.6-1.fc40.x86_64
                                                Module liblzma.so.5 from rpm xz-5.4.6-3.fc40.x86_64
                                                Module liblz4.so.1 from rpm lz4-1.9.4-6.fc40.x86_64
                                                Module libcap.so.2 from rpm libcap-2.69-8.fc40.x86_64
                                                Module libffi.so.8 from rpm libffi-3.4.4-7.fc40.x86_64
                                                Module libselinux.so.1 from rpm libselinux-3.6-4.fc40.x86_64
                                                Module libmount.so.1 from rpm util-linux-2.40.1-1.fc40.x86_64
                                                Module libz.so.1 from rpm zlib-ng-2.1.7-1.fc40.x86_64
                                                Module libgmodule-2.0.so.0 from rpm glib2-2.80.3-1.fc40.x86_64
                                                Module libpcre2-8.so.0 from rpm pcre2-10.44-1.fc40.x86_64
                                                Module libfuse3.so.3 from rpm fuse3-3.16.2-3.fc40.x86_64
                                                Module libsystemd.so.0 from rpm systemd-255.10-1.fc40.x86_64
                                                Module libgobject-2.0.so.0 from rpm glib2-2.80.3-1.fc40.x86_64
                                                Module libgio-2.0.so.0 from rpm glib2-2.80.3-1.fc40.x86_64
                                                Module libglib-2.0.so.0 from rpm glib2-2.80.3-1.fc40.x86_64
                                                Module xdg-document-portal from rpm xdg-desktop-portal-1.18.4-1.fc40.x86_64
                                                Stack trace of thread 34861:
                                                #0  0x00007fa5134cda53 clock_nanosleep@GLIBC_2.2.5 (libc.so.6 + 0xe3a53)
                                                flatpak/flatpak#1  0x00007fa5134d9a87 __nanosleep (libc.so.6 + 0xefa87)
                                                flatpak/flatpak#2  0x00007fa5139edf2e g_usleep (libglib-2.0.so.0 + 0x86f2e)
                                                flatpak/flatpak#3  0x00005637c615beda on_name_acquired (xdg-document-portal + 0x15eda)
                                                flatpak/flatpak#4  0x00007fa5138a38e5 do_call.lto_priv.0 (libgio-2.0.so.0 + 0x10b8e5)
                                                flatpak/flatpak#5  0x00007fa5138a3b27 on_name_lost_or_acquired (libgio-2.0.so.0 + 0x10bb27)
                                                flatpak/flatpak#6  0x00007fa51389ba90 emit_signal_instance_in_idle_cb (libgio-2.0.so.0 + 0x103a90)
                                                flatpak/flatpak#7  0x00007fa5139ca69d g_idle_dispatch (libglib-2.0.so.0 + 0x6369d)
                                                flatpak/flatpak#8  0x00007fa5139c3e8c g_main_context_dispatch_unlocked.lto_priv.0 (libglib-2.0.so.0 + 0x5ce8c)
                                                flatpak/flatpak#9  0x00007fa513a25c98 g_main_context_iterate_unlocked.isra.0 (libglib-2.0.so.0 + 0xbec98)
                                                flatpak/flatpak#10 0x00007fa5139c9f37 g_main_loop_run (libglib-2.0.so.0 + 0x62f37)
                                                flatpak/flatpak#11 0x00005637c6153b8d main (xdg-document-portal + 0xdb8d)
                                                flatpak/flatpak#12 0x00007fa513414088 __libc_start_call_main (libc.so.6 + 0x2a088)
                                                flatpak/flatpak#13 0x00007fa51341414b __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x2a14b)
                                                flatpak/flatpak#14 0x00005637c6153f05 _start (xdg-document-portal + 0xdf05)

                                                Stack trace of thread 34863:
                                                #0  0x00007fa5135031dd syscall (libc.so.6 + 0x1191dd)
                                                flatpak/flatpak#1  0x00007fa513a22ccd g_cond_wait (libglib-2.0.so.0 + 0xbbccd)
                                                flatpak/flatpak#2  0x00007fa51398e61b g_async_queue_pop_intern_unlocked (libglib-2.0.so.0 + 0x2761b)
                                                flatpak/flatpak#3  0x00007fa5139f5a03 g_thread_pool_spawn_thread (libglib-2.0.so.0 + 0x8ea03)
                                                flatpak/flatpak#4  0x00007fa5139f4813 g_thread_proxy (libglib-2.0.so.0 + 0x8d813)
                                                flatpak/flatpak#5  0x00007fa513481507 start_thread (libc.so.6 + 0x97507)
                                                flatpak/flatpak#6  0x00007fa51350540c __clone3 (libc.so.6 + 0x11b40c)

                                                Stack trace of thread 34864:
                                                #0  0x00007fa5134f767d __poll (libc.so.6 + 0x10d67d)
                                                flatpak/flatpak#1  0x00007fa513a25c34 g_main_context_iterate_unlocked.isra.0 (libglib-2.0.so.0 + 0xbec34)
                                                flatpak/flatpak#2  0x00007fa5139c5383 g_main_context_iteration (libglib-2.0.so.0 + 0x5e383)
                                                flatpak/flatpak#3  0x00007fa5139c53e1 glib_worker_main (libglib-2.0.so.0 + 0x5e3e1)
                                                flatpak/flatpak#4  0x00007fa5139f4813 g_thread_proxy (libglib-2.0.so.0 + 0x8d813)
                                                flatpak/flatpak#5  0x00007fa513481507 start_thread (libc.so.6 + 0x97507)
                                                flatpak/flatpak#6  0x00007fa51350540c __clone3 (libc.so.6 + 0x11b40c)

                                                Stack trace of thread 34865:
                                                #0  0x00007fa5134f767d __poll (libc.so.6 + 0x10d67d)
                                                flatpak/flatpak#1  0x00007fa513a25c34 g_main_context_iterate_unlocked.isra.0 (libglib-2.0.so.0 + 0xbec34)
                                                flatpak/flatpak#2  0x00007fa5139c9f37 g_main_loop_run (libglib-2.0.so.0 + 0x62f37)
                                                flatpak/flatpak#3  0x00007fa5138ad682 gdbus_shared_thread_func.lto_priv.0 (libgio-2.0.so.0 + 0x115682)
                                                flatpak/flatpak#4  0x00007fa5139f4813 g_thread_proxy (libglib-2.0.so.0 + 0x8d813)
                                                flatpak/flatpak#5  0x00007fa513481507 start_thread (libc.so.6 + 0x97507)
                                                flatpak/flatpak#6  0x00007fa51350540c __clone3 (libc.so.6 + 0x11b40c)
                                                ELF object binary architecture: AMD x86-64
ago 05 18:31:51 fedora systemd[1976]: xdg-document-portal.service: Main process exited, code=dumped, status=6/ABRT
ago 05 18:31:51 fedora systemd[1976]: xdg-document-portal.service: Failed with result 'timeout'.
ago 05 18:31:51 fedora systemd[1976]: Stopped xdg-document-portal.service - flatpak document portal service.
ago 05 18:31:51 fedora systemd[1976]: Starting xdg-document-portal.service - flatpak document portal service...
ago 05 18:31:51 fedora systemd[1976]: Started xdg-document-portal.service - flatpak document portal service.
ago 05 18:34:33 fedora systemd[1976]: Stopping xdg-document-portal.service - flatpak document portal service...
ago 05 18:35:18 fedora systemd[1976]: xdg-document-portal.service: State 'stop-sigterm' timed out. Aborting.
ago 05 18:35:18 fedora systemd[1976]: xdg-document-portal.service: Killing process 35084 (xdg-document-po) with signal SIGABRT.
ago 05 18:35:18 fedora systemd-coredump[35560]: [🡕] Process 35084 (xdg-document-po) of user 1000 dumped core.

                                                Module libblkid.so.1 from rpm util-linux-2.40.1-1.fc40.x86_64
                                                Module libzstd.so.1 from rpm zstd-1.5.6-1.fc40.x86_64
                                                Module liblzma.so.5 from rpm xz-5.4.6-3.fc40.x86_64
                                                Module liblz4.so.1 from rpm lz4-1.9.4-6.fc40.x86_64
                                                Module libcap.so.2 from rpm libcap-2.69-8.fc40.x86_64
                                                Module libffi.so.8 from rpm libffi-3.4.4-7.fc40.x86_64
                                                Module libselinux.so.1 from rpm libselinux-3.6-4.fc40.x86_64
                                                Module libmount.so.1 from rpm util-linux-2.40.1-1.fc40.x86_64
                                                Module libz.so.1 from rpm zlib-ng-2.1.7-1.fc40.x86_64
                                                Module libgmodule-2.0.so.0 from rpm glib2-2.80.3-1.fc40.x86_64
                                                Module libpcre2-8.so.0 from rpm pcre2-10.44-1.fc40.x86_64
                                                Module libfuse3.so.3 from rpm fuse3-3.16.2-3.fc40.x86_64
                                                Module libsystemd.so.0 from rpm systemd-255.10-1.fc40.x86_64
                                                Module libgobject-2.0.so.0 from rpm glib2-2.80.3-1.fc40.x86_64
                                                Module libgio-2.0.so.0 from rpm glib2-2.80.3-1.fc40.x86_64
                                                Module libglib-2.0.so.0 from rpm glib2-2.80.3-1.fc40.x86_64
                                                Module xdg-document-portal from rpm xdg-desktop-portal-1.18.4-1.fc40.x86_64
                                                Stack trace of thread 35084:
                                                #0  0x00007fd1bd1d1a53 clock_nanosleep@GLIBC_2.2.5 (libc.so.6 + 0xe3a53)
                                                flatpak/flatpak#1  0x00007fd1bd1dda87 __nanosleep (libc.so.6 + 0xefa87)
                                                flatpak/flatpak#2  0x00007fd1bd6f1f2e g_usleep (libglib-2.0.so.0 + 0x86f2e)
                                                flatpak/flatpak#3  0x0000555dfe348eda on_name_acquired (xdg-document-portal + 0x15eda)
                                                flatpak/flatpak#4  0x00007fd1bd5a78e5 do_call.lto_priv.0 (libgio-2.0.so.0 + 0x10b8e5)
                                                flatpak/flatpak#5  0x00007fd1bd5a7b27 on_name_lost_or_acquired (libgio-2.0.so.0 + 0x10bb27)
                                                flatpak/flatpak#6  0x00007fd1bd59fa90 emit_signal_instance_in_idle_cb (libgio-2.0.so.0 + 0x103a90)
                                                flatpak/flatpak#7  0x00007fd1bd6ce69d g_idle_dispatch (libglib-2.0.so.0 + 0x6369d)
                                                flatpak/flatpak#8  0x00007fd1bd6c7e8c g_main_context_dispatch_unlocked.lto_priv.0 (libglib-2.0.so.0 + 0x5ce8c)
                                                flatpak/flatpak#9  0x00007fd1bd729c98 g_main_context_iterate_unlocked.isra.0 (libglib-2.0.so.0 + 0xbec98)
                                                flatpak/flatpak#10 0x00007fd1bd6cdf37 g_main_loop_run (libglib-2.0.so.0 + 0x62f37)
                                                flatpak/flatpak#11 0x0000555dfe340b8d main (xdg-document-portal + 0xdb8d)
                                                flatpak/flatpak#12 0x00007fd1bd118088 __libc_start_call_main (libc.so.6 + 0x2a088)
                                                flatpak/flatpak#13 0x00007fd1bd11814b __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x2a14b)
                                                flatpak/flatpak#14 0x0000555dfe340f05 _start (xdg-document-portal + 0xdf05)

                                                Stack trace of thread 35098:
                                                #0  0x00007fd1bd2071dd syscall (libc.so.6 + 0x1191dd)
                                                flatpak/flatpak#1  0x00007fd1bd726ccd g_cond_wait (libglib-2.0.so.0 + 0xbbccd)
                                                flatpak/flatpak#2  0x00007fd1bd69261b g_async_queue_pop_intern_unlocked (libglib-2.0.so.0 + 0x2761b)
                                                flatpak/flatpak#3  0x00007fd1bd6f9a03 g_thread_pool_spawn_thread (libglib-2.0.so.0 + 0x8ea03)
                                                flatpak/flatpak#4  0x00007fd1bd6f8813 g_thread_proxy (libglib-2.0.so.0 + 0x8d813)
                                                flatpak/flatpak#5  0x00007fd1bd185507 start_thread (libc.so.6 + 0x97507)
                                                flatpak/flatpak#6  0x00007fd1bd20940c __clone3 (libc.so.6 + 0x11b40c)

                                                Stack trace of thread 35099:
                                                #0  0x00007fd1bd1fb67d __poll (libc.so.6 + 0x10d67d)
                                                flatpak/flatpak#1  0x00007fd1bd729c34 g_main_context_iterate_unlocked.isra.0 (libglib-2.0.so.0 + 0xbec34)
                                                flatpak/flatpak#2  0x00007fd1bd6c9383 g_main_context_iteration (libglib-2.0.so.0 + 0x5e383)
                                                flatpak/flatpak#3  0x00007fd1bd6c93e1 glib_worker_main (libglib-2.0.so.0 + 0x5e3e1)
                                                flatpak/flatpak#4  0x00007fd1bd6f8813 g_thread_proxy (libglib-2.0.so.0 + 0x8d813)
                                                flatpak/flatpak#5  0x00007fd1bd185507 start_thread (libc.so.6 + 0x97507)
                                                flatpak/flatpak#6  0x00007fd1bd20940c __clone3 (libc.so.6 + 0x11b40c)

                                                Stack trace of thread 35100:
                                                #0  0x00007fd1bd1fb67d __poll (libc.so.6 + 0x10d67d)
                                                flatpak/flatpak#1  0x00007fd1bd729c34 g_main_context_iterate_unlocked.isra.0 (libglib-2.0.so.0 + 0xbec34)
                                                flatpak/flatpak#2  0x00007fd1bd6cdf37 g_main_loop_run (libglib-2.0.so.0 + 0x62f37)
                                                flatpak/flatpak#3  0x00007fd1bd5b1682 gdbus_shared_thread_func.lto_priv.0 (libgio-2.0.so.0 + 0x115682)
                                                flatpak/flatpak#4  0x00007fd1bd6f8813 g_thread_proxy (libglib-2.0.so.0 + 0x8d813)
                                                flatpak/flatpak#5  0x00007fd1bd185507 start_thread (libc.so.6 + 0x97507)
                                                flatpak/flatpak#6  0x00007fd1bd20940c __clone3 (libc.so.6 + 0x11b40c)
                                                ELF object binary architecture: AMD x86-64
ago 05 18:35:18 fedora systemd[1976]: xdg-document-portal.service: Main process exited, code=dumped, status=6/ABRT
ago 05 18:35:18 fedora systemd[1976]: xdg-document-portal.service: Failed with result 'timeout'.
ago 05 18:35:18 fedora systemd[1976]: Stopped xdg-document-portal.service - flatpak document portal service.
ago 05 18:35:18 fedora systemd[1976]: Starting xdg-document-portal.service - flatpak document portal service...
ago 05 18:35:18 fedora systemd[1976]: Started xdg-document-portal.service - flatpak document portal service.