Ubuntu 22.04 how to reset QT_PLUGIN_PATH to correct value?
-
I am using Ubuntu 22.04 and all my applications (Konsole, P4V and WIreshark) which use Qt are segfaulting.
The error is they try locating metadata by looking for libraries but cannot find the libraries. This is the debug logging from Konsole:
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/plugins/platforms" ... QFactoryLoader::QFactoryLoader() looking at "/usr/lib/plugins/platforms/libqminimal.so" "Failed to extract plugin meta data from '/usr/lib/plugins/platforms/libqminimal.so'" not a plugin
I established my QT_PLUGIN_PATH must be wrong. It seems to be pointing to /usr/lib/plugins/platforms. If I export this to /usr/lib/x86_64-linux-gnu/qt5/plugins/ all the applications work.
However, I don't understand why this happened.
Could someone please advise how I can re-install my Qt so the above is fixed?
-
@qt77 If you only have the Ubuntu-supplied Qt then you would not normally have a QT_PLUGIN_PATH in your environment. If you have one then you should look in
/etc/environment.d/
for a file that is setting it.What is the output of:
which qmake qmake -query env | grep QT
Have you installed a separate Qt environment that you have added to the PATH, LD_LIBRARYPATH, etc?
-
@ChrisW67 Hi Chris, before the problem started I had never explicitly installed qt. Presumably it came with Konsole.
After the problem occurred I think I may have tried re-installing qtwayland5 out of desperation.
The output:
which qmake /usr/bin/qmake
qmake -query qmake: could not exec '/usr/lib/qt5/bin/qmake': No such file or directory
env | grep QT QT_ACCESSIBILITY=1 QT_QPA_PLATFORM=wayland QT_IM_MODULE=ibus QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins/
QT_PLUGIN_PATH is what I just added, so I could test Konsole.
QT_QPA_PLATFORM is in my bashrc and my bashrc was copied from a previous Ubuntu installation.I literally just need the bog-standard Qt installation so Konsole, P4V and Wireshark function normally.
I'd like to undo anything stupid I may have done and just reset the installation.
-
@JoeCFD Hi,
qmake --version qmake: could not exec '/usr/lib/qt5/bin/qmake': No such file or directory
I think path (/usr/lib/) is the same path Konsole was unsuccessfully trying to find the shared libraries in.
FYI I still have this set as an environment variable:
QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins/
-
@JoeCFD Just to confirm: I am not a Qt developer. I just use Konsole, P4V and Wireshark, which require Qt.
So originally those apps would have installed Qt as a dependency (or it was already part of Ubuntu).
I should still install it/them?
And what do I need to uninstall first, to undo the mess?
-
@qt77 I guess you do not need it. Simply export
QT_PLUGIN_PATH to the right location.Since you do not install qt development packages, the apps you use need qt libs which are installed by dependency. But the plugins path is not set automatically. I think it is good enough to set QT_PLUGIN_PATH(add it in bashrc).
You can purge the installations. Be careful that you do not remove the libs your apps need.
You can check which extra libs were installed. Simply purge these libs. But these libs do not hurt you if you leave them there. No worries.
you can purge qtcreator and qmake for sure.