Nixpkgs: VirtualBox and VLC segfaults related to QT_PLUGIN_PATH

Created on 8 Sep 2015  路  23Comments  路  Source: NixOS/nixpkgs

I haven't figured out why this happens but I can reliably get a segfault with the following steps:

  1. Boot
  2. Start VirtualBox
  3. Start a Virtual machine

It fails with a segfault (e.g. VirtualBox[1489]: segfault at 7fb96e79f7d0 ip 00007fb96e79f7d0 sp 00007ffd2ac39df8 error 14 in VBoxPuelMain.so[7fb96e9a6000+8000])

Interestingly VLC will also now segfault (I can add an example later, but it often refers to libXft.so)

I noticed that #5508 mentioned QT_PLUGIN_PATH, and although I don't seem to have anything which would add extra Qt plugins in my user or root profiles, running the following works:

QT_PLUGIN_PATH= vlc

After running that once, I can now start the virtual machine, and run vlc again without unsetting QT_PLUGIN_PATH.

The following sequence also works:

  1. Boot
  2. Start VLC (without unsetting QT_PLUGIN_PATH)
  3. Start VirtualBox
  4. Start a Virtual machine

I'm running KDE5 (KDE4 is not enabled), on 16.03pre68239.bd84eba and I've tried VirtualBox 5.0.0 with and without the Extensions.

My root user profile has the following installed:
artha-1.0.3
handbrake-0.9.9
jmtpfs-0.5
libreoffice-4.0.5.2
stalonetray-0.8.1
wordnet-3.0

My user profile has the following installed:
artha-1.0.3 (GTK thesaurus)

Will I add a core dump or collect more info?

bug

Most helpful comment

Per #15498, I am working on removing all the Qt propagation; when I do, I can backport that to 16.03.

All 23 comments

i've hit the same issue with the recent update on unstable channel.

i've noted similar issues and a solution here:
https://nixos.org/wiki/Nix_impurities

proposal

what you won't like: QT_PLUGIN_PATH is a global variable and as such problematic. we could use make-wrapper to create a closure for each qt program.

That would explain your segfaults @edolstra

Here is a stack trace:

#0  0x00007f340c8697d0 in ?? ()
#1  0x00007f34239813c0 in QFactoryLoader::updateDir(QString const&, QSettings&) () from /nix/store/flc5nsissjnsbx07kxf35k5642l7c8b6-qt-4.8.7/lib/libQtCore.so.4
#2  0x00007f3423982107 in QFactoryLoader::update() () from /nix/store/flc5nsissjnsbx07kxf35k5642l7c8b6-qt-4.8.7/lib/libQtCore.so.4
#3  0x00007f342398231f in QFactoryLoader::QFactoryLoader(char const*, QString const&, Qt::CaseSensitivity) () from /nix/store/flc5nsissjnsbx07kxf35k5642l7c8b6-qt-4.8.7/lib/libQtCore.so.4
#4  0x00007f3422dd456c in QIcon::addFile(QString const&, QSize const&, QIcon::Mode, QIcon::State) () from /nix/store/flc5nsissjnsbx07kxf35k5642l7c8b6-qt-4.8.7/lib/libQtGui.so.4
#5  0x00007f3422dd468a in QIcon::QIcon(QString const&) () from /nix/store/flc5nsissjnsbx07kxf35k5642l7c8b6-qt-4.8.7/lib/libQtGui.so.4
#6  0x00007f3424fe7d5f in UIMachineWindow::UIMachineWindow(UIMachineLogic*, unsigned long) () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#7  0x00007f3425001239 in UIMachineWindowNormal::UIMachineWindowNormal(UIMachineLogic*, unsigned long) ()
   from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#8  0x00007f3424fe89e8 in UIMachineWindow::create(UIMachineLogic*, unsigned long) () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#9  0x00007f3425000967 in UIMachineLogicNormal::prepareMachineWindows() () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#10 0x00007f3424fd8de6 in UIMachineLogic::prepare() () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#11 0x00007f3424fd7eb9 in UIMachine::sltChangeVisualState(UIVisualStateType) () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#12 0x00007f3424fd80d1 in UIMachine::prepareMachineLogic() () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#13 0x00007f3424fd8142 in UIMachine::prepare() () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#14 0x00007f3424fd82d8 in UIMachine::create() () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#15 0x00007f3424fd85fd in UIMachine::startMachine(QString const&) () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#16 0x00007f3424f1561a in TrustedMain () from /nix/store/ihm2fzmi0z7xl4rw2lgpwdpzl6ksqvpf-virtualbox-5.0.0-3.18.20/libexec/virtualbox/VirtualBox.so
#17 0x00007f342e79a995 in __libc_start_main () from /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6
#18 0x0000000000401589 in _start ()

I think it better to revert to VirtualBox 4. Because there is another VB bug https://forums.virtualbox.org/viewtopic.php?f=7&t=68883. I got it myself too.
Or we need to bring old kernel back.

Well, Kernel 4.2 wasn't released that long time ago. 5.0.4 bump says is should fix compatibility though.

That's nice.

Sincerely,
Arseniy Seroka

On 10 September 2015 16:56:22 Domen Ko啪ar [email protected] wrote:

Well, Kernel 4.2 wasn't released that long time ago. 5.0.4 bump says is
should fix compatibility though.


Reply to this email directly or view it on GitHub:
https://github.com/NixOS/nixpkgs/issues/9732#issuecomment-139241792

Okay, so both VirtualBox 4.3.30 and 5.0.4 give hard lockups on Linux 3.18.21. Reverting to 3.18.16 made to lockups go away (as suggested by https://forums.virtualbox.org/viewtopic.php?f=7&t=68883#p331735, which is probably talking about another issue than the Linux 4.2 lockups).

I'm not seeing the QT_PLUGIN_PATH segfaults anymore with 5.0.4.

So it appears that we won't need to revert VirtualBox (since it won't help), but we'll still need a fix for the 3.18 kernel.

I'm experiencing total freeze on kernel 3.18.21, 4.1.7, and 4.2 on nixos-unstable: 16.03pre69463.68bd8e4 (Emu) with Virtualbox 5.0.4

I can't trigger the freeze in a deterministic manner, but it happen every time after having launch a Virtualbox VM (sometimes seconds after, sometimes minutes). I did not find any error in the log that seems to relate to the freeze though :/

How can I revert to the 3.8.16 kernel? I there a way to override the version of the kernel (+ sha)?

3.8 is unmaintained upstream and was thus deleted from nixpkgs, and the older kernels (maintained upstream) are supposedly not supported by systemd anymore ee10e165dc.

Ha sorry typo in my comment, I meant 3.18.16 :)

I tried to do the following:

  boot.kernelPackages = pkgs.linuxPackages // {
    version = "3.18.16";
    src = pkgs.fetchurl {
      url = "mirror://kernel/linux/kernel/v3.x/linux-3.18.16.tar.xz";
      sha256 = "0c2530amgsk29ina9mfvlncki64w0zs16d2k8bghq3fv9k2qv3nr";                                                                       
    };  
  }; 

But it does not actually override my kernel, nothing is rebuild/activated when rebuilding.

OK my freeze issue on other kernels than the 3.18.21 may have been bogus. It seems that after upgrading my BIOS/UEFI and the CPU microcode I don't face the freeze issue anymore with Virtualbox. (I can't be 100%, since I don't really have a deterministic way of triggering the bug.)

Anyway, I think you can safely ignore my comment about the others kernels.

One way to get it working for me is running:

nix-shell --pure -p linuxPackages.virtualbox --command VirtualBox

Once a virtual machine is running, indicated by having the VirtualBox application running as well as another X-Window with the title of the selected virtual machine i never run into the error condition described by the OP afterwards. Interestingly, this holds true even if i close all VirtualBox related applications as well as the pure nix-shell and start it from a normal shell where it originally would bring up something like: Virtualbox[number]: segfault at ...

I also use KDE5. For me, the problem seems to be that QT_PLUGIN_PATH contains both qt4 and qt5 folders. Using only the qt5 ones prevents the crash. By the way, quasselclient has the same problem.

/cc @ttuegel about the Qt plugins. (Just to be sure; maybe he knows about such problems already. Plugins are a headache in general when one wants to mix different versions of things.)

The packaging changes I introduced with Qt 5.5 should stop this from happening, i.e. packages will only pick up plugins from their version of Qt. The Nixpkgs manual describes how to upgrade packages to Qt 5.5.

I suppose this has been fixed ? Running quasselclient and vlc happily here.

I got this again on 16.03. VLC and VirtualBox both segfaulted:

kernel: VirtualBox[1661]: segfault at 7f73907df6b0 ip 00007f73907df6b0 sp 00007fffb8d46ae8 error 14
kernel: vlc[2010]: segfault at 7fc9d9b6d6b0 ip 00007fc9d9b6d6b0 sp 00007fc9f4a937c8 error 14 in libXft.so.2.3.2[7fc9d9d74000+15000]

Removing ~/.nix-profile from QT_PLUGIN_PATH made it work. However after that the segfaults also disappeared with the normal QT_PLUGIN_PATH setting, so I'm not sure what's going on...

The Qt stuff in ~/.nix-profile comes via the propagatedUserEnvPkgs of LibreOffice BTW. We should probably 1) not propagate stuff in LibreOffice; 2) move ~/.nix-profile to the end of QT_PLUGIN_PATH to minimize the risk that stuff installed via nix-env will break the system.

Per #15498, I am working on removing all the Qt propagation; when I do, I can backport that to 16.03.

@ttuegel what is the state of this?

This is as fixed as it can be. Packages installed from NixOS 16.09 or later do not pollute the system path. Qt packages that follow the instructions in the manual are not sensitive to this problem, either. Packages that were installed with nix-env -i before 16.09 will remain broken; there is nothing I can do about that case.

Then I think this can be closed :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

retrry picture retrry  路  3Comments

domenkozar picture domenkozar  路  3Comments

spacekitteh picture spacekitteh  路  3Comments

yawnt picture yawnt  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments