unlimitedbacon/stl-thumb

"Failed to initialize any backend" in Nautilus on Fedora 32

smunkel opened this issue · 9 comments

I've been spending some time trying to get this to work with Nautilus on Fedora 32, and I've been having some difficulty. I copied the stl-thumb-mime.xml and stl-thumb.thumbnailer files into the proper directories, and it seems that the thumbnails are failing. I check ~/.cache/thumbnails and it confirms that stl-thumb is indeed failing.
I tried to run the program directly using the same arguments found in stl-thumb.thumbnailer, and it was a success.
Moving on from there I turned on debug logging in nautilus and enabled the full rust backtrace and I get the following:

thread 'main' panicked at 'Failed to initialize any backend!
    Wayland status: NoCompositorListening
    X11 status: XOpenDisplayFailed
', /home/smunkel/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.17.1/src/platform/linux/mod.rs:439:9
stack backtrace:
   0:     0x563641aefb7b - backtrace::backtrace::libunwind::trace::h89fcc71e59e3bc5b
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1:     0x563641aefb7b - backtrace::backtrace::trace_unsynchronized::h0bad9be1379e729a
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2:     0x563641aefb7b - std::sys_common::backtrace::_print::hd3382a1f33c473da
                               at src/libstd/sys_common/backtrace.rs:47
   3:     0x563641aefb7b - std::sys_common::backtrace::print::h0ec6f03cfb8e76a6
                               at src/libstd/sys_common/backtrace.rs:36
   4:     0x563641aefb7b - std::panicking::default_hook::{{closure}}::h96cbf7b454e3f557
                               at src/libstd/panicking.rs:200
   5:     0x563641aef856 - std::panicking::default_hook::h95a8f00337383d83
                               at src/libstd/panicking.rs:214
   6:     0x563641af02ed - std::panicking::rust_panic_with_hook::h92f98b46e22f14ed
                               at src/libstd/panicking.rs:477
   7:     0x56364182a9e5 - std::panicking::begin_panic::hd2cf872e4231bce0
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panicking.rs:411
   8:     0x563641845db2 - winit::platform::platform::EventsLoop::new::h757b1b855a4b3276
                               at /home/smunkel/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.17.1/src/platform/linux/mod.rs:439
   9:     0x5636418a25c0 - winit::EventsLoop::new::he7d686194f608ef4
                               at /home/smunkel/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.17.1/src/lib.rs:207
  10:     0x563641283e4e - stl_thumb::create_normal_display::h54984bd35032c2b1
                               at src/lib.rs:47
  11:     0x5636412857f8 - stl_thumb::run::h198625ed6d48084b
                               at src/lib.rs:281
  12:     0x563641281f5b - stl_thumb::main::h8168c320fa2546a6
                               at src/main.rs:36
  13:     0x563641281440 - std::rt::lang_start::{{closure}}::h948c1248301db095
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  14:     0x563641aefcf3 - std::rt::lang_start_internal::{{closure}}::h4e93c1949c7a1955
                               at src/libstd/rt.rs:49
  15:     0x563641aefcf3 - std::panicking::try::do_call::h9440ccd4dc467eaa
                               at src/libstd/panicking.rs:296
  16:     0x563641af230a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  17:     0x563641af07fd - std::panicking::try::hc046e7ee42ee744f
                               at src/libstd/panicking.rs:275
  18:     0x563641af07fd - std::panic::catch_unwind::h27dfc457c200aee0
                               at src/libstd/panic.rs:394
  19:     0x563641af07fd - std::rt::lang_start_internal::hea1b49a567afe309
                               at src/libstd/rt.rs:48
  20:     0x563641281419 - std::rt::lang_start::hf88e3fb35de2b0de
                               at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/rt.rs:64
  21:     0x5636412822ca - main
  22:     0x7f2544419042 - __libc_start_main
  23:     0x56364128122e - _start
  24:                0x0 - <unknown>

I suspect something weird is going on with Gnome's sandboxing of thumbnailers. Can you also try running with the -vvv option and post the output from that?

I recompiled to remove some of my debugging code, and it reveals a different error.

\u001b[0m\u001b[0m\u001b[33mINFO - Thumbnail File: /tmp/gnome-desktop-thumbnailer.png

\u001b[0m\u001b[0m\u001b[33mINFO - Bounds:
\u001b[0m\u001b[0m\u001b[33mINFO - X: -0.000018119812, 14.000017
Y: 0.004593849, 20.554962
Z: 0.000068463385, 3.6100078

\u001b[0m\u001b[0m\u001b[33mINFO - Center:	Point3 [6.9999995, 10.279778, 1.8050381]
\u001b[0m\u001b[0m\u001b[33mINFO - Triangles processed:	80954

\u001b[0m\u001b[0m\u001b[35mWARN - Unable to create headless GL context. Trying hidden window instead. Reason: NoBackendAvailable(LoadingError("LibraryNotFound { descr: \"libOSMesa.so: cannot open shared object file: No such file or directory\" }"))
\u001b[0mthread 'main' panicked at 'attempted to leave type `std::mem::ManuallyDrop<xlib_xcb::Xlib_xcb>` uninitialized, which is invalid', /home/smunkel/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/mem/mod.rs:664:9
stack backtrace:
   0:     0x55f6c8830ae5 - backtrace::backtrace::libunwind::trace::h14d338b30b3ea0a7
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1:     0x55f6c8830ae5 - backtrace::backtrace::trace_unsynchronized::h73ea91d74a3fd67f
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2:     0x55f6c8830ae5 - std::sys_common::backtrace::_print_fmt::hd42948c952866e12
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x55f6c8830ae5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha8f928866ff7571e
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x55f6c88562cc - core::fmt::write::he0c1e5f7426d2718
                               at src/libcore/fmt/mod.rs:1076
   5:     0x55f6c882de02 - std::io::Write::write_fmt::hf3afc6cfd57d0033
                               at src/libstd/io/mod.rs:1537
   6:     0x55f6c8832fa0 - std::sys_common::backtrace::_print::hfc0110703f3696fd
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x55f6c8832fa0 - std::sys_common::backtrace::print::h3f77c6990ddfaa22
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x55f6c8832fa0 - std::panicking::default_hook::{{closure}}::heae49580a8d62d75
                               at src/libstd/panicking.rs:198
   9:     0x55f6c8832cec - std::panicking::default_hook::hecc34e3f729e213c
                               at src/libstd/panicking.rs:217
  10:     0x55f6c88335e3 - std::panicking::rust_panic_with_hook::he82f5d0644692441
                               at src/libstd/panicking.rs:526
  11:     0x55f6c88331db - rust_begin_unwind
                               at src/libstd/panicking.rs:437
  12:     0x55f6c8854231 - core::panicking::panic_fmt::h09c929f06bb87c98
                               at src/libcore/panicking.rs:85
  13:     0x55f6c885417d - core::panicking::panic::h7ece43057e5422d4
                               at src/libcore/panicking.rs:50
  14:     0x55f6c8802e6b - x11_dl::xlib_xcb::Xlib_xcb::open::h3f04ce7d424b4bfe
  15:     0x55f6c8773f83 - winit::platform::platform::x11::xdisplay::XConnection::new::h44590ae7d05debb9
  16:     0x55f6c879f248 - std::sync::once::Once::call_once::{{closure}}::h64ec508c3d071c29
  17:     0x55f6c88303ba - std::sync::once::Once::call_inner::h65ff97b0ed20a605
                               at src/libstd/sync/once.rs:416
  18:     0x55f6c877eccd - winit::platform::platform::EventsLoop::new_x11::hef02761b7e698470
  19:     0x55f6c877e39b - winit::platform::platform::EventsLoop::new::h1aa34825847594fb
  20:     0x55f6c879783a - winit::EventsLoop::new::h0672404bd0cb8579
  21:     0x55f6c863d918 - stl_thumb::create_normal_display::h5ca37cefb44bbeb0
  22:     0x55f6c863f926 - stl_thumb::run::hd03174727ace8ae6
  23:     0x55f6c8631c4b - stl_thumb::main::h08d2073ac9554c21
  24:     0x55f6c8631473 - std::rt::lang_start::{{closure}}::h96a272f78ee05369
  25:     0x55f6c88339b3 - std::rt::lang_start_internal::{{closure}}::h5d3ea623498f5f43
                               at src/libstd/rt.rs:52
  26:     0x55f6c88339b3 - std::panicking::try::do_call::hac65e71be769a440
                               at src/libstd/panicking.rs:348
  27:     0x55f6c88339b3 - std::panicking::try::hd4706e264bcf6712
                               at src/libstd/panicking.rs:325
  28:     0x55f6c88339b3 - std::panic::catch_unwind::h948a0fb4a8b3ee82
                               at src/libstd/panic.rs:394
  29:     0x55f6c88339b3 - std::rt::lang_start_internal::h72cc068ed2d0ac53
                               at src/libstd/rt.rs:51
  30:     0x55f6c8631de2 - main
  31:     0x7f41f72ff042 - __libc_start_main
  32:     0x55f6c863129e - _start
  33:                0x0 - <unknown>

Going off the binary from the latest deb release I get this:

(org.gnome.Nautilus:3667): GnomeDesktop-DEBUG: 00:12:38.662: Failed to launch script: \u001b[0m\u001b[33mINFO - STL File: /tmp/clip.stl
\u001b[0m\u001b[0m\u001b[33mINFO - Thumbnail File: /tmp/gnome-desktop-thumbnailer.png

\u001b[0m\u001b[0m\u001b[33mINFO - Bounds:
\u001b[0m\u001b[0m\u001b[33mINFO - X: -0.000018119812, 14.000017
Y: 0.004593849, 20.554962
Z: 0.000068463385, 3.6100078

\u001b[0m\u001b[0m\u001b[33mINFO - Center:	Point3 [6.9999995, 10.279778, 1.8050381]
\u001b[0m\u001b[0m\u001b[33mINFO - Triangles processed:	80954

\u001b[0m\u001b[0m\u001b[35mWARN - Unable to create headless GL context. Trying hidden window instead. Reason: NoBackendAvailable(LoadingError("LibraryNotFound { descr: \"libOSMesa.so: cannot open shared object file: No such file or directory\" }"))
\u001b[0mthread 'main' panicked at 'Failed to initialize any backend!
    Wayland status: NoCompositorListening
    X11 status: XOpenDisplayFailed
', /home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.17.1/src/platform/linux/mod.rs:439:9
stack backtrace:
   0:     0x5583aaaa9233 - <unknown>
   1:     0x5583aaaa4da8 - <unknown>
   2:     0x5583aaaa7ed2 - <unknown>
   3:     0x5583aaaa7c44 - <unknown>
   4:     0x5583aaaa85e0 - std::panicking::rust_panic_with_hook::h744417edfe714d72
   5:     0x5583aaa060e9 - <unknown>
   6:     0x5583aa9dc8e5 - <unknown>
   7:     0x5583aaa13679 - winit::EventsLoop::new::ha4b3b1fc6350931d
   8:     0x5583aa88e0c7 - <unknown>
   9:     0x5583aa890ae2 - stl_thumb::run::h86577793da3809f6
  10:     0x5583aa881d45 - <unknown>
  11:     0x5583aa881382 - <unknown>
  12:     0x5583aaaa7fe2 - <unknown>
  13:     0x5583aaaaaf09 - __rust_maybe_catch_panic
  14:     0x5583aaaa8b35 - std::rt::lang_start_internal::he0d8d06abc6f912f
  15:     0x5583aa881ed1 - <unknown>
  16:     0x7f373a7e9041 - __libc_start_main
  17:     0x5583aa8810e8 - <unknown>
  18:                0x0 - <unknown>

This is the problem, in both cases.

WARN - Unable to create headless GL context. Trying hidden window instead.
Reason: NoBackendAvailable(LoadingError("LibraryNotFound { descr: \"libOSMesa.so: cannot open shared object file: No such file or directory\" }"))

We'll need to find out why libOSMesa.so is not available.

I had a similar problem on Fedora 33.

My backtrace after manually unpacking stl-thumb_0.3.1_amd64.deb and moving the files into place is.

Failed to launch script: thread 'main' panicked at 'Failed to initialize any backend!
    Wayland status: NoCompositorListening
    X11 status: XOpenDisplayFailed
', /home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.17.1/src/platform/linux/mod.rs:439:9
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: std::panicking::rust_panic_with_hook
   5: <unknown>
   6: <unknown>
   7: winit::EventsLoop::new
   8: <unknown>
   9: stl_thumb::run
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: __rust_maybe_catch_panic
  14: std::rt::lang_start_internal
  15: <unknown>
  16: __libc_start_main
  17: <unknown>

Running G_MESSAGES_DEBUG=all nautilus reveals log lines like

bwrap --ro-bind /usr /usr --ro-bind /etc/ld.so.cache /etc/ld.so.cache --symlink /usr//bin /bin --symlink /usr//lib64 /lib64 --symlink /usr//lib /lib --symlink /usr//sbin /sbin --ro-bind-try /etc/alternatives /etc/alternatives --proc /proc --dev /dev --chdir / --setenv GIO_USE_VFS local --unshare-all --die-with-parent --setenv G_MESSAGES_DEBUG all --bind /tmp/gnome-desktop-thumbnailer-9RSZ10 /tmp --ro-bind /home/user/my.stl /tmp/my.stl --seccomp 28 stl-thumb -f png -s 256 /tmp/my.stl /tmp/gnome-desktop-thumbnailer.png

creating a bwrap wrapper that removes --unshare-all makes thumbnails work but is probably not the wisest decision.

It's working fine in Nautils 40 running on Arch.

For comparison, here is the bwrap command:

bwrap --ro-bind /usr /usr --ro-bind /etc/ld.so.cache /etc/ld.so.cache --symlink /usr//bin /bin --symlink /usr//lib64 /lib64 --symlink /usr//lib /lib --symlink /usr//sbin /sbin --ro-bind-try /var/cache/fontconfig /var/cache/fontconfig --setenv GST_REGISTRY_1_0 /home/neo/.cache/gnome-desktop-thumbnailer/gstreamer-1.0/gstreamer-1.0.registry --bind /home/neo/.cache/gnome-desktop-thumbnailer/gstreamer-1.0 /home/neo/.cache/gnome-desktop-thumbnailer/gstreamer-1.0 --ro-bind-try /etc/alternatives /etc/alternatives --proc /proc --dev /dev --chdir / --setenv GIO_USE_VFS local --unshare-all --die-with-parent --setenv G_MESSAGES_DEBUG all --bind /tmp/gnome-desktop-thumbnailer-HCC510 /tmp --ro-bind /home/neo/Code/stl-thumb/test_data/sphere.stl /tmp/sphere.stl --seccomp 12 stl-thumb -f png -s 256 /tmp/sphere.stl /tmp/gnome-desktop-thumbnailer.png

Arch has some gstreamer stuff in the command, but I don't see how that would make a difference.

Are you guys sure that you have the mesa-libosmesa package installed?

mesa-libOSMesa is installed and when removing --unshare-all it does work.
I just did some testing and it appears replacing --unshare-all with --unshare-user-try --unshare-ipc --unshare-pid --unshare-uts --unshare-cgroup-try also works which means --unshare-net is the culprit.

Ok. Networking should not be required for running OpenGL. I don't know enough about Bubblewrap to know what could be going on here. Its probably worth filing a bug upstream somewhere, although I'm not sure if that should be with Fedora or Bubblewrap.

hello :)
I am facing that same issue and i was wondering if they was a work around found ?
I'm running Fedora 36.


(org.gnome.Nautilus:30510): GnomeDesktop-DEBUG: 17:57:50.768: Failed to launch script: INFO - STL File: /tmp/sphere.stl
INFO - IMG File: /tmp/gnome-desktop-thumbnailer.png
INFO - Bounds:
INFO - X: -60.53462, 17.89509
Y: -49.31432, 28.96064
Z: -39.37008, 39.37008

INFO - Center:	Point3 [-21.319763, -10.17684, 0.0]
INFO - Triangles processed:	550

thread 'main' panicked at 'Failed to initialize any backend! Wayland status: NoCompositorListening X11 status: XOpenDisplayFailed', /home/vaarlion/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/mod.rs:619:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
WARN - No Wayland or X server. Falling back to osmesa software rendering. Reason Any { .. }
WARN - Unable to create headless GL context. Trying hidden window instead. Reason: NoBackendAvailable(LoadingError("LibraryNotFound { descr: \"libOSMesa.so: cannot open shared object file: No such file or directory\" }"))
thread 'main' panicked at 'Failed to initialize any backend! Wayland status: NoCompositorListening X11 status: XOpenDisplayFailed', /home/vaarlion/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/mod.rs:619:9

(org.gnome.Nautilus:30510): GnomeDesktop-DEBUG: 17:57:50.768: Thumbnail script ('stl-thumb -vvv -f png -s %s %i %o') failed for 'file:///home/vaarlion/Documents/Dev/stl-thumb/test_data/sphere.stl': Child process exited with code 101

Look to be fixed with Fedora 37