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

Qt app on linux: permission denied when opening framebuffer



  • I'm attempting to port an existing application to linux and am running in some problems at application startup.
    After the platform plugin (linuxfb) is loaded, it fails to open the framebuffer with a permission denied error. Several other devices seem to fail to open and the operation ultimately fails with the mention "Cannot create window: no screens available"

    In case that makes any difference: the application uses cmake as its build system and Qt was built from source..
    I turned on plugin debugging to get some hopefully useful output:

    gregoryvv@lolly:/Development/Projects/AppPort$ export QT_QPA_PLATFORM=linuxfb
    gregoryvv@lolly:/Development/Projects/AppPort$ ./Application 
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/Qt-5.13.2/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/Qt-5.13.2/plugins/platforms/libqlinuxfb.so"
    Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqlinuxfb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "linuxfb"
            ]
        },
        "archreq": 0,
        "className": "QLinuxFbIntegrationPlugin",
        "debug": false,
        "version": 331008
    }
    
    
    Got keys from plugin meta data ("linuxfb")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/Qt-5.13.2/plugins/platforms/libqminimal.so"
    Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqminimal.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archreq": 0,
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 331008
    }
    
    
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/Qt-5.13.2/plugins/platforms/libqoffscreen.so"
    Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqoffscreen.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archreq": 0,
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 331008
    }
    
    
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/Qt-5.13.2/plugins/platforms/libqvnc.so"
    Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforms/libqvnc.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "vnc"
            ]
        },
        "archreq": 0,
        "className": "QVncIntegrationPlugin",
        "debug": false,
        "version": 331008
    }
    
    
    Got keys from plugin meta data ("vnc")
    QFactoryLoader::QFactoryLoader() checking directory path "/Development/Projects/AppPort/platforms" ...
    loaded library "/usr/local/Qt-5.13.2/plugins/platforms/libqlinuxfb.so"
    Failed to open framebuffer /dev/fb0 (Permission denied)
    linuxfb: Failed to initialize screen
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/Qt-5.13.2/plugins/platforminputcontexts" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/Qt-5.13.2/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so"
    Found metadata in lib /usr/local/Qt-5.13.2/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "qtvirtualkeyboard"
            ]
        },
        "archreq": 0,
        "className": "QVirtualKeyboardPlugin",
        "debug": false,
        "version": 331008
    }
    
    
    Got keys from plugin meta data ("qtvirtualkeyboard")
    QFactoryLoader::QFactoryLoader() checking directory path "/Development/Projects/AppPort/platforminputcontexts" ...
    [9;0]Device discovery cannot open device "/dev/input/event0"
    Device discovery cannot open device "/dev/input/event1"
    Device discovery cannot open device "/dev/input/event10"
    Device discovery cannot open device "/dev/input/event11"
    Device discovery cannot open device "/dev/input/event12"
    Device discovery cannot open device "/dev/input/event13"
    Device discovery cannot open device "/dev/input/event14"
    Device discovery cannot open device "/dev/input/event15"
    Device discovery cannot open device "/dev/input/event2"
    Device discovery cannot open device "/dev/input/event3"
    Device discovery cannot open device "/dev/input/event4"
    Device discovery cannot open device "/dev/input/event5"
    Device discovery cannot open device "/dev/input/event6"
    Device discovery cannot open device "/dev/input/event7"
    Device discovery cannot open device "/dev/input/event8"
    Device discovery cannot open device "/dev/input/event9"
    Device discovery cannot open device "/dev/input/mice"
    Device discovery cannot open device "/dev/input/mouse0"
    Device discovery cannot open device "/dev/input/event0"
    Device discovery cannot open device "/dev/input/event1"
    Device discovery cannot open device "/dev/input/event10"
    Device discovery cannot open device "/dev/input/event11"
    Device discovery cannot open device "/dev/input/event12"
    Device discovery cannot open device "/dev/input/event13"
    Device discovery cannot open device "/dev/input/event14"
    Device discovery cannot open device "/dev/input/event15"
    Device discovery cannot open device "/dev/input/event2"
    Device discovery cannot open device "/dev/input/event3"
    Device discovery cannot open device "/dev/input/event4"
    Device discovery cannot open device "/dev/input/event5"
    Device discovery cannot open device "/dev/input/event6"
    Device discovery cannot open device "/dev/input/event7"
    Device discovery cannot open device "/dev/input/event8"
    Device discovery cannot open device "/dev/input/event9"
    Device discovery cannot open device "/dev/input/mice"
    Device discovery cannot open device "/dev/input/mouse0"
    Device discovery cannot open device "/dev/input/event0"
    Device discovery cannot open device "/dev/input/event1"
    Device discovery cannot open device "/dev/input/event10"
    Device discovery cannot open device "/dev/input/event11"
    Device discovery cannot open device "/dev/input/event12"
    Device discovery cannot open device "/dev/input/event13"
    Device discovery cannot open device "/dev/input/event14"
    Device discovery cannot open device "/dev/input/event15"
    Device discovery cannot open device "/dev/input/event2"
    Device discovery cannot open device "/dev/input/event3"
    Device discovery cannot open device "/dev/input/event4"
    Device discovery cannot open device "/dev/input/event5"
    Device discovery cannot open device "/dev/input/event6"
    Device discovery cannot open device "/dev/input/event7"
    Device discovery cannot open device "/dev/input/event8"
    Device discovery cannot open device "/dev/input/event9"
    Device discovery cannot open device "/dev/input/mice"
    Device discovery cannot open device "/dev/input/mouse0"
    no screens available, assuming 24-bit color
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/Qt-5.13.2/plugins/styles" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/Development/Projects/AppPort/styles" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/Qt-5.13.2/plugins/accessiblebridge" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/Development/Projects/AppPort/accessiblebridge" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/Qt-5.13.2/plugins/iconengines" ...
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/Qt-5.13.2/plugins/iconengines/libqsvgicon.so"
    Found metadata in lib /usr/local/Qt-5.13.2/plugins/iconengines/libqsvgicon.so, metadata=
    {
        "IID": "org.qt-project.Qt.QIconEngineFactoryInterface",
        "MetaData": {
            "Keys": [
                "svg",
                "svgz",
                "svg.gz"
            ]
        },
        "archreq": 0,
        "className": "QSvgIconPlugin",
        "debug": false,
        "version": 331008
    }
    
    
    Got keys from plugin meta data ("svg", "svgz", "svg.gz")
    QFactoryLoader::QFactoryLoader() checking directory path "/Development/Projects/AppPort/iconengines" ...
    Cannot create window: no screens available
    Aborted (core dumped)
    
    

  • Qt Champions 2019

    @gvanvoor Did you try to change the access rights on the device file or add your user the the group with access to device file?


  • Qt Champions 2019

    @gvanvoor Did you try to change the access rights on the device file or add your user the the group with access to device file?



  • @jsulm No I didn't. Can you tell me how? This goes beyond my limited linux knowledge :-(


  • Qt Champions 2019

    @gvanvoor There should be something like /dev/fb0 (file name can be different). Find out what is used in your case and check access rights:

    ls -lh /dev/fb0
    

    You will then see which group is set on the device file. And your user to that group.



  • That did the trick. There are still problems but that's in my own code.
    Thanks.


Log in to reply