microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
159.32k stars 27.87k forks source link

disable-chromium-sandbox: true ignored in portable mode #205096

Closed vaclavHala closed 2 weeks ago

vaclavHala commented 3 months ago

Does this issue occur when all extensions are disabled?: Yes

  1. download .tar.gz package with vscode, untar
  2. mkdir data inside untarred to enable portable mode
  3. run ./code --no-sandbox so data folder gets initialized
  4. add "disable-chromium-sandbox": true into data/argv.json
  5. run just ./code

Expected

VSCode starts without errors, with sandbox disabled

Actual

[4454:0213/120617.459403:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that .../VSCode-linux-x64/chrome-sandbox is owned by root and has mode 4755.

Full content of data/argv.json

// This configuration file allows you to pass permanent command line arguments to VS Code.
// Only a subset of arguments is currently supported to reduce the likelihood of breaking
// the installation.
//
// PLEASE DO NOT CHANGE WITHOUT UNDERSTANDING THE IMPACT
//
// NOTE: Changing this file requires a restart of VS Code.
{
    // Use software rendering instead of hardware accelerated rendering.
    // This can help in cases where you see rendering issues in VS Code.
    // "disable-hardware-acceleration": true,

    // Allows to disable crash reporting.
    // Should restart the app if the value is changed.
    "enable-crash-reporter": true,

    // Unique id used for correlating crash reports sent from this instance.
    // Do not edit this value.
    "crash-reporter-id": "c8e63f6d-1a5a-41c7-903b-b5723f496729",

        "disable-chromium-sandbox": true
}

I also tried removing all the comments in case the setuid_sandbox_host.cc is expecting regular json not jsonc but that did not help.

I'm aware of https://code.visualstudio.com/updates/v1_59#_progress-for-electron-sandbox-support fixing the permissions on chrome-sandbox is not a solution to this issue. I want to go the --no-sandbox path but without requiring user to write the parameter every time, rather having it persisted in argv.json

deepak1556 commented 3 months ago

After step 4., can you set the following env variable export CHROME_DEVEL_SANDBOX='' and start ./code. Application should start now, in a new terminal run ps -aux | grep code and paste the full output with command line args included.

vaclavHala commented 3 months ago

@deepak1556 tried what you wanted, it does not start

bash-4.4$ export CHROME_DEVEL_SANDBOX=''
bash-4.4$ ./code
[673:0214/100305.962882:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/gitlab-ci/vscode86/VSCode-linux-x64/chrome-sandbox is owned by root and has mode 4755.
Trace/breakpoint trap (core dumped)
bash-4.4$ [675:0100/000000.007852:ERROR:zygote_linux.cc(662)] write: Broken pipe (32)

output of ps -aux | grep code after this is empty (well shows the grep itself, but no vscode)

I'm running this in headless docker with xvfb (OS in the docker container is as reported in my first post) if that makes any difference

deepak1556 commented 3 months ago

I'm running this in headless docker with xvfb (OS in the docker container is as reported in my first post) if that makes any difference

Can you expand a bit more on this setup. Is the main goal to use VS Code desktop from within docker for development or is this for running tests against VS Code desktop application itself ?

vaclavHala commented 3 months ago

We are trying to build a self-contained bundle containing portable VSCode with some predefined user settings, some extensions preinstalled and some of the builtin ones disabled. Eventually our (internal) users should be able to just unpack the bundle and start using it without connection to the Internet.

Preparation of the bundle is done in the headless docker where the problem described by this issue manifests.

When I follow the same steps as described here in regular PC where users are expected to eventually run the bundle, VSCode crashes on startup with (reason: 'crashed', code: '132') . In the case with regular PC it works fine though without setting the "disable-chromium-sandbox": true, either when run as ./code or ./codde --no-sandbox which is strange as the chrome-sandbox is not owned by root.

Full log of the crash:

[3419478:0214/121215.718805:ERROR:angle_platform_impl.cc(44)] Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Unsupported GLX version (requires at least 1.3).
ERR: Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Unsupported GLX version (requires at least 1.3).
[3419478:0214/121215.718926:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Unsupported GLX version (requires at least 1.3).
[3419478:0214/121215.718942:ERROR:gl_display.cc(795)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[3419478:0214/121215.719262:ERROR:angle_platform_impl.cc(44)] Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Unsupported GLX version (requires at least 1.3).
ERR: Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Unsupported GLX version (requires at least 1.3).
[3419478:0214/121215.719289:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Unsupported GLX version (requires at least 1.3).
[3419478:0214/121215.719298:ERROR:gl_display.cc(795)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[3419478:0214/121215.719311:ERROR:gl_display.cc(829)] Initialization of all EGL display types failed.
[3419478:0214/121215.719345:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed.
[3419478:0214/121215.721206:ERROR:angle_platform_impl.cc(44)] Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Unsupported GLX version (requires at least 1.3).
ERR: Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Unsupported GLX version (requires at least 1.3).
[3419478:0214/121215.721248:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Unsupported GLX version (requires at least 1.3).
[3419478:0214/121215.721257:ERROR:gl_display.cc(795)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[3419478:0214/121215.721613:ERROR:angle_platform_impl.cc(44)] Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Unsupported GLX version (requires at least 1.3).
ERR: Display.cpp:1056 (initialize): ANGLE Display::initialize error 12289: Unsupported GLX version (requires at least 1.3).
[3419478:0214/121215.721637:ERROR:gl_display.cc(520)] EGL Driver message (Critical) eglInitialize: Unsupported GLX version (requires at least 1.3).
[3419478:0214/121215.721644:ERROR:gl_display.cc(795)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[3419478:0214/121215.721737:ERROR:gl_display.cc(829)] Initialization of all EGL display types failed.
[3419478:0214/121215.721746:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed.
[3419478:0214/121215.725543:ERROR:viz_main_impl.cc(196)] Exiting GPU process due to errors during initialization
[main 2024-02-14T11:12:16.015Z] update#setState idle
[3419518:0214/121216.352556:ERROR:platform_shared_memory_region_posix.cc(214)] Creating shared memory in /dev/shm/.org.chromium.Chromium.eAewjU failed: No such file or directory (2)
[3419518:0214/121216.352971:ERROR:platform_shared_memory_region_posix.cc(217)] Unable to access(W_OK|X_OK) /dev/shm: No such file or directory (2)
[3419518:0214/121216.353096:FATAL:platform_shared_memory_region_posix.cc(219)] This is frequently caused by incorrect permissions on /dev/shm.  Try 'sudo chmod 1777 /dev/shm' to fix.
[0214/121216.371607:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0214/121216.371763:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[0214/121216.375233:ERROR:directory_reader_posix.cc(42)] opendir /home/user/Downloads/vscode86/VSCode-linux-x64/data/user-data/Crashpad/attachments/d1193ff0-c39b-4406-b881-1199c9ef25f7: No such file or directory (2)
[main 2024-02-14T11:12:16.611Z] CodeWindow: renderer process gone (reason: crashed, code: 132)
vaclavHala commented 3 months ago

Hi @deepak1556 I see this still has the info-needed label. Is there something else you need me to provide in addition to the info I posted above?

VSCodeTriageBot commented 3 weeks ago

Hey @deepak1556, this issue might need further attention.

@vaclavHala, you can help us out by closing this issue if the problem no longer exists, or adding more information.

VSCodeTriageBot commented 2 weeks ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!