Solved 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)
-
@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?
-
@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 :-(
-
@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. -
@gvanvoor
I've had the same problem. Use the following command to solve your current problem:export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
Now, however, there are new problem:
Failed to mmap framebuffer (Invalid argument)
linuxfb: Failed to initialize screen
Segmentation faultHave you encountered this problem in debugging and solve it?