Chromium 无头页面无响应但适用于 Firefox
Posted
技术标签:
【中文标题】Chromium 无头页面无响应但适用于 Firefox【英文标题】:Chromium headless page unresponsive but works on firefox 【发布时间】:2022-01-09 18:54:47 【问题描述】:我在 Ubuntu 20 的 Raspberry Pi 模型 4B 上无头运行 Chromium 时遇到问题。为了显示浏览器,我使用的是官方的 Raspberry Pi 触摸屏。
问题是本地托管页面无法加载,并且显示“页面无响应”。但是,如果我按“退出页面”按钮,然后按“重新加载”按钮,它就会开始正常工作。
我正在使用以下命令启动 Chromium:xinit /usr/bin/sh -c "chromium-browser --kiosk 127.0.0.1:5000"
。如果我运行相同的命令,但使用firefox
而不是chromium-browser
,则该页面有效。我不想使用 Firefox,因为它在无头模式下还有其他一些问题。这就是为什么我得出结论,问题不在于网页,而在于铬。
我尝试使用npm run serve
和python3 -m http.server 5000
托管网页,但总是遇到同样的问题。
我不知道这是否重要,但是当我使用上述命令运行 chromium-browser 时收到以下错误消息:
[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 编写的
【问题讨论】:
【参考方案1】:我已通过禁用硬件加速解决了这个问题。我这样做是因为我在这里发现了类似的问题:https://unix.stackexchange.com/questions/344138/chromium-google-maps-issue
我通过在命令中添加--disable-gpu
标志来做到这一点。
【讨论】:
以上是关于Chromium 无头页面无响应但适用于 Firefox的主要内容,如果未能解决你的问题,请参考以下文章
适用于 Python 的无头浏览器(需要 Javascript 支持!)[关闭]
适用于 iOS 的 Phonegap/Cordova 日历插件无响应