"GPU process isn't usable. Goodbye." - macos

I'm experimenting with building a Windows and Mac OS app using Electron and have hit a snag.
In short, if I try to run the application directly with Electron on Mac OS Big Sur (as opposed to building a Mac app and then running that) I get the following error returned:
[35941:0821/171720.038162:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.
I am running directly with Electron using the following in my package.json:
"scripts": {
...
"test": "electron main.js",
...
}
So far the only Mac OS environment I have access to is Big Sur so haven't tried this on earlier versions of Mac OS but from Googling it seems this error may be related to Big Sur's tightened security/sandbox constraints -- but I am guessing about that.
In any case, after some Googling several suggestions indicated trying to run without the app sandbox, i.e. adding this to main.js:
app.commandLine.appendSwitch('no-sandbox');
That's all well and good and works.
However, if I ever want to build and distribute a signed Mac app targeting the Mac App store or a just a signed, sandboxed DMG or PKG installer, then this won't be suitable.
If I remove the above no-sandbox command from main.js and specify the app sandbox in my entitlements plist as shown below the resulting signed app will not run:
<key>com.apple.security.app-sandbox</key>
<true/>
The app tries to open and just closes. I can try running at the command line with open <appname>.app but this throws the following error in the console:
The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10826 "kLSNoLaunchPermissionErr: User doesn't have permission to launch the app (managed networks)" UserInfo={_LSFunction=_LSLaunchWithRunningboard, _LSLine=2561, NSUnderlyingError=0x7fd3c9c13db0 {Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7fd3c9c158e0 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed with error: 153}}}}}
If I build a signed app with no-sandbox enabled, the app will run just fine on Big Sur using open <appname>.app.
I have tried my best through Google, Stack Overflow, etc to diagnose this but am not getting anywhere. Here's to hoping the Stack Overflow community can provide me the critical clue to solving this.
For further context, I created a new, empty Electron application and followed the Electron Quick Start Guide to the section where it describes creating an empty main.js which technically should allow the Electron app to start -- but it won't. The same error describe above re the GPU gets thrown even without instantiating a BrowserWindow or writing any custom code of my own.
NEW UPDATE: I set these environment variables to true and then tried running the app with npm start:
ELECTRON_ENABLE_LOGGING
ELECTRON_DEBUG_NOTIFICATIONS
ELECTRON_ENABLE_STACK_DUMPING
The result is more detailed error output:
[48836:0823/165857.676747:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
[48836:0823/165857.676838:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
[48778:0823/165857.677376:ERROR:gpu_process_host.cc(1003)] GPU process exited unexpectedly: exit_code=5
[48778:0823/165857.677430:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 1 time(s)
[48850:0823/165857.827224:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
[48848:0823/165857.827255:ERROR:icu_util.cc(179)] icudtl.dat not found in bundle
[48850:0823/165857.827341:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
[48848:0823/165857.827358:ERROR:icu_util.cc(243)] Invalid file descriptor to ICU data received.
[48778:0823/165857.827836:ERROR:gpu_process_host.cc(1003)] GPU process exited unexpectedly: exit_code=5
[48778:0823/165857.827875:WARNING:gpu_process_host.cc(1317)] The GPU process has crashed 2 time(s)
... repeats until the GPU processes crashes 9 times ...
[48778:0823/165903.080134:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.
Haven't had time to do the research as to what ICU refers to but thought I would update with this info.
ANOTHER UPDATE: all this has been done on Mac OS Big Sur which is my main development machine. Trying this on a Windows 10 machine, using the same Electron code, dependencies, etc and things work fine. So the problem is either related to Mac OS Big Sur or a specific local issue on my development machine which I cannot identify. Any suggestions on how to diagnose this will be much appreciated.
ONE MORE UPDATE: Based on a guess, I created a new user on my mac, took the code in there and it ran perfectly. So -- this probably means that I need to find something installed in my profile or some corruption in my own profile/settings that is breaking things. As always, any suggestions appreciated it.

In my case, I got this to work using command line switch, --in-process-gpu, or:
app.commandLine.appendSwitch('in-process-gpu');
There's also an extensive list of Chromium switches here that you can try at:
https://peter.sh/experiments/chromium-command-line-switches/
Yeah, the whole hardened runtime thing is just such an awful, awful mess! Now to figure out the next crash!

So -- partial answer. I think I've found the solution to this error:
GPU process isn't usable. Goodbye.
My development directories are all on a file system accessed via a symbolic link. As soon as I moved the folder for this app to my my home directory (no symlinks involved) I could launch with npm start without needing to enable no-sandbox and without seeing this error or the errors related to icudtl.dat.
I haven't yet determined if the problem described with the error below when launching the packaged app is related/solved:
The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10826 "kLSNoLaunchPermissionErr: User doesn't have permission to launch the app (managed networks)" UserInfo={_LSFunction=_LSLaunchWithRunningboard, _LSLine=2561, NSUnderlyingError=0x7fd3c9c13db0 {Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x7fd3c9c158e0 {Error Domain=NSPOSIXErrorDomain Code=153 "Unknown error: 153" UserInfo={NSLocalizedDescription=Launchd job spawn failed with error: 153}}}}}
That said, it is a big step forward.

I have a similar issue on a linux machine with an electron app. The answer in this github issue helped me.
Using --disable-gpu-sandbox flag with electron apps solved it for me.

The underlying problem seems to be that the Mac OS sandbox is preventing the GPU process to spawn properly.
You can specify a variety of entitlements when packaging your application, but not all entitlements are created equally, especially entitlements that want access to the keychain, secure enclave and TouchID.
If you're specifying a provisioning profile - make sure that all those entitlements are only in the original file, keep your inherited entitlements empty or to the bare minimum. In my case, I had the keychain-access-groups specified in my inherited entitlements which was a painful lesson to learn. Removing it made the builds not crash!
I believe in your case it's likely that you tried to access files outside of the application itself which might have caused the sandbox to prevent opening the GPU processes.

I know the OP reported this against MacOS, but on my Windows 10 VM I used the following instructions to create the electron-quick-start app…
net use T: \\busdata\company\BrianT
T:
cd \Development\Sandbox\electron
"C:\Users\thomasb\AppData\Local\GitHubDesktop\app-2.9.15\resources\app\git\cmd\git.exe" clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install && npm start
…and then electron wrote error messages to the console, the same errors as those reported by the OP:
[5796:1025/121431.238:ERROR:gpu_process_host.cc(969)] GPU process launch failed: error_code=18
[5796:1025/121431.328:FATAL:gpu_data_manager_impl_private.cc(441)] GPU process isn't usable. Goodbye.
An earlier answer mentioned symbolic links, and to investigate that further I xcopied the entire electron-quick-start folder down from T: (a remapped network folder) to C: (my local disk).
When I then ran npm start in the folder that I'd copied down to C: there was no error.
Looks like electron is being fussy about where the source files live.

I had the same Issue when running the files off of a server such as a nas, but moving files to local storage solved the issue.

Related

Failed to launch macOS app built in Xcode

I've built an App in Xcode in release mode. Is signed with valid Developer ID certificate. And the app launches fine on some MacBooks.
But on another launch fails with error
The application %name% can't be opened.
Then I try to launch it from terminal with open command it says
LSOpenURLsWithRole() failed with error -54 for the file /Applications/Gaetano Lunches.app.
And then I try to launch directly the binary file from package contents
it says
-bash: /Applications/Gaetano Lunches.app/Contents/MacOS/Gaetano Lunches: Operation not permitted
On all MacBooks app installation from Anywhere is allowed. spctl-master is disabled. Permissions for files are correct. But the app cannot be launched.
I don't know how you are building your app, but if LSOpenURLsWithRole is returning permError = -54, this means you have a permission error on opening a file. This can mean a lot of things, but building an app in release mode is no longer what Apple recommends for you to do. Apple prefers that you use Archive and then you export the app in Organizer to be used by your users. By using this work flow, normally you can do everything using the Xcode defaults for building an app. If you don't, then you need to be more careful with the settings you choose for building in release mode.
For a quick and dirty approach, I would try the following:
1) Open the terminal
2) Type: chmod +x "/Applications/Gaetano Lunches.app/Contents/MacOS/Gaetano Lunches"
3) Try to launch your app and see if it helps. If it helps, there is something messed up with your build settings, which is failing to change the file permissions somewhere for your executable to have the right permissions to be launched.
Another thing you could try is see whether your app was blacklisted by Gatekeeper, because somehow it determined your app is doing suspicious things on your own system. If that is the case, then you can try this to see what gatekeeper is assessing:
spctl -a "/Applications/Gaetano Lunches.app"
If for some weird reason you app is being blacklisted by Gatekeeper, you can always add your app manually and whitelist it for Gatekeeper:
spctl --add "/Applications/Gaetano Lunches.app"
If all fails, you can try to reset the whole database, but you will need super user access:
sudo spctl --reset-default
However, I think these are just quick fixes, and if you keep needing this is because your build settings in Xcode must be adjusted. More on that, if any of these solutions work. Let me know about that.

Launch VSCode from source through WSL

I would like to build/launch the VSCode source code in the native Bash for Windows client. I have followed the steps outlined in the VSCode wiki on how to contribute, and everything is working as expected (All commands have been run on the WSL terminal following the Linux instructions)
After running yarn run watch, I try to launch VSCode by running DISPLAY=:0 ./scripts/code.sh from the source code directory, but nothing happens. I get two duplicate warnings:
[21496:1128/120229.392130:WARNING:audio_manager.cc(295)] Multiple instances of AudioManager detected
but I'm not sure if this is causing the problem. I have an X Server client running, and have used to to successfully launch native Windows applications through WSL (terminator, emacs, etc.)
Is what I'm trying to do possible? If so, how can I make it work?
Amazing that you asked this! I was attempting to do the exact same thing at (it seems) the exact same time. Here's my process.
Install XMing
Install the xfree apps
Set DISPLAY=:0
Run xeyes ==> Awesome googly eyes!
Attempt to build vscode from source. The build docs seem to be incomplete b/c I had to install a ton of libraries beyond those listed e.g.
yarn
gulp
gulp-cli
pkg-config
libx11-dev
libxkbfile-dev
libsecret-1-dev
libgtk2.0-dev
libxss-dev
gnome-dev
libgconf2-dev
libnss3-dev
libasound2-dev
Eventually get the yarn tasks to finish such that I could run code.sh
./scripts/code.sh
[20474:1128/153959.035267:ERROR:bus.cc(427)] Failed to connect to the bus: F
ailed to connect to socket /var/run/dbus/system_bus_socket: No such file or
directory
[20474:1128/153959.081986:WARNING:audio_manager.cc(295)] Multiple instances
of AudioManager detected
[20474:1128/153959.082101:WARNING:audio_manager.cc(254)] Multiple instances
of AudioManager detected
Looking at ps I see that the process was running.
Conjectures
It seems that building from source from WSL is not yet supported. Or maybe you can build the artifact, but you can't connect to the Windows display to show it. Based on the quality of the xeyes session, it looks like a very, very, very primitive experience e.g. still using WinXP-style minimize / maximize / close icons.
I was literally writing an Issue on their github page when I thought I'd do one last search and found this post. Much of vscode treats WSL as a second-class environment on Windows. Recent work seems to suggest that things are going to get better as driving to integration between Windows' two internal environments continues to improve (e.g. https://github.com/Microsoft/vscode/issues/39144)
Update 2017-11-30
Based on some pursuit via Github, it seems that this issue has been reported to the WSL team: https://github.com/Microsoft/WSL/issues/2293. It appears to be under active consideration by the WSL team. I've added some commentary about my use case there.

External makefile in Atmel Studio won't build. Windows error 0xc0000142

I downloaded bitcloud, the atmel zigbee stack and I am trying to compile one of the default applications, ZLLDemo.
It is located currently at:
C:\Users\Ryan\Desktop\BitCloud_MEGARF_3_1_0\Applications\ZLLDemo\atmelStudio_projects\ATmega256RFR2.cproj
Everytime I try to compile the application I get a windows message screen for "mkdir.exe" error 0xc0000142. In the Output screen I see the line "make: *** [directories] Error -1073741502"
This same error and error code occurs later in the build process for cp.exe if I manually make the folders myself.
I have tried the following things to fix the error:
Change folder and contents to different owners, everyone having full
privileges
run make command manually from a command prompt window as admin
clean solution before retrying
all other examples files
ran directly from C: as "C:\BitCloud_MEGARF_3_1_0\Applications\ZLLDemo\atmelStudio_projects\ATmega256RFR2.cproj" - as per general suggestion for the windows error I tried
"sfc /scannow" in case mkdir had somehow been corrupted
Changed AppInitDLLs Reg key to 0 to load all DLLs at start of application
Disabled Internet security
Does this have a general fix or is there perhaps something else at work here? General compilations work, its just external ones. My friend did the same and it seems to work just fine for him.
Windows 8.1
Atmel Studio 6.2
Avrfreaks had a solution that I finally found here.
Their solution is to download an old version of the msys file for winavr. Which means that their is something more than likely wrong with the latest version of winavr for windows 8.1
sebastor wrote:
I found solution.
Copy this file:
http://www.madwizard.org/download/electronics/msys-1.0-vista64.zip
to utils\bin directory (WinAVR)

Running OSX Bundle via Open

I'm trying to make an OSX bundle using CMake/CPack on OSX that involves OpenCV and Qt (although I don't think those dependencies matter at this point). Everything compiles and the bundle is created fine, and I have a script that modifies the necessary library paths such the executable I'm making works if I run it from the Terminal within the bundle. The problem I'm having is if I try to run the MyApp.app file via the open command or by simply double clicking the app it gives me the error:
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/
I've seen other solutions to other LSOpenURLsWithRole() errors involving modifying permissions, but that hasn't helped me. Also, this error code is an "unknown error" so I'm not sure how to proceed.
The solution for this ended up being that the libcocoa.dylib library was not finding the requisite libraries. See Building OSX App Bundle for a thorough answer on the subject. otool -L is your best friend.

Shared Library on Mac OSX and QT

Does anyone know how to get rid of this problem? I am using a Mac for developing for Maemo 5.
Killing remote process(es)...
Starting remote process...
Remote process started.
/opt/Blue/bin/Blue: error while loading shared libraries: libQtConnectivity.so.1: cannot open shared object file: No such file or directory
Finished running remote process. Exit code was 127.
I have followed the instructions here:
http://www.developer.nokia.com/Community/Wiki/Latest_Qt_and_Qt_mobility_evaluation_on_Maemo
I think I just need to make sure my mac links to that file, how to do that?
Building the package is fine but I get the error when I try to deploy it on my N900 phone. The error appears in the QTCreator output.

Resources