使用Electron打包成客户端在麒麟Linux 操作系统上运行,普通用户启动程序正常
使用root用户出现各种问题。总结问题如下:
1. Running as root without --no-sandbox is not supported。
解决方案:
在启动命令后面加入 --no-sandbox
sudo ./xxxx-client --no-sandbox
2. linux-unpacked/libGLESv2.so: 无法打开共享对象文件: 权限不够
即使使用 chmod -R 777 linux-unpacked 和 chown -root 也没用,依旧提示这个问题,这是因为当前 当前打包的文件在 当前用户的目录,root 对应 当前普通用户是无权限,虽然对当前文件夹是有前端。
3.将文件移动到root用户可访问权限,依然出错:
ERROR:gpu_init.cc(521)] Passthrough is not supported, GL is disabled, ANGLE is
[9033:1208/223621.958382:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[9033:1208/223621.958468:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
No protocol specified
No protocol specified
No protocol specified
No protocol specified
[9060:1208/223621.977332:ERROR:angle_platform_impl.cc(43)] DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1
ERR: DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1
[9060:1208/223621.986702:ERROR:angle_platform_impl.cc(43)] Display.cpp:997 (initialize): ANGLE Display::initialize error 12289: Not initialized.
ERR: Display.cpp:997 (initialize): ANGLE Display::initialize error 12289: Not initialized.
[9060:1208/223621.987595:ERROR:gl_display.cc(508)] EGL Driver message (Critical) eglInitialize: Not initialized.
[9060:1208/223621.988041:ERROR:gl_display.cc(920)] eglInitialize SwANGLE failed with error EGL_NOT_INITIALIZED
[9060:1208/223621.988148:ERROR:gl_ozone_egl.cc(23)] GLDisplayEGL::Initialize failed.
[9033:1208/223621.989891:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[9060:1208/223621.991533:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
[9033:1208/223622.018512:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
No protocol specified
No protocol specified
No protocol specified
No protocol specified
[9102:1208/223622.065007:ERROR:angle_platform_impl.cc(43)] DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1
ERR: DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1
[9102:1208/223622.065302:ERROR:angle_platform_impl.cc(43)] Display.cpp:997 (initialize): ANGLE Display::initialize error 12289: Not initialized.
ERR: Display.cpp:997 (initialize): ANGLE Display::initialize error 12289: Not initialized.
[9102:1208/223622.065574:ERROR:gl_display.cc(508)] EGL Driver message (Critical) eglInitialize: Not initialized.
[9102:1208/223622.067751:ERROR:gl_display.cc(920)] eglInitialize SwANGLE failed with error EGL_NOT_INITIALIZED
[9102:1208/223622.068074:ERROR:gl_ozone_egl.cc(23)] GLDisplayEGL::Initialize failed.
[9102:1208/223622.070425:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
No protocol specified
No protocol specified
No protocol specified
No protocol specified
[9121:1208/223622.087280:ERROR:angle_platform_impl.cc(43)] DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1
ERR: DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1
[9121:1208/223622.087462:ERROR:angle_platform_impl.cc(43)] Display.cpp:997 (initialize): ANGLE Display::initialize error 12289: Not initialized.
ERR: Display.cpp:997 (initialize): ANGLE Display::initialize error 12289: Not initialized.
[9121:1208/223622.087569:ERROR:gl_display.cc(508)] EGL Driver message (Critical) eglInitialize: Not initialized.
[9121:1208/223622.087659:ERROR:gl_display.cc(920)] eglInitialize SwANGLE failed with error EGL_NOT_INITIALIZED
[9121:1208/223622.087756:ERROR:gl_ozone_egl.cc(23)] GLDisplayEGL::Initialize failed.
[9121:1208/223622.089572:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
No protocol specified
No protocol specified
[9129:1208/223622.099118:ERROR:gpu_init.cc(521)] Passthrough is not supported, GL is disabled, ANGLE is
[9129:1208/223622.101894:ERROR:x11_software_bitmap_presenter.cc(142)] XGetWindowAttributes failed for window 132120579
出现此问题是由于 electron的版本过高,导致麒麟系统访问的chromdriver出现的bug,
出现
[9129:1208/223622.099118:ERROR:gpu_init.cc(521)] Passthrough is not supported, GL is disabled, ANGLE is 错误,找到一篇解决访问博客是因为版本chrome内核版本过高,
python - Passthrough is not supported, GL is disabled - Stack Overflowhttps://stackoverflow.com/questions/67501093/passthrough-is-not-supported-gl-is-disabled
因此查找对应关系如图
此处我使用的版本是 "electron": "^21.3.0",chrome 对应的版本如图
图片来自 入坑摸鱼。
根据博客解决方案为切换到89版本一下不在出现
因此将electron版本下降到v12.2.3以下版本解决问题。