Qt (python) snap crashes on load or save with apparmor denials

I have a python based qt desktop application snapped with the config below. It appears to run normally but when I try to save or load a file it segfaults with error below in dmesg. Perhaps I am missing an interface?

base: core18
grade: stable
confinement: strict
icon: snap/gui/icon.png

apps:
  tablexplore:
    command: desktop-launch $SNAP/bin/tablexplore
    extensions:
      - kde-neon
    plugs:
      - home
      - opengl
      - network
      - network-bind

parts:
  tablexplore:
    plugin: python
    source: .
    stage-packages:
        - xsel

Errors:

Jan  7 10:59:11 ubvm kernel: [ 8904.610474] audit: type=1400 audit(1610017151.836:419): apparmor="DENIED" operation="open" profile="snap.tablexplore.tablexplore" name="/proc/100627/mounts" pid=100627 comm="python3" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Jan  7 10:59:12 ubvm dbus-daemon[1006]: apparmor="DENIED" operation="dbus_method_call"  bus="session" path="/org/a11y/bus" interface="org.freedesktop.DBus.Properties" member="Get" mask="send" name="org.a11y.Bus" pid=100627 label="snap.tablexplore.tablexplore" peer_pid=1246 peer_label="unconfined"
Jan  7 10:59:15 ubvm kernel: [ 8908.100426] traps: python3[100627] general protection fault ip:7f978ea146b6 sp:7ffd4fffdeb8 error:0 in libc-2.27.so[7f978e963000+1e7000]
Jan  7 10:59:12 ubvm dbus-daemon[1006]: apparmor="DENIED" operation="dbus_method_call"  bus="session" path="/org/a11y/bus" interface="org.freedesktop.DBus.Properties" member="Get" mask="send" name="org.a11y.Bus" pid=100627 label="snap.tablexplore.tablexplore" peer_pid=1246 peer_label="unconfined"

Hello! I am the opposite of an expert, but at the moment I have similar issues, albeit apparently with a different interface.

Have you perhaps already tried the snappy-debug tool to intercept the problems? In my case it gave useful recommendations on top of filtering for the AppArmor denials, i.e. told me which interfaces needed to be connected (the reasons I am yet to comprehend though :slight_smile:
).

1 Like

You need mount-observe plug for this to go away:

apparmor="DENIED" operation="open" 
profile="snap.tablexplore.tablexplore" name="/proc/100627/mounts"
pid=100627 comm="python3" 
requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

It’d be interesting to see what snappy-debug suggest, but this:

apparmor="DENIED"  operation="dbus_method_call"
 bus="session" path="/org/a11y/bus" 
interface="org.freedesktop.DBus.Properties" member="Get"
 mask="send"  name="org.a11y.Bus" pid=100627 
label="snap.tablexplore.tablexplore" peer_pid=1246
 peer_label="unconfined"

does not seem to be covered by the desktop interface (cc @jdstrand @alexmurray) but likely should.

This one is weird, SIGTRAP in libc?

Jan  7 10:59:15 ubvm kernel: [ 8908.100426] traps: python3[100627] 
general protection fault ip:7f978ea146b6 sp:7ffd4fffdeb8 error:0
 in libc-2.27.so[7f978e963000+1e7000]

I added the network-control and mount-observe plugs though still get this from snappy-debug:
(no suggestion for the dbus_method_call denial)

INFO: $ sudo journalctl --output=short --follow --all | sudo snappy-debug
= AppArmor =
Time: Jan  8 10:13:12
Log: apparmor="DENIED" operation="open" profile="snap.tablexplore.tablexplore" name="/proc/108067/mounts" pid=108067 comm="python3" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
File: /proc/108067/mounts (read)
Suggestions:
* adjust program to not access '@{PROC}/@{pid}/mounts'
* add one of 'mount-observe, network-control' to 'plugs'

= AppArmor =
Time: Jan  8 10:13:13
Log: apparmor="DENIED" operation="dbus_method_call"  bus="session" path="/org/a11y/bus" interface="org.freedesktop.DBus.Properties" member="Get" mask="send" name="org.a11y.Bus" pid=108067 label="snap.tablexplore.tablexplore" peer_pid=1246 peer_label="unconfined"
DBus access

It also still crashes when I try to save. Strangely it works ok in Ubuntu 20.10, the machine I built the snap on. But when I try it on Ubuntu Mate it fails with the same SIGTRAP:

[43412.495753] traps: python3[108067] general protection fault ip:7f394bbd2426 sp:7ffdb558bb98 error:0 in libc-2.27.so[7f394bb21000+1e7000

I don’t know if it helps, only in case it’s a blocker whilst there’s some urgency, maybe try building on core18? It might make a difference, seems more mature (at least in that it supports some of the plugs I needed while core20 doesn’t/didn’t at the time, but I guess in turn it should be more tested in practice too).

(Ended up building on a dedicated Ubuntu 18 for this reason.)

Access to the accessibility bus is currently part of desktop-legacy. It’s not part of desktop because it is was not designed with confinement in mind: in particular it doesn’t distinguish between applications (that want to publish information about their UI and be controlled) and accessibility tools (that want to inspect applications and control them).

I would be surprised if lack of access to this bus is the cause of the segfault though.

Yes I did build on core18. It seems the kde-neon plug is still not supported for core20 so it’s not possible to use it for this.

1 Like

(Sorry I most probably confused it with another thread… the one that has core20 in the title. kde-neon was the strongest motivator for me too to revert to core18. Shutting up & good luck! I’ll likely need file access in a few weeks’ time too…)

I tried building on a 20.04 machine instead and the snap still seqfaults upon file dialog open/save. I was mistaken thinking it was ok on 20.10. It crashes on that too. The url for the project is https://github.com/dmnfarrell/tablexplore if any developer has time to try and test this.

It’s hard to give any advice without knowing why it is segfaulting. You could try running the app using --experimental-gdbserver as described in the following doc, and see if you can capture a stack trace of the crash:

Thanks, I tried this and this is the end of the gdb output. I guess it’s not that informative.

Reading /usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqtiff.so.debug from remote target...
Reading target:/usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqtiff.so.debug from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwbmp.so from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwbmp.so.debug from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/.debug/libqwbmp.so.debug from remote target...
Reading /usr/lib/debug//snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwbmp.so.debug from remote target...
Reading /usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqwbmp.so.debug from remote target...
Reading target:/usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqwbmp.so.debug from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwebp.so from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwebp.so.debug from remote target...
Reading /snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/.debug/libqwebp.so.debug from remote target...
Reading /usr/lib/debug//snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats/libqwebp.so.debug from remote target...
Reading /usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqwebp.so.debug from remote target...
Reading target:/usr/lib/debug/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/plugins/imageformats//libqwebp.so.debug from remote target...
[Detaching after fork from child process 12920]
[Detaching after fork from child process 12921]
[New Thread 12797.12917]
[New Thread 12797.12918]
[New Thread 12797.12919]

Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
0x00007f8e3ec27426 in ?? () from target:/lib/x86_64-linux-gnu/libc.so.6
(gdb) cont
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
1 Like

Rather than trying to continue from the segfault, try running the following commands:

set pagination off
thread apply all bt

The first will stop gdb from stopping for each screen full of data, and the second will produce a back trace for every thread in the program. This will probably be quite a lot of information, so perhaps use paste.ubuntu.com to save the output and then include the URL to the paste here.

1 Like

Ok thanks. traceback is here: https://paste.ubuntu.com/p/rDzx9BdjWt/

Are you able to do the thread apply all bt command after you get the segfault? In the paste, it looks like you produced a backtrace before the program segfaulted, which isn’t particularly interesting.

The idea is to find out what the program was doing at the point it generated the segfault.

Yes sorry I was using it wrong. Here’s the trace after the segfault:

(gdb) thread apply all bt

Thread 4 (Thread 15525.15625):
#0  0x00007f1674b1acb9 in poll () from target:/lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f166080e5c9 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f166080e6dc in g_main_context_iteration () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f1663c321cc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#4  0x00007f1663bd521a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#5  0x00007f16639eb844 in QThread::exec() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#6  0x00007f1657d1ffd5 in QDBusConnectionManager::run() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5DBus.so.5
#7  0x00007f16639ecb35 in QThreadPrivate::start(void*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#8  0x00007f16747ee6db in start_thread () from target:/lib/x86_64-linux-gnu/libpthread.so.0
#9  0x00007f1674b2771f in clone () from target:/lib/x86_64-linux-gnu/libc.so.6

Thread 3 (Thread 15525.15624):
#0  0x00007f16747f4fb9 in pthread_cond_timedwait@@GLIBC_2.3.2 () from target:/lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f16639f35a4 in QWaitCondition::wait(QMutex*, QDeadlineTimer) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#2  0x00007f16639f08d1 in QThreadPoolThread::run() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#3  0x00007f16639ecb35 in QThreadPrivate::start(void*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#4  0x00007f16747ee6db in start_thread () from target:/lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007f1674b2771f in clone () from target:/lib/x86_64-linux-gnu/libc.so.6

Thread 2 (Thread 15525.15623):
#0  0x00007f1674b1acb9 in poll () from target:/lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f165d6b6747 in ?? () from target:/snap/tablexplore/x1/usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007f165d6b836a in xcb_wait_for_event () from target:/snap/tablexplore/x1/usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007f16584f37b0 in QXcbEventQueue::run() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5XcbQpa.so.5
#4  0x00007f16639ecb35 in QThreadPrivate::start(void*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#5  0x00007f16747ee6db in start_thread () from target:/lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007f1674b2771f in clone () from target:/lib/x86_64-linux-gnu/libc.so.6

Thread 1 (Thread 15525.15525):
#0  0x00007f1674ab7426 in ?? () from target:/lib/x86_64-linux-gnu/libc.so.6
#1  0x00007f164f9e9138 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqxdgdesktopportal.so
#2  0x00007f164f9e9bf0 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqxdgdesktopportal.so
#3  0x00007f165c0140d0 in QDialogPrivate::setNativeDialogVisible(bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#4  0x00007f165c025eb2 in QFileDialog::setVisible(bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#5  0x00007f165c014ef1 in QDialog::exec() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#6  0x00007f165c027361 in QFileDialog::getSaveFileUrl(QWidget*, QString const&, QUrl const&, QString const&, QString*, QFlags<QFileDialog::Option>, QStringList const&) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#7  0x00007f165c0274bf in QFileDialog::getSaveFileName(QWidget*, QString const&, QString const&, QString const&, QString*, QFlags<QFileDialog::Option>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#8  0x00007f165c782a9f in Sbk_QFileDialogFunc_getSaveFileName () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/QtWidgets.abi3.so
#9  0x000000000050a4a5 in ?? ()
#10 0x000000000050cc96 in _PyEval_EvalFrameDefault ()
#11 0x00000000005095c8 in ?? ()
#12 0x000000000050a2fd in ?? ()
#13 0x000000000050beb4 in _PyEval_EvalFrameDefault ()
#14 0x0000000000507be4 in ?? ()
#15 0x0000000000509900 in ?? ()
#16 0x000000000050a2fd in ?? ()
#17 0x000000000050beb4 in _PyEval_EvalFrameDefault ()
#18 0x0000000000507be4 in ?? ()
#19 0x0000000000588c8b in ?? ()
#20 0x000000000059fd0e in PyObject_Call ()
#21 0x00007f1664142d2f in PySide::SignalManager::callPythonMetaMethod(QMetaMethod const&, void**, _object*, bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/libpyside2.abi3.so.5.15
#22 0x00007f1664147cdf in PySide::GlobalReceiverV2::qt_metacall(QMetaObject::Call, int, void**) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/libpyside2.abi3.so.5.15
#23 0x00007f1663c0ef97 in void doActivate<false>(QObject*, int, void**) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#24 0x00007f165be26672 in QAction::triggered(bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#25 0x00007f165be28a9e in QAction::activate(QAction::ActionEvent) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#26 0x00007f165bf19a78 in QAbstractButtonPrivate::click() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#27 0x00007f165bf19b95 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#28 0x00007f165bffca8a in QToolButton::mouseReleaseEvent(QMouseEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#29 0x00007f165be6a740 in QWidget::event(QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#30 0x00007f165bffcb59 in QToolButton::event(QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#31 0x00007f165be2c43c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#32 0x00007f165be331f8 in QApplication::notify(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#33 0x00007f165c6c2325 in QApplicationWrapper::notify(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/QtWidgets.abi3.so
#34 0x00007f1663bd6808 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#35 0x00007f165be3253a in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#36 0x00007f165be83fe8 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#37 0x00007f165be86cf3 in QWidgetWindow::event(QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#38 0x00007f165be2c43c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#39 0x00007f165be32f20 in QApplication::notify(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5
#40 0x00007f165c6c2325 in QApplicationWrapper::notify(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/QtWidgets.abi3.so
#41 0x00007f1663bd6808 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#42 0x00007f165e4ed56d in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Gui.so.5
#43 0x00007f165e4ee955 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Gui.so.5
#44 0x00007f165e4ca8ab in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Gui.so.5
#45 0x00007f16584f469a in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5XcbQpa.so.5
#46 0x00007f166080e417 in g_main_context_dispatch () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#47 0x00007f166080e650 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#48 0x00007f166080e6dc in g_main_context_iteration () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#49 0x00007f1663c321cc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#50 0x00007f1663bd521a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#51 0x00007f1663bde1d3 in QCoreApplication::exec() () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Core.so.5
#52 0x00007f165c6bfd98 in Sbk_QApplicationFunc_exec_ () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/QtWidgets.abi3.so
#53 0x000000000050a461 in ?? ()
#54 0x000000000050beb4 in _PyEval_EvalFrameDefault ()
#55 0x00000000005095c8 in ?? ()
#56 0x000000000050a2fd in ?? ()
#57 0x000000000050beb4 in _PyEval_EvalFrameDefault ()
#58 0x0000000000507be4 in ?? ()
#59 0x000000000050ad03 in PyEval_EvalCode ()
#60 0x0000000000634e72 in ?? ()
#61 0x0000000000634f27 in PyRun_FileExFlags ()
#62 0x00000000006386df in PyRun_SimpleFileExFlags ()
#63 0x0000000000639281 in Py_Main ()
#64 0x00000000004b0dc0 in main ()

I think this part of the back trace points at the problem:

#2  0x00007f164f9e9bf0 in ?? () from target:/snap/tablexplore/x1/kf5/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqxdgdesktopportal.so
#3  0x00007f165c0140d0 in QDialogPrivate::setNativeDialogVisible(bool) () from target:/snap/tablexplore/x1/lib/python3.6/site-packages/PySide2/Qt/lib/libQt5Widgets.so.5

You are using a Qt plugin provided by the kde-frameworks-5-core18 snap (brought in through the use of the kde-neon extension) with a libQt5Widgets that seems to be bundled with the PySide2 Python extension. I suspect that these are from different Qt versions, leading to a segfault (the Qt plugin interface is considered private, and does change between Qt versions that are otherwise binary compatible).

I’m not sure of the best way to resolve this. Maybe you could try the following:

  1. in your requirements.txt, lock the version of PySide2 to the Qt version contained in kde-frameworks-5-core18.
  2. In your snapcraft.yaml, use the stage: stanza of your part to exclude the bundled copy of Qt that PySide2 installs (which should also slim down your snap significantly).

Hope that helps.

I changed PySide2 to use 5.12 and added this to the yaml:

    stage:
        - -lib/python3.6/site-packages/PySide2/Qt

However now it can’t seem to pick up Qt at all when the program runs:

Qt: Session management error: Could not open network socket
Traceback (most recent call last):
  File "/snap/tablexplore/x1/bin/tablexplore", line 33, in <module>
    sys.exit(load_entry_point('tablexplore==0.3.0', 'gui_scripts', 'tablexplore')())
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/app.py", line 954, in main
    aw = Application(**args)
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/app.py", line 106, in __init__
    self.newProject()
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/app.py", line 357, in newProject
    self.addSheet('dataset1')
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/app.py", line 633, in addSheet
    columnwidth=core.COLUMNWIDTH, timeformat=core.TIMEFORMAT)
  File "/snap/tablexplore/x1/lib/python3.6/site-packages/tablexplore/core.py", line 87, in __init__
    self.splitter = QSplitter(Qt.Vertical, self)
NameError: name 'Qt' is not defined

Do I need some kind of link to the Qt libraries in the kde-frameworks-5-core18 snap? I assume this is handled automatically. Maybe it’s the way PySide2 works.

(Sorry, not sure it’s any new info, but writing from experience rather than Linux-specific knowledge … are you building on an actual Ubuntu 18 or a Ubuntu 20? Things started to work for me thence, i.e. once the full process took place on a Ubuntu 18. Not when packaging using core18 on the same Ubuntu 20 PC - trying to keep changes minimal as the interplay between things seems fragile, I didn’t try to migrate the Python packaging/compilation process into snapcraft, so this seemed the “best” way (at least for a first attempt! but it more or less worked) to ensure binary compatibility - which Windows DLL’s would want I believe, not sure about .so’s - if ever needed. My process is probably awkward, but you never know, we might be in the same shoes, or similar errors might occur.)

Yes I build on Ubuntu 20.10. It would seem to defeat the purpose of using multipass etc if you had to build on a specific version of ubuntu to get it working. But I might try this as a last resort…! Thanks.

1 Like

Maybe try excluding lib/python3.6/site-packages/PySide2/Qt/lib? I’m not overly familiar with the directory layout of the wheel distribution of PySide, but that appears to be where it stored libQt5Widgets at least. You want to keep the Python modules and Python extensions, but exclude actual Qt.

1 Like