HTC Vive Pro - Linux - MATLAB crashed when I ran VRHMDDemo1

Hello!

I am planning to set up my HTC Vive Pro to present the experiment on PTB. I installed Ubuntu 22.04 LTS with the latest nvidia driver, as well as using XOrgConfCreator to set up the Vive Pro as a external screen. I also installed latest OpenHMD on Ubuntu. However, MATLAB crashed and quited with crash report while running the built-in VRHMDDemo1 despite everything seems to be OK.

--------------------------------------------------------------------------------
Here is the crash report,
--------------------------------------------------------------------------------

*--------------------------------------------------------------------------------*
*               abort() detected at Wed Jan 25 13:15:44 2023 +0000*
*--------------------------------------------------------------------------------*

*Configuration:*
*  Crash Decoding           : Disabled - No sandbox or build area path*
*  Crash Mode               : continue (default)*
*  Default Encoding         : UTF-8*
*  Deployed                 : false*
*  Desktop Environment      : ubuntu:GNOME*
*  GNU C Library            : 2.35 stable*
*  Graphics Driver          : Unknown hardware *
*  Graphics card 1          : 0x10de ( 0x10de ) 0x2487 Version 525.85.5.0 (0-0-0)*
*  Java Version             : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode*
*  MATLAB Architecture      : glnxa64*
*  MATLAB Entitlement ID    : 1563295*
*  MATLAB Root              : /usr/local/MATLAB/R2019b*
*  MATLAB Version           : 9.7.0.1737446 (R2019b) Update 9*
*  OpenGL                   : hardware*
*  Operating System         : Linux 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64*
*  Process ID               : 5307*
*  Processor ID             : x86 Family 6 Model 151 Stepping 2, GenuineIntel*
*  Session Key              : 265c6955-efac-4c04-b595-72d729a29618*
*  Static TLS mitigation    : Enabled: Full*
*  Window System            : The X.Org Foundation (12101003), display :1*

*Fault Count: 1*


*Abnormal termination:*
*abort()*

*Register State (from fault):*
*  RAX = 0000000000000000  RBX = 00007f65fffff640*
*  RCX = 00007f6620444a7c  RDX = 0000000000000006*
*  RSP = 00007f65ffffab10  RBP = 000000000000151f*
*  RSI = 000000000000151f  RDI = 00000000000014bb*

*   R8 = 00007f65ffffabe0   R9 = 0000000000000b06*
*  R10 = 0000000000000008  R11 = 0000000000000246*
*  R12 = 0000000000000006  R13 = 0000000000000016*
*  R14 = 0000000000000008  R15 = 00007f65ffffaeb0*

*  RIP = 00007f6620444a7c  EFL = 0000000000000246*

*   CS = 0033   FS = 0000   GS = 0000*

*Stack Trace (from fault):*
*[  0] 0x00007f6620444a7c                    /lib/x86_64-linux-gnu/libc.so.6+00617084 pthread_kill+00000300*
*[  1] 0x00007f66203f0476                    /lib/x86_64-linux-gnu/libc.so.6+00271478 raise+00000022*
*[  2] 0x00007f66203d67f3                    /lib/x86_64-linux-gnu/libc.so.6+00165875 abort+00000211*
*[  3] 0x00007f6489e18ed6               /lib/x86_64-linux-gnu/libdbus-1.so.3+00048854*
*[  4] 0x00007f6489e3f690               /lib/x86_64-linux-gnu/libdbus-1.so.3+00206480 _dbus_warn_return_if_fail+00000000*
*[  5] 0x00007f64c926804f             /lib/x86_64-linux-gnu/libgamemode.so.0+00012367*
*[  6] 0x00007f6444128b12 /usr/share/psychtoolbox-3/PsychBasic/Screen.mexa64+00125714*
*[  7] 0x00007f644416478d /usr/share/psychtoolbox-3/PsychBasic/Screen.mexa64+00370573*
*[  8] 0x00007f64441d33a0 /usr/share/psychtoolbox-3/PsychBasic/Screen.mexa64+00824224 mexFunction+00001296*
*[  9] 0x00007f66157dbde3     /usr/local/MATLAB/R2019b/bin/glnxa64/libmex.so+00548323*
*[ 10] 0x00007f66157dbee5     /usr/local/MATLAB/R2019b/bin/glnxa64/libmex.so+00548581*
*[ 11] 0x00007f66157dc317     /usr/local/MATLAB/R2019b/bin/glnxa64/libmex.so+00549655*
*[ 12] 0x00007f66157dcf93     /usr/local/MATLAB/R2019b/bin/glnxa64/libmex.so+00552851*
*[ 13] 0x00007f66157c87ac     /usr/local/MATLAB/R2019b/bin/glnxa64/libmex.so+00468908*
*[ 14] 0x00007f6617bad15f /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_dispatcher.so+01073503 _ZN8Mfh_file20dispatch_file_commonEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000207*
*[ 15] 0x00007f6617baec5e /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_dispatcher.so+01080414*
*[ 16] 0x00007f6617baf1a1 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_dispatcher.so+01081761 _ZN8Mfh_file8dispatchEiPSt10unique_ptrI11mxArray_tagN6matrix6detail17mxDestroy_deleterEEiPPS1_+00000033*
*[ 17] 0x00007f660a48da63 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+14006883*
*[ 18] 0x00007f660a492816 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+14026774*
*[ 19] 0x00007f660a59983e /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+15104062*
*[ 20] 0x00007f660a58cb91 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+15051665*
*[ 21] 0x00007f660a4f97b4 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+14448564*
*[ 22] 0x00007f660a51fdcd /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+14605773*
*[ 23] 0x00007f6609ca32db /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+05706459*
*[ 24] 0x00007f6609ca5514 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+05715220*
*[ 25] 0x00007f6609ca22bd /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+05702333*
*[ 26] 0x00007f6609c8f791 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+05625745*
*[ 27] 0x00007f6609c8f9c9 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+05626313*
*[ 28] 0x00007f6609ca1ac6 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+05700294*
*[ 29] 0x00007f6609ca1bc6 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+05700550*
*[ 30] 0x00007f6609ddb6e9 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+06985449*
*[ 31] 0x00007f6609ddee23 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+06999587*
*[ 32] 0x00007f660a349891 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+12679313*
*[ 33] 0x00007f660a2f8063 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+12345443*
*[ 34] 0x00007f660a2fc0af /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+12361903*
*[ 35] 0x00007f660a2ff0e2 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+12374242*
*[ 36] 0x00007f660a39872f /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+13002543*
*[ 37] 0x00007f660a398a19 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwm_lxe.so+13003289*
*[ 38] 0x00007f66198914c4 /usr/local/MATLAB/R2019b/bin/glnxa64/libmwbridge.so+00341188 _Z8mnParserv+00000596*
*[ 39] 0x00007f6617f675b5   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwmcr.so+01017269*
*[ 40] 0x00007f662163d42b   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwmvm.so+03097643 _ZN14cmddistributor15PackagedTaskIIP10invokeFuncIN7mwboost8functionIFvvEEEEENS2_10shared_ptrINS2_13unique_futureIDTclfp_EEEEEERKT_+00000059*
*[ 41] 0x00007f662163d518   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwmvm.so+03097880 _ZNSt17_Function_handlerIFN7mwboost3anyEvEZN14cmddistributor15PackagedTaskIIP10createFuncINS0_8functionIFvvEEEEESt8functionIS2_ET_EUlvE_E9_M_invokeERKSt9_Any_data+00000024*
*[ 42] 0x00007f661847689c   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwiqm.so+00751772 _ZN7mwboost6detail8function21function_obj_invoker0ISt8functionIFNS_3anyEvEES4_E6invokeERNS1_15function_bufferE+00000028*
*[ 43] 0x00007f6618476557   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwiqm.so+00750935 _ZN3iqm18PackagedTaskPlugin7executeEP15inWorkSpace_tag+00000439*
*[ 44] 0x00007f6617f56015   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwmcr.so+00946197*
*[ 45] 0x00007f661845b6a0   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwiqm.so+00640672*
*[ 46] 0x00007f661843fe01   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwiqm.so+00527873*
*[ 47] 0x00007f6618440a7f   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwiqm.so+00531071*
*[ 48] 0x00007f6617f3d575   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwmcr.so+00845173*
*[ 49] 0x00007f6617f3db93   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwmcr.so+00846739*
*[ 50] 0x00007f6617f3e404   /usr/local/MATLAB/R2019b/bin/glnxa64/libmwmcr.so+00848900*
*[ 51] 0x00007f661fc13bdd /usr/local/MATLAB/R2019b/bin/glnxa64/libmwboost_thread.so.1.65.1+00080861*
*[ 52] 0x00007f6620442b43                    /lib/x86_64-linux-gnu/libc.so.6+00609091*
*[ 53] 0x00007f66204d4a00                    /lib/x86_64-linux-gnu/libc.so.6+01206784*
*[ 54] 0x0000000000000000                                   <unknown-module>+00000000*


*This error was detected while a MEX-file was running. If the MEX-file*
*is not an official MathWorks function, please examine its source code*
*for errors. Please consult the External Interfaces Guide for information*
*on debugging MEX-files.*

--------------------------------------------------------------------------------
Here is the log for the terminal while running ptb3-matlab,
--------------------------------------------------------------------------------

> johnnylu@johnnylu-MS-7D42:~$ sudo ptb3-matlab*
> 
> *[sudo] password for johnnylu:*
> 
> *Gtk-Message: 13:21:04.056: Failed to load module "canberra-gtk-module"*
> 
> */usr/local/MATLAB/R2019b/bin/glnxa64/jcef_helper: symbol lookup error: /lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: g_memdup2*
> 
> */usr/local/MATLAB/R2019b/bin/glnxa64/jcef_helper: symbol lookup error: /lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: g_memdup2*
> 
> *[II] 0bb4:0309 1-3.2.1.4.1:1.0*
> 
> *[II] opening*
> 
> *[II] 28de:2300 1-3.2.1.3:1.0*
> 
> *[II] opening*
> 
> *[II] 28de:2300 1-3.2.1.3:1.1*
> 
> *[II] 28de:2300 1-3.2.1.3:1.2*
> 
> *[II] manufacturer: 'HTC'*
> 
> *[II] product: 'VIVE Pro'*
> 
> *[II] serial number: '207937574756'*
> 
> *[II] power on magic: 64*
> 
> *[II] Enable Pro IMU magic: 64*
> 
> *[II] Getting feature report 16 to 39*
> 
> *got -1 bytes*
> 
> *[WW] Could not read config. Using defaults.*
> 
> *[WW] Could not get range packet.*
> 
> *[EE] gyro error: -0.022449, 0.052462, -0.050265*
> 
> *libptbdrawtext_ftgl: External 'DrawText' text rendering plugin initialized.*
> 
> *libptbdrawtext_ftgl: Maximum number of cacheable fonts is 40, minimum number of supported concurrent windows is 10.*
> 
> *libptbdrawtext_ftgl: This plugin uses multiple excellent free software libraries to do its work:*
> 
> *libptbdrawtext_ftgl: OGLFT the OpenGL-FreeType library.*
> 
> *libptbdrawtext_ftgl: The FreeType-2 ibrary.*
> 
> *libptbdrawtext_ftgl: The FontConfig library.*
> 
> *libptbdrawtext_ftgl: Thanks!*
> 
> *GameMode ERROR: Could not connect to bus: /usr/bin/dbus-launch terminated abnormally with the following error: EOF in dbus-launch reading address from bus daemon*
> 
> *dbus[4889]: arguments to dbus_connection_unref() were incorrect, assertion "connection != NULL" failed in file ../../../dbus/dbus-connection.c line 2822.*
> 
> *This is normally a bug in some application using the D-Bus library.*
> 
> *D-Bus not built with -rdynamic so unable to print a backtrace*
> 
> *Segmentation fault (core dumped)*
*--------------------------------------------------------------------------------*

Anyone who has used HTC Vive Pro with PTB met this issue before? I believe it might be due to the Ubuntu itself and I need to install an older one like 20.04 or 18.04? I tried different versions of MATLAB (R2019b and R2021a) but all failed.

Thank you so much!

Best,
Johnny

This will probably require support from Mario. But to save you some time I doubt rolling back Ubuntu will help, in general it is good to stick to the latest PTB and the version of the OS that is officially supported (in this case 22.04). While generally unlikely, I suppose it is possible this is a regression, I doubt there are many people using the VR interface…

By the way, I’ve noticed Mario is doing a lot of work on an OpenXR interface in his dev repo, so just a heads-up that there may be some changes for VR + PTB in the undefined future…

That dies in gamemode, called by Priority(). Maybe because you launch Matlab via sudo, a highly ill advised thing to do, it can screw things up in various ways. → If you need sudo for regular use of PTB, you are doing something wrong. I have a hunch what it is:

help PsychPaidSupportAndServices for further advice.

And yes, I’m working on finalizing the first release of our new OpenXR driver for VR/AR/MR applications, with an ever shifting ETA for the driver and the next PTB release… - every given day, the finish line is one week away. OpenXR runtimes (with the exception of the Monado open-source runtime for Linux) turn out to be heaps of bugs piled on bugs piled on bugs and already the driver has more workarounds for shoddy proprietary OpenXR runtimes than it has actual features. Eventually this driver should replace all other VR drivers we have.

Hello Mario,

Thank you so much for that! I tried to run ptb3-matlab without sudo and the issue didn’t happen, it works! However, I found that the OpenHMD could recognise but couldn’t open the VR properly. VR could be opened under sudo ptb3-matlab. It just said,

>> VRHMDDemo1_2
PsychOpenHMDVRCore-INFO: OpenHMD VR runtime version 0.3.0 initialized.
PsychOpenHMDVRCore-INFO: At startup there are 5 OpenHMD HMDs available.
PsychOpenHMDVRCore-ERROR: Failed to connect to OpenHMD device with deviceIndex 0. This could mean that the device
PsychOpenHMDVRCore-ERROR: is already in use by another application or driver.
Error in function Open: 	Usage error
Could not connect to OpenHMD device with given 'deviceIndex'! [ohmd_list_open_device() failed]
Error using PsychOpenHMDVR
Error using PsychOpenHMDVRCore
Usage:

[openhmdPtr, modelName, panelSizeX, panelSizeY, controllerTypes, controllerFlags] = PsychOpenHMDVRCore('Open' [, deviceIndex=0]);

Error in PsychOpenHMDVR (line 907)
    newhmd = PsychOpenHMDVR('Open', deviceIndex);

Error in PsychVRHMD (line 701)
    hmd = PsychOpenHMDVR('AutoSetupHMD', basicTask, basicRequirements, basicQuality, deviceIndex);

Error in VRHMDDemo1_2 (line 76)
  hmd = PsychVRHMD('AutoSetupHMD', 'Tracked3DVR', 'LowPersistence TimeWarp FastResponse DebugDisplay', 0,[],0);

And the terminal kept saying that it required permission,

johnnylu@johnnylu-MS-7D43:~$ ptb3-matlab
Gtk-Message: 10:07:30.377: Failed to load module "canberra-gtk-module"
[II] 0bb4:0309 1-3.2.1.4.1:1.0

[II] opening

[EE] Could not open device with index: 0, check device permissions?
[II] 0bb4:0309 1-3.2.1.4.1:1.0

[II] opening

[EE] Could not open device with index: 0, check device permissions?
[II] 0bb4:0309 1-3.2.1.4.1:1.0

[II] opening

[EE] Could not open device with index: 0, check device permissions?
[II] 0bb4:0309 1-3.2.1.4.1:1.0

[II] opening

[EE] Could not open device with index: 0, check device permissions?
[II] 0bb4:0309 1-3.2.1.4.1:1.0

[II] opening

[EE] Could not open device with index: 0, check device permissions?

Thank you so much!

Best wishes,
Zhuoen

help PsychPaidSupportAndServices for further advice.
-mario