From 4e224059672ec2cd4773bfc3a176f77b0e1174d0 Mon Sep 17 00:00:00 2001 From: Alvaro Vidal Torreira Date: Fri, 27 Mar 2026 10:29:00 +0100 Subject: [PATCH 1/4] Do not require the /tmp directory --- jupyter-host/controller-v3.sh | 5 +++-- jupyter-host/start-template-v3.sh | 4 +++- jupyterlab-host/controller-v3.sh | 5 +++-- jupyterlab-host/start-template-v3.sh | 4 +++- kasmvnc-docker/start-template-v3.sh | 11 ++++++----- kasmvnc-singularity/start-template-v3.sh | 3 +++ vncserver/start-template-v3.sh | 3 +++ 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/jupyter-host/controller-v3.sh b/jupyter-host/controller-v3.sh index c0a69144e..17b6b6c84 100644 --- a/jupyter-host/controller-v3.sh +++ b/jupyter-host/controller-v3.sh @@ -24,10 +24,11 @@ f_install_miniconda() { conda_repo="https://repo.anaconda.com/miniconda/Miniconda3-py312_24.9.2-0-Linux-x86_64.sh" fi ID=$(date +%s)-${RANDOM} # This script may run at the same time! - nohup wget --no-check-certificate ${conda_repo} -O /tmp/miniconda-${ID}.sh 2>&1 > /tmp/miniconda_wget-${ID}.out + mkdir -p ${PWD}/tmp + nohup wget --no-check-certificate ${conda_repo} -O ${PWD}/tmp/miniconda-${ID}.sh 2>&1 > ${PWD}/tmp/miniconda_wget-${ID}.out rm -rf ${install_dir} mkdir -p $(dirname ${install_dir}) - nohup bash /tmp/miniconda-${ID}.sh -b -p ${install_dir} 2>&1 > /tmp/miniconda_sh-${ID}.out + nohup bash ${PWD}/tmp/miniconda-${ID}.sh -b -p ${install_dir} 2>&1 > ${PWD}/tmp/miniconda_sh-${ID}.out } f_set_up_conda_from_yaml() { diff --git a/jupyter-host/start-template-v3.sh b/jupyter-host/start-template-v3.sh index f90dd961f..a3f90017d 100755 --- a/jupyter-host/start-template-v3.sh +++ b/jupyter-host/start-template-v3.sh @@ -196,8 +196,10 @@ if sudo -n true 2>/dev/null && which docker >/dev/null 2>&1; then sudo docker logs ${container_name} elif which singularity >/dev/null 2>&1; then echo "Running singularity container ${service_nginx_sif}" - # We need to mount $PWD/tmp:/tmp because otherwise nginx writes the file /tmp/nginx.pid + # We need to mount $PWD/tmp:/tmp because otherwise nginx writes the file /tmp/nginx.pid # and other users cannot use the node. Was not able to change this in the config.conf. + export TMPDIR=${PWD}/tmp + export SINGULARITY_TMPDIR=${PWD}/tmp mkdir -p ./tmp # Need to overwrite default configuration! touch empty diff --git a/jupyterlab-host/controller-v3.sh b/jupyterlab-host/controller-v3.sh index 5d11c35ef..acb819550 100644 --- a/jupyterlab-host/controller-v3.sh +++ b/jupyterlab-host/controller-v3.sh @@ -37,10 +37,11 @@ f_install_miniconda() { conda_repo="https://repo.anaconda.com/miniconda/Miniconda3-py312_24.9.2-0-Linux-x86_64.sh" fi ID=$(date +%s)-${RANDOM} # This script may run at the same time! - nohup wget --no-check-certificate ${conda_repo} -O /tmp/miniconda-${ID}.sh 2>&1 > /tmp/miniconda_wget-${ID}.out + mkdir -p ${PWD}/tmp + nohup wget --no-check-certificate ${conda_repo} -O ${PWD}/tmp/miniconda-${ID}.sh 2>&1 > ${PWD}/tmp/miniconda_wget-${ID}.out rm -rf ${install_dir} mkdir -p $(dirname ${install_dir}) - nohup bash /tmp/miniconda-${ID}.sh -b -p ${install_dir} 2>&1 > /tmp/miniconda_sh-${ID}.out + nohup bash ${PWD}/tmp/miniconda-${ID}.sh -b -p ${install_dir} 2>&1 > ${PWD}/tmp/miniconda_sh-${ID}.out source ${install_dir}/etc/profile.d/conda.sh conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r diff --git a/jupyterlab-host/start-template-v3.sh b/jupyterlab-host/start-template-v3.sh index 06c7fc2ec..c8ba3b74f 100755 --- a/jupyterlab-host/start-template-v3.sh +++ b/jupyterlab-host/start-template-v3.sh @@ -219,8 +219,10 @@ elif sudo -n true 2>/dev/null && which docker >/dev/null 2>&1; then sudo docker logs ${container_name} elif which singularity >/dev/null 2>&1; then echo "Running singularity container ${service_nginx_sif}" - # We need to mount $PWD/tmp:/tmp because otherwise nginx writes the file /tmp/nginx.pid + # We need to mount $PWD/tmp:/tmp because otherwise nginx writes the file /tmp/nginx.pid # and other users cannot use the node. Was not able to change this in the config.conf. + export TMPDIR=${PWD}/tmp + export SINGULARITY_TMPDIR=${PWD}/tmp mkdir -p ./tmp # Need to overwrite default configuration! touch empty diff --git a/kasmvnc-docker/start-template-v3.sh b/kasmvnc-docker/start-template-v3.sh index 1e02a8460..bfdd082f7 100755 --- a/kasmvnc-docker/start-template-v3.sh +++ b/kasmvnc-docker/start-template-v3.sh @@ -137,18 +137,19 @@ echo "kill ${kasmvnc_container_pid} | true #kasmvnc_container_pid" >> cancel.sh echo "$(date) KasmVNC container started with PID ${kasmvnc_container_pid}" echo "$(date) Copy .Xauthority from container to host..." +mkdir -p ${PWD}/tmp for i in $(seq 1 30); do - if ${docker_cmd} cp "${container_name}:/home/packer/.Xauthority" "/tmp/.xauth${XdisplayNumber}" \ - || ${docker_cmd} cp "${container_name}:/home/metauser/.Xauthority" "/tmp/.xauth${XdisplayNumber}" + if ${docker_cmd} cp "${container_name}:/home/packer/.Xauthority" "${PWD}/tmp/.xauth${XdisplayNumber}" \ + || ${docker_cmd} cp "${container_name}:/home/metauser/.Xauthority" "${PWD}/tmp/.xauth${XdisplayNumber}" then break fi echo "$(date) Attempt $i/30 failed, retrying in 2s..." sleep 2 done -sudo chown "$USER" "/tmp/.xauth${XdisplayNumber}" || chown "$USER" "/tmp/.xauth${XdisplayNumber}" -echo "rm /tmp/.xauth${XdisplayNumber}" >> cancel.sh -export XAUTHORITY=/tmp/.xauth${XdisplayNumber} +sudo chown "$USER" "${PWD}/tmp/.xauth${XdisplayNumber}" || chown "$USER" "${PWD}/tmp/.xauth${XdisplayNumber}" +echo "rm ${PWD}/tmp/.xauth${XdisplayNumber}" >> cancel.sh +export XAUTHORITY=${PWD}/tmp/.xauth${XdisplayNumber} echo "$(date) Starting xterm on the host..." run_xterm_loop(){ diff --git a/kasmvnc-singularity/start-template-v3.sh b/kasmvnc-singularity/start-template-v3.sh index 5393b5af4..edd706e92 100755 --- a/kasmvnc-singularity/start-template-v3.sh +++ b/kasmvnc-singularity/start-template-v3.sh @@ -141,6 +141,9 @@ else WRITABLE_TMPFS_FLAG="--writable-tmpfs" fi +export TMPDIR=${PWD}/tmp +export SINGULARITY_TMPDIR=${PWD}/tmp +mkdir -p ${PWD}/tmp mkdir -p $PWD/container_tmp set -x diff --git a/vncserver/start-template-v3.sh b/vncserver/start-template-v3.sh index 4e3aad518..27348c230 100755 --- a/vncserver/start-template-v3.sh +++ b/vncserver/start-template-v3.sh @@ -354,6 +354,7 @@ elif [[ "${service_vnc_type}" == "SingularityTurboVNC" ]]; then # Start service mkdir -p ~/.vnc export TMPDIR=${PWD}/tmp + export SINGULARITY_TMPDIR=${PWD}/tmp mkdir -p $TMPDIR ${singularity_exec} ${PW_PARENT_JOB_DIR}/vncserver.sh | tee -a vncserver.out & #echo "kill $! # singularity run" >> cancel.sh @@ -663,6 +664,8 @@ HERE echo "Running singularity container ${service_nginx_sif}" # We need to mount $PWD/tmp:/tmp because otherwise nginx writes the file /tmp/nginx.pid # and other users cannot use the node. Was not able to change this in the config.conf. + export TMPDIR=${PWD}/tmp + export SINGULARITY_TMPDIR=${PWD}/tmp mkdir -p ./tmp # Need to overwrite default configuration! touch empty From 66ea4e690282c20e3b6e448b59fbd90666c200fb Mon Sep 17 00:00:00 2001 From: Alvaro Vidal Torreira Date: Fri, 27 Mar 2026 10:52:54 +0100 Subject: [PATCH 2/4] Do not require the /tmp directory --- vncserver/start-template-v3.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vncserver/start-template-v3.sh b/vncserver/start-template-v3.sh index 27348c230..f65b494c6 100755 --- a/vncserver/start-template-v3.sh +++ b/vncserver/start-template-v3.sh @@ -377,7 +377,10 @@ elif [[ "${service_vnc_type}" == "KasmVNC" ]]; then # KasmVNC # ########### export kasmvnc_port=$(pw agent open-port) - export XDG_RUNTIME_DIR="" + mkdir -p /tmp/.X11-unix + mkdir -p ${HOME}/.run + chmod 700 ${HOME}/.run + export XDG_RUNTIME_DIR=${HOME}/.run if [ "${service_set_password}" != true ]; then service_password=password From 6907fdd4b7cc8e367d90996fbceaeb6afc2552ea Mon Sep 17 00:00:00 2001 From: Alvaro Vidal Torreira Date: Fri, 27 Mar 2026 10:54:46 +0100 Subject: [PATCH 3/4] Do not require the /tmp directory --- vncserver/start-template-v3.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vncserver/start-template-v3.sh b/vncserver/start-template-v3.sh index f65b494c6..6007ec965 100755 --- a/vncserver/start-template-v3.sh +++ b/vncserver/start-template-v3.sh @@ -378,9 +378,9 @@ elif [[ "${service_vnc_type}" == "KasmVNC" ]]; then ########### export kasmvnc_port=$(pw agent open-port) mkdir -p /tmp/.X11-unix - mkdir -p ${HOME}/.run - chmod 700 ${HOME}/.run - export XDG_RUNTIME_DIR=${HOME}/.run + mkdir -p ${PWD}/.run + chmod 700 ${PWD}/.run + export XDG_RUNTIME_DIR=${PWD}/.run if [ "${service_set_password}" != true ]; then service_password=password From c6c87cac29b8e2719c425a235178257503117b78 Mon Sep 17 00:00:00 2001 From: Alvaro Vidal Torreira Date: Fri, 27 Mar 2026 11:10:15 +0100 Subject: [PATCH 4/4] Do not require the /tmp directory --- vncserver/start-template-v3.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vncserver/start-template-v3.sh b/vncserver/start-template-v3.sh index 6007ec965..ddcc6e2d4 100755 --- a/vncserver/start-template-v3.sh +++ b/vncserver/start-template-v3.sh @@ -377,7 +377,7 @@ elif [[ "${service_vnc_type}" == "KasmVNC" ]]; then # KasmVNC # ########### export kasmvnc_port=$(pw agent open-port) - mkdir -p /tmp/.X11-unix + mkdir -p ${PWD}/tmp/.X11-unix mkdir -p ${PWD}/.run chmod 700 ${PWD}/.run export XDG_RUNTIME_DIR=${PWD}/.run @@ -504,7 +504,8 @@ sudo chmod +x /usr/lib/kasmvncserver/select-de.sh vncserver_cmd="${service_vnc_exec} ${DISPLAY} ${disableBasicAuth} \ ${desktop_arg} \ -websocketPort ${kasmvnc_port} \ - -rfbport ${displayPort}" + -rfbport ${displayPort} \ + -tmpdir ${PWD}/tmp" echo Running: echo ${vncserver_cmd}