Skip to content

Instantly share code, notes, and snippets.

@dotysan
Last active August 10, 2025 21:38
Show Gist options
  • Select an option

  • Save dotysan/1c4c1dff8f9a62ec7fb14950c456dfae to your computer and use it in GitHub Desktop.

Select an option

Save dotysan/1c4c1dff8f9a62ec7fb14950c456dfae to your computer and use it in GitHub Desktop.
Allow VS Code Server to run on older Linux
#! /usr/bin/env bash
#
#
#
set -e
set -u
#set -x
main() {
if ! docker buildx ls |grep -q ^nocliplogs
then
docker buildx create --name nocliplogs \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=-1 \
--driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=-1
fi
if [[ ! -s sysroot.tar ]]
then
docker buildx build --builder nocliplogs --progress=plain \
--target=sysroot-export --output=type=tar,dest=./sysroot.tar .
fi
if [[ ! -e "$HOME/sysroot" ]]
then
tar --extract --file=sysroot.tar --directory="$HOME"
fi
echo "Make sure your PATH in .ssh/environment includes $HOME/sysroot/usr/bin"
echo 'After making sure /etc/ssh/sshd_config has PermitUserEnvironment yes'
echo 'And sshd is restarted.'
}
main
exit
ARG NOBLEREL=20250714
ARG CTVER=1.27.0
ARG ARCH=x86_64
ARG PEVER=0.18.0
ARG GCCVER=10.5.0
ARG GLIBCVER=2.28
# ======================================================================
FROM ubuntu:noble-$NOBLEREL AS build-sysroot
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& \
apt-get install --yes --no-install-recommends \
automake \
bison \
bzip2 \
ca-certificates \
file \
flex \
g++ \
gawk \
gcc \
help2man \
libncurses5-dev \
libtool-bin \
make \
patch \
python3-dev \
rsync \
texinfo \
unzip \
wget \
xz-utils \
&& \
apt-get autopurge --yes \
&& \
apt-get upgrade --yes \
&& \
apt-get clean
ARG CTVER
ARG CTDL="http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-$CTVER.tar.xz"
RUN wget --output-document=- "$CTDL" |tar --extract --xz --no-same-owner
RUN cd "crosstool-ng-$CTVER" \
&& \
./configure \
&& \
make -j \
&& \
make install
USER ubuntu
ARG ARCH
ARG GCCVER
ARG GLIBCVER
ARG CONFDL="https://raw.githubusercontent.com/microsoft/vscode-linux-build-agent/refs/heads/main/$ARCH-gcc-$GCCVER-glibc-$GLIBCVER.config"
ARG PEVER
ARG PEDL="https://github.com/NixOS/patchelf/releases/download/$PEVER/patchelf-$PEVER-$ARCH.tar.gz"
RUN cd && mkdir build && cd build \
&& \
wget --output-document=.config "$CONFDL" \
&& \
ct-ng build -j$(nproc)
RUN cd /home/ubuntu/build/$ARCH-*/$ARCH-*/sysroot/usr \
&& \
chmod u+w bin share \
&& \
wget --output-document=- "$PEDL" |tar --extract --gzip
USER root
RUN find /home/ubuntu/build -mindepth 3 -maxdepth 3 -type d -name sysroot -print0 \
|xargs -r0 cp --archive --target-directory=/ \
&& \
chown -R root:root /sysroot
# ======================================================================
FROM scratch AS sysroot-export
COPY --from=build-sysroot /sysroot /sysroot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment