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..ddcc6e2d4 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 @@ -376,7 +377,10 @@ elif [[ "${service_vnc_type}" == "KasmVNC" ]]; then # KasmVNC # ########### export kasmvnc_port=$(pw agent open-port) - export XDG_RUNTIME_DIR="" + mkdir -p ${PWD}/tmp/.X11-unix + mkdir -p ${PWD}/.run + chmod 700 ${PWD}/.run + export XDG_RUNTIME_DIR=${PWD}/.run if [ "${service_set_password}" != true ]; then service_password=password @@ -500,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} @@ -663,6 +668,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