How to enable VSCode on LCC
How to enable VSCode on LCC
Our LCC cluster runs an older Linux environment that requires some environment tweaks to get VSCode Server working properly. Follow these steps to configure your shell environment.
Changes were adapted from: https://code.visualstudio.com/docs/remote/faq#_can-i-run-vs-code-server-on-older-linux-distributions
1. Modify your ~/.bashrc
You need to update your .bashrc to unload the default Intel compiler module, load the GNU compiler module, and set some environment variables that fix VSCode compatibility.
Add the following lines near the end of your ~/.bashrc file, ideally under the section marked # User specific aliases and functions:
# === VSCode setup for LCC machine ===
# Swap default intel compiler with GNU 8.3.0 compiler module
module swap intel gnu8/8.3.0
# Load patchelf module for VSCode server fixes
module load ccs/patchelf/0.18.0
# Set custom glibc linker and library path for VSCode server
export VSCODE_SERVER_CUSTOM_GLIBC_LINKER=/opt/ohpc/pub/apps/ccs/vscode-server-fix/vscode-sysroot/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/lib64/ld-linux-x86-64.so.2
export VSCODE_SERVER_CUSTOM_GLIBC_PATH=/opt/ohpc/pub/apps/ccs/vscode-server-fix/vscode-sysroot/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/lib64
# Point VSCode to the patchelf binary
export VSCODE_SERVER_PATCHELF_PATH=/opt/ohpc/pub/apps/ccs/patchelf-0.18.0/bin/patchelf
2. Apply the changes
After saving your .bashrc, reload it by running:
source ~/.bashrc3. Launch VSCode to connect to Login Node
Now you can connect with VSCode using the Remote - SSH extension as usual, and it will use the patched server, ensuring compatibility with the older system libraries.
Info: Alternatively, for heavy developmental work, please reserve an interactive compute node following the guide at: VSCode on Compute Node
Notes
The unload of the Intel module ensures no compiler conflicts when loading GNU 8.3.0.
The
VSCODE_SERVER_CUSTOM_GLIBC_*variables point VSCode to newer glibc libraries needed for compatibility.The
VSCODE_SERVER_PATCHELF_PATHvariable points to the patchelf binary, which "patches" VSCode server startup issues.
VSCode Remote SSH and RemoteCommand / Container Shells
If you use RemoteCommand in your SSH config to launch a container shell (e.g., Singularity/Apptainer), note these two requirements:
Do NOT use
RequestTTY forcein the SSH config entry used by VSCode. VSCode manages TTY allocation itself, and forcing it breaks VSCode's internal probe and file-transfer connections.Enable RemoteCommand support in VSCode: Settings > search "enableRemoteCommand" > check the box. Without this, VSCode ignores RemoteCommand and connects to the bare host OS instead of your container.
Recommended: use separate SSH config entries for regular SSH (with RequestTTY force) and VSCode (without it).
Example:
# Regular SSH
Host mycluster-ssh
HostName <login-node>
User <userid>
RequestTTY force
RemoteCommand /path/to/devenv-shell.sh
# VSCode
Host mycluster-devenv
HostName <login-node>
User <userid>
RemoteCommand /path/to/devenv-shell.shImportant: Container users must guard the .bashrc VSCode patches
If your RemoteCommand launches a Singularity/Apptainer container (e.g., Ubuntu 24.04), the .bashrc VSCode glibc patches from Step 1 will be applied again inside the container when the shell starts. This causes a glibc mismatch -- the patches are meant for the LCC host (CentOS 7) and will break VSCode's terminal inside a container that has its own modern glibc.
To fix this, wrap the VSCode section in your ~/.bashrc with a container detection check:
# === VSCode setup for LCC machine ===
# Only apply on bare host -- container has its own modern glibc
if [ ! -e /.singularity.d/Singularity ]; then
# Swap default intel compiler with GNU 8.3.0 compiler module
module swap intel gnu8/8.3.0
# Load patchelf module for VSCode server fixes
module load ccs/patchelf/0.18.0
# Set custom glibc linker and library path for VSCode server
export VSCODE_SERVER_CUSTOM_GLIBC_LINKER=/opt/ohpc/pub/apps/ccs/vscode-server-fix/vscode-sysroot/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/lib64/ld-linux-x86-64.so.2
export VSCODE_SERVER_CUSTOM_GLIBC_PATH=/opt/ohpc/pub/apps/ccs/vscode-server-fix/vscode-sysroot/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/lib64
# Point VSCode to the patchelf binary
export VSCODE_SERVER_PATCHELF_PATH=/opt/ohpc/pub/apps/ccs/patchelf-0.18.0/bin/patchelf
fi
The file /.singularity.d/Singularity exists inside every Singularity/Apptainer container but not on the bare host. This ensures the glibc patches apply on the LCC host (where they are needed) but not inside your dev container (where they would interfere).
Note: If you are not using
RemoteCommandwith a container, you do not need theifguard -- the original.bashrclines from Step 1 will work as-is.
If you encounter any issues or have questions, please reach out at UKY HPC Help Center