VS Code Remote-SSH is a game-changer for remote development. However, if you’ve tried a recent version of VS Code (1.99.x or later) to connect to an older Linux distro, you may encounter this error:
[LinuxPrereqs]: The remote host may not meet VS Code Server's prerequisites for glibc and libstdc++ (The remote host does not meet the prerequisites for running VS Code Server)
This error indicates that the system requires:
glibc >= 2.28libstdc++ >= 3.4.25
This issue is common with older CentOS, Debian, or Ubuntu LTS systems.
Fortunately, a workaround using brew, glibc, and patchelf can enable Remote-SSH on unsupported Linux targets. This guide will walk you through the steps.
Solutions
- Install
glibcandpatchelfusingbrew(Homebrew), or build from source, or use a prebuilt binary (if available). This guide usesbrew. Also you can see this. - Use environment variables to point VS Code to the custom
glibcandpatchelf.
Install glibc and patchelf
By default, glibc gets installed by brew. Run the following commands:
brew --prefix glibc
# Output: /home/username/.homebrew/opt/glibc (example output)Install patchelf:
brew install patchelf
which patchelf
# Output: /home/username/.homebrew/bin/patchelfSet Remote Environment
Set the following environment variables:
export VSCODE_SERVER_CUSTOM_GLIBC_LINKER=/home/username/.homebrew/opt/glibc/lib/ld-linux-x86-64.so.2
export VSCODE_SERVER_CUSTOM_GLIBC_PATH=/home/username/.homebrew/opt/glibc/lib
export VSCODE_SERVER_PATCHELF_PATH=/home/username/.homebrew/bin/patchelfIf you use the bash shell, add the above lines to the remote ~/.bash_profile. For the zsh shell, add them to ~/.zprofile.
You can now proceed to connect with VS Code Remote-SSH, and it should work as expected. Let me know if you encounter any issues!