Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Gstreamer error only when running app with sudo



  • When I run my Python/QML app with sudo, it doesn't play the WAV file, and shows the error below. But if I run the app without sudo it works fine and I hear the sound. I am pretty sure I just need to configure something for maybe gstreamer and the root user but I am not sure what to do? Any ideas? I installed X and the i3 window manager on my own.

    I am using Ubuntu 20.04 with Python 3.7 and PySide2 5.15 and QML.

    ubuntu@ubuntu:~$ sudo ./main 
    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
    
    qrc:/resources/qml/main.qml:42:13: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function.
    Error: "" : "no element \"identity\""
    
    (main-gui:1975): GLib-GObject-CRITICAL **: 15:46:39.121: g_object_set: assertion 'G_IS_OBJECT (object)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.121: gst_object_ref: assertion 'object != NULL' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.121: gst_bin_add_many: assertion 'GST_IS_ELEMENT (element_1)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.121: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.121: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.121: gst_ghost_pad_new: assertion 'GST_IS_PAD (target)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.121: gst_element_add_pad: assertion 'GST_IS_PAD (pad)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.121: gst_object_unref: assertion 'object != NULL' failed
    Error: "" : "no element \"identity\""
    
    (main-gui:1975): GLib-GObject-CRITICAL **: 15:46:39.122: g_object_set: assertion 'G_IS_OBJECT (object)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.122: gst_object_ref: assertion 'object != NULL' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.122: gst_bin_add_many: assertion 'GST_IS_ELEMENT (element_1)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.122: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.122: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.122: gst_ghost_pad_new: assertion 'GST_IS_PAD (target)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.122: gst_element_add_pad: assertion 'GST_IS_PAD (pad)' failed
    
    (main-gui:1975): GStreamer-CRITICAL **: 15:46:39.122: gst_object_unref: assertion 'object != NULL' failed
    
    

  • Lifetime Qt Champion

    Hi,

    AFAIK, every recent Linux distribution has disabled root access to X by default. You have to explicitly enable that before calling sudo.



  • On my system, the root user seems to be able to run X apps fine.


  • Lifetime Qt Champion

    Calling them with sudo from your standard user ?
    Can you give an example ?


Log in to reply