Skip to content

qutebrowser: This application failed to start because no Qt platform plugin could be initialized. #64984

Closed

Description

@emmanuelrosa

Issue description

qutebrowser aborts and produces the following error:

16:55:22 WARNING: Could not find the Qt platform plugin "xcb" in ""
16:55:22 CRITICAL: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Fatal Python error: Aborted

Current thread 0x00007ff93979eb80 (most recent call first):
  File "/nix/store/i34zmpg99l9b21qjg78alqj8vzh7q6zl-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 87 in _die
  File "/nix/store/i34zmpg99l9b21qjg78alqj8vzh7q6zl-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 222 in _check_modules
  File "/nix/store/i34zmpg99l9b21qjg78alqj8vzh7q6zl-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 238 in check_libraries
  File "/nix/store/i34zmpg99l9b21qjg78alqj8vzh7q6zl-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 296 in early_init
  File "/nix/store/i34zmpg99l9b21qjg78alqj8vzh7q6zl-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/qutebrowser.py", line 190 in main
  File "/nix/store/i34zmpg99l9b21qjg78alqj8vzh7q6zl-qutebrowser-1.6.3/bin/..qutebrowser-wrapped-wrapped", line 11 in <module>

I suspect it's due to #54525, but when I started building a NixOS vm with the merge commit checked out, Nix started building cmake; I just don't have the computing resources to build from such a starting point.

What I do know is that the problem exists in ef6f912 but not in 696767a

Steps to reproduce

  1. Run qutebrowser

Technical details

 - system: `"x86_64-linux"`
 - host os: `Linux 4.19.58, NixOS, 19.09.git.ef6f912245b (Loris)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.2.2`
 - channels(root): `"nixos-19.09pre172038.5d3fd3674a6"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Activity

  1. added
    0.kind: regression
    on Jul 17, 2019
  2. FRidh commented on Jul 17, 2019

    @FRidh
    Member

    It's indeed likely due to that PR. As mentioned in the message, its up to the maintainers/community to fix the usage of the wrapper in the various packages.

  3. emmanuelrosa commented on Jul 24, 2019

    @emmanuelrosa
    ContributorAuthor

    Yep.

    I have a fix for the "Qt platform plugin" error, but the missing Qtml module has stumped me. I've git bisect-ed my way toward the culprit, but I'm not there yet; Compiling LLVM, Qt, PyQt... takes a LONG time on my computer ;)

    git bisect start
    # bad: [ef6f912245bffbaf4307c1dfbfba329beb7ec47d] sauce-connect: 4.5.1 -> 4.5.3
    git bisect bad ef6f912245bffbaf4307c1dfbfba329beb7ec47d
    # good: [a55c726f6bae75fca36c1690db9b9cf82deb2cb6] nodePackages.scuttlebot -> nodePackages.ssb-server, updated nodePackages_10_x
    git bisect good a55c726f6bae75fca36c1690db9b9cf82deb2cb6
    # bad: [a28a9ac156b921f394882be3c282e906f4662af5] Merge master into staging-next
    git bisect bad a28a9ac156b921f394882be3c282e906f4662af5
    # good: [800da69c8a5eae83bceee98af0c09e1b3440b3bf] Merge pull request #64551 from jonringer/update-pyproj
    git bisect good 800da69c8a5eae83bceee98af0c09e1b3440b3bf
    # bad: [aa46fdce807fa9251c996ac0ad719079810a206d] Merge pull request #64295 from worldofpeace/libgdata
    git bisect bad aa46fdce807fa9251c996ac0ad719079810a206d
    # good: [bea56ef8ba568d593cd8e8ffd4962c2358732bf4] gimp: remove cf-private
    git bisect good bea56ef8ba568d593cd8e8ffd4962c2358732bf4
    # good: [42705e70a7ed2bced9593d08fe07a99d81408cdb] lldb: fix darwin sandboxed build
    git bisect good 42705e70a7ed2bced9593d08fe07a99d81408cdb
    # good: [971c341ccbe45d8fe69442d79f515d0cd266cb3e] libxkbcommon: 0.8.0 -> 0.8.4
    git bisect good 971c341ccbe45d8fe69442d79f515d0cd266cb3e
    

    test.sh

    #!/run/current-system/sw/bin/bash
    
    nix build -I nixpkgs=/home/emmanuel/projects/nixpkgs -f default.nix python3Packages.pyqt5 && stat ./result/lib/python3.7/site-packages/PyQt5/QtQml.so && rm result
    
  4. emmanuelrosa commented on Jul 24, 2019

    @emmanuelrosa
    ContributorAuthor

    According to git bisect, the first bad commit is f79fd2e

    This implies that somewhere within that commit the PyQt build changed such that the Qtml module is no longer being built.

    git bisect start
    # bad: [ef6f912245bffbaf4307c1dfbfba329beb7ec47d] sauce-connect: 4.5.1 -> 4.5.3
    git bisect bad ef6f912245bffbaf4307c1dfbfba329beb7ec47d
    # good: [a55c726f6bae75fca36c1690db9b9cf82deb2cb6] nodePackages.scuttlebot -> nodePackages.ssb-server, updated nodePackages_10_x
    git bisect good a55c726f6bae75fca36c1690db9b9cf82deb2cb6
    # bad: [a28a9ac156b921f394882be3c282e906f4662af5] Merge master into staging-next
    git bisect bad a28a9ac156b921f394882be3c282e906f4662af5
    # good: [800da69c8a5eae83bceee98af0c09e1b3440b3bf] Merge pull request #64551 from jonringer/update-pyproj
    git bisect good 800da69c8a5eae83bceee98af0c09e1b3440b3bf
    # bad: [aa46fdce807fa9251c996ac0ad719079810a206d] Merge pull request #64295 from worldofpeace/libgdata
    git bisect bad aa46fdce807fa9251c996ac0ad719079810a206d
    # good: [bea56ef8ba568d593cd8e8ffd4962c2358732bf4] gimp: remove cf-private
    git bisect good bea56ef8ba568d593cd8e8ffd4962c2358732bf4
    # good: [42705e70a7ed2bced9593d08fe07a99d81408cdb] lldb: fix darwin sandboxed build
    git bisect good 42705e70a7ed2bced9593d08fe07a99d81408cdb
    # good: [971c341ccbe45d8fe69442d79f515d0cd266cb3e] libxkbcommon: 0.8.0 -> 0.8.4
    git bisect good 971c341ccbe45d8fe69442d79f515d0cd266cb3e
    # bad: [3adc9d04870605ca20969a98fe820535fc7a88a5] doc/languages-frameworks/qt.xml: Update for wrapQtAppsHook
    git bisect bad 3adc9d04870605ca20969a98fe820535fc7a88a5
    # bad: [51d78034a1db78f8ce0ea3ba6fa20be590ed0ca2] wrapQtAppsHook: Remove ad hoc Qt wrappers
    git bisect bad 51d78034a1db78f8ce0ea3ba6fa20be590ed0ca2
    # bad: [f79fd2e826dd95b3b64839d3e0bec8ae1dfab17e] wrapQtAppsHook: wrap Qt applications for runtime dependencies
    git bisect bad f79fd2e826dd95b3b64839d3e0bec8ae1dfab17e
    # first bad commit: [f79fd2e826dd95b3b64839d3e0bec8ae1dfab17e] wrapQtAppsHook: wrap Qt applications for runtime dependencies
    
  5. added
    6.topic: qt/kde
    on Jul 25, 2019
  6. d4g commented on Jul 29, 2019

    @d4g
    Contributor

    Can confirm the issue.

    13:45:09 DEBUG    init       earlyinit:init_log:266 Log initialized.
    13:45:09 WARNING  qt-qt.qpa.plugin Unknown module:none:0 Could not find the Qt platform plugin "wayland" in ""
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/bin/..qutebrowser-wrapped-wrapped", line 11, in <module>
        sys.exit(main())
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/qutebrowser.py", line 190, in main
        earlyinit.early_init(args)
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 296, in early_init
        check_libraries()
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 238, in check_libraries
        _check_modules(modules)
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 222, in _check_modules
        _die(text, e)
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 87, in _die
        app = QApplication(sys.argv)
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/utils/log.py", line 472, in qt_message_handler
        stack = ''.join(traceback.format_stack())
    
    13:45:09 CRITICAL qt         Unknown module:none:0 This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/bin/..qutebrowser-wrapped-wrapped", line 11, in <module>
        sys.exit(main())
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/qutebrowser.py", line 190, in main
        earlyinit.early_init(args)
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 296, in early_init
        check_libraries()
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 238, in check_libraries
        _check_modules(modules)
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 222, in _check_modules
        _die(text, e)
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 87, in _die
        app = QApplication(sys.argv)
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/utils/log.py", line 472, in qt_message_handler
        stack = ''.join(traceback.format_stack())
    
    Fatal Python error: Aborted
    
    Current thread 0x00007f5c6a9d7b80 (most recent call first):
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 87 in _die
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 222 in _check_modules
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 238 in check_libraries
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/misc/earlyinit.py", line 296 in early_init
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/lib/python3.7/site-packages/qutebrowser/qutebrowser.py", line 190 in main
      File "/nix/store/jmy3swaz7ma3f3w6vfjcjm914rdlkqwn-qutebrowser-1.6.3/bin/..qutebrowser-wrapped-wrapped", line 11 in <module>
    
    
    
  7. emmanuelrosa commented on Jul 29, 2019

    @emmanuelrosa
    ContributorAuthor

    I dug into this further yesterday, and though I don't have a solution, the problem points to three things:

    1. The qutebrowser package needs to be modified to use wrapQtAppsHook. That part is easy, and I already have a commit for it.
    2. PyQt5 is building in such a way that not all of its modules are included, namely the QtQml module. This results in another runtime error; visible after wrapQtAppsHook has been applied.
    3. The reason PyQt5 is building with missing modules is because during the build process it uses qtbase tooling to determine whether said modules should be built. In the past, the tooling would return in the affirmative, causing the module to be build. However, as of late the tooling returns in the negative, thus the modules don't get built. This can be seen in the trunk/master python37Packages.pyqt5 builds on Hydra; just search for QtQml.

    It is number 3 above where I'm stuck. It seems like it's due to a change in qtbase, but I don't know what that change could be, nor how to test for it.

    Note: I ruled out the mismatch between PyQt 5.11 and Qt 5.22 as a potential cause by forcing PyQt 5.11 to build against Qt 5.11.

  8. worldofpeace commented on Jul 29, 2019

    @worldofpeace
    Contributor

    Yeah, I've been at least aware that we needed to update PyQt #65150 (comment).

    I think @FRidh is working on this.

  9. FRidh commented on Aug 3, 2019

    @FRidh
    Member

    Fix in #65836

  10. emmanuelrosa commented on Aug 4, 2019

    @emmanuelrosa
    ContributorAuthor

    Unfortunately, #65836 did not fix it. I:

    1. checked out 525eaf4
    2. built a vm with nixos-rebuild build-vm
    3. executed qutebrowser within the vm

    The error is the same as I originally reported.

    I noticed that 2912844 adds pyqtwebengine as a dependency to qutebrowser, but doesn't utilize mkDerivation nor wrapQtAppsHook. In contrast, my workaround is to --after applying a hack to PyQt 5.11 -- change qutebrowser as follows:

    diff --git a/pkgs/applications/networking/browsers/qutebrowser/default.nix b/pkgs/applications/networking/browsers/qutebrowser/default.nix
    index 03a5aa7bfe2..784ee60f4c3 100644
    --- a/pkgs/applications/networking/browsers/qutebrowser/default.nix
    +++ b/pkgs/applications/networking/browsers/qutebrowser/default.nix
    @@ -1,5 +1,5 @@
     { stdenv, lib, fetchurl, fetchzip, python3Packages
    -, makeWrapper, wrapGAppsHook, qtbase, glib-networking
    +, mkDerivationWith, wrapQtAppsHook, wrapGAppsHook, qtbase, glib-networking
     , asciidoc, docbook_xml_dtd_45, docbook_xsl, libxml2
     , libxslt, gst_all_1 ? null
     , withPdfReader        ? true
    @@ -19,7 +19,7 @@ let
         stripRoot = false;
       };
     
    -in python3Packages.buildPythonApplication rec {
    +in mkDerivationWith python3Packages.buildPythonApplication rec {
       pname = "qutebrowser";
       version = "1.6.3";
     
    @@ -41,7 +41,7 @@ in python3Packages.buildPythonApplication rec {
       ]);
     
       nativeBuildInputs = [
    -    makeWrapper wrapGAppsHook asciidoc
    +    wrapQtAppsHook wrapGAppsHook asciidoc
         docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
       ];
     
    @@ -57,6 +57,9 @@ in python3Packages.buildPythonApplication rec {
         ./fix-restart.patch
       ];
     
    +  dontWrapGApps = true;
    +  dontWrapQtApps = true;
    +
       postPatch = ''
         substituteInPlace qutebrowser/app.py --subst-var-by qutebrowser "$out/bin/qutebrowser"
     
    @@ -95,6 +98,12 @@ in python3Packages.buildPythonApplication rec {
         done
       '';
     
    +  postFixup = ''
    +    wrapProgram $out/bin/qutebrowser \
    +      "''${gappsWrapperArgs[@]}" \
    +      "''${qtWrapperArgs[@]}" \
    +  '';
    +
       meta = with stdenv.lib; {
         homepage    = https://github.com/The-Compiler/qutebrowser;
         description = "Keyboard-focused browser with a minimal GUI";
    
    
  11. FRidh commented on Aug 4, 2019

    @FRidh
    Member

    I think the cases were working for me because my environment has the right plugins. But indeed, wrapping should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: regression6.topic: qt/kde

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions