Chromium headless 页面无响应,但适用于 firefox

Chromium headless page unresponsive but works on firefox

我在 Raspberry Pi 型号 4B 和 Ubuntu 20 上使用 Chromium 运行ning headless 时遇到问题。为了显示浏览器,我使用的是官方 Raspberry Pi 触摸屏.

问题是本地托管的页面无法加载,并显示“页面无响应”。但是,如果我按下“退出页面”按钮,然后按下“重新加载”按钮,它就会开始正常工作。

我正在使用以下命令启动 Chromium:xinit /usr/bin/sh -c "chromium-browser --kiosk 127.0.0.1:5000"。如果我使用 运行 相同的命令,但使用 firefox 而不是 chromium-browser,则该页面有效。我不想使用 Firefox,因为它在无头模式下还有一些其他问题。这就是为什么我得出结论,问题不在于网页,而在于铬。

我尝试使用 npm run servepython3 -m http.server 5000 托管网页,但总是遇到同样的问题。

我不知道这是否重要,但是当 运行 使用上述命令打开 chromium 浏览器时,我收到以下错误消息:

[18281:18281:1203/112557.242527:ERROR:angle_platform_impl.cc(44)] Display.cpp:894 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[18281:18281:1203/112557.243222:ERROR:gl_surface_egl.cc(782)] EGL Driver message (Critical) eglInitialize: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[18281:18281:1203/112557.243611:ERROR:gl_surface_egl.cc(1382)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[18281:18281:1203/112557.244683:ERROR:angle_platform_impl.cc(44)] Display.cpp:894 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[18281:18281:1203/112557.244958:ERROR:gl_surface_egl.cc(782)] EGL Driver message (Critical) eglInitialize: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[18281:18281:1203/112557.245153:ERROR:gl_surface_egl.cc(1382)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[18281:18281:1203/112557.245355:ERROR:gl_ozone_egl.cc(20)] GLSurfaceEGL::InitializeOneOff failed.
[18281:18281:1203/112557.312801:ERROR:viz_main_impl.cc(161)] Exiting GPU process due to errors during initialization
[18324:18324:1203/112557.722696:ERROR:angle_platform_impl.cc(44)] Display.cpp:894 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[18324:18324:1203/112557.724405:ERROR:gl_surface_egl.cc(782)] EGL Driver message (Critical) eglInitialize: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[18324:18324:1203/112557.725290:ERROR:gl_surface_egl.cc(1382)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[18324:18324:1203/112557.727887:ERROR:angle_platform_impl.cc(44)] Display.cpp:894 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[18324:18324:1203/112557.728730:ERROR:gl_surface_egl.cc(782)] EGL Driver message (Critical) eglInitialize: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[18324:18324:1203/112557.729189:ERROR:gl_surface_egl.cc(1382)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[18324:18324:1203/112557.729615:ERROR:gl_ozone_egl.cc(20)] GLSurfaceEGL::InitializeOneOff failed.
[18324:18324:1203/112557.794755:ERROR:viz_main_impl.cc(161)] Exiting GPU process due to errors during initialization
[18345:18345:1203/112557.868079:ERROR:angle_platform_impl.cc(44)] Display.cpp:894 (initialize): ANGLE Display::initialize error 0: Internal Vulkan error (-3): Initialization of an object could not be completed for implementation-specific reasons, in ../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.cpp, initialize:1048.
[18345:18345:1203/112557.868777:ERROR:gl_surface_egl.cc(782)] EGL Driver message (Critical) eglInitialize: Internal Vulkan error (-3): Initialization of an object could not be completed for implementation-specific reasons, in ../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.cpp, initialize:1048.
[18345:18345:1203/112557.869337:ERROR:gl_surface_egl.cc(1382)] eglInitialize SwANGLE failed with error EGL_NOT_INITIALIZED
[18345:18345:1203/112557.869934:ERROR:gl_ozone_egl.cc(20)] GLSurfaceEGL::InitializeOneOff failed.
[18345:18345:1203/112557.928770:ERROR:viz_main_impl.cc(161)] Exiting GPU process due to errors during initialization
[18353:18353:1203/112557.961644:ERROR:gpu_init.cc(457)] Passthrough is not supported, GL is disabled, ANGLE is
[18072:18265:1203/112602.637067:ERROR:chrome_browser_main_extra_parts_metrics.cc(226)] crbug.com/1216328: Checking Bluetooth availability started. Please report if there is no report that this ends.
[18072:18265:1203/112602.637684:ERROR:chrome_browser_main_extra_parts_metrics.cc(229)] crbug.com/1216328: Checking Bluetooth availability ended.
[18072:18265:1203/112602.637924:ERROR:chrome_browser_main_extra_parts_metrics.cc(232)] crbug.com/1216328: Checking default browser status started. Please report if there is no report that this ends.
[18072:18265:1203/112602.833205:ERROR:chrome_browser_main_extra_parts_metrics.cc(236)] crbug.com/1216328: Checking default browser status ended.

此外,如果我 运行 一些其他网页,例如 google.com 使用此命令,我会收到相同的错误消息,但网页显示没有问题。

网页写在Vue.js

我已经通过禁用硬件加速解决了这个问题。我这样做是因为我在这里发现了类似的问题:https://unix.stackexchange.com/questions/344138/chromium-google-maps-issue

我通过在命令中添加 --disable-gpu 标志来做到这一点。