==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/stderr <== ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/stdout <== ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log <== ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/message.log <== DEBUGNOTE[15:40:44,124]: check_host(): ps can watch root processes: yes x11docker[15:40:44,138]: Image name: pccastor_obzy7v_wallet:latest Container command: DEBUGNOTE[15:40:44,178]: host user: debian 1000:1000 /home/debian x11docker WARNING: User debian is member of group docker. That allows unprivileged processes on host to gain root privileges. DEBUGNOTE[15:40:44,543]: storeinfo(): cache=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472 DEBUGNOTE[15:40:44,558]: storeinfo(): stdout=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/stdout DEBUGNOTE[15:40:44,572]: storeinfo(): stderr=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/stderr DEBUGNOTE[15:40:44,605]: storeinfo(): x11dockerpid=28330 DEBUGNOTE[15:40:44,669]: x11docker version: 6.9.0 Backend version: Docker version 20.10.10, build b485636 Host system: "Debian GNU/Linux 10 (buster)" Host architecture: amd64 (x86_64) Command: '/usr/bin/x11docker' '-D' '--init=tini' '--xvfb' '--size=1980x1200' '--lang=fr' '--keymap' 'fr-latin9' '--pulseaudio' '--home' '--homebasedir=/var/www/html/pccastor-com/wp-content/plugins/Loamok_xpra_docker_admin/system_admin-tpls/vms/pccastor_obzy7v/home' 'pccastor_obzy7v_wallet:latest' Parsed options: -D --init 'tini' --xvfb --size '1980x1200' --lang 'fr' --keymap 'fr-latin9' --pulseaudio '' --home '' --homebasedir '/var/www/html/pccastor-com/wp-content/plugins/Loamok_xpra_docker_admin/system_admin-tpls/vms/pccastor_obzy7v/home' -- 'pccastor_obzy7v_wallet:latest' DEBUGNOTE[15:40:44,683]: Dependency check for --xvfb: 0 DEBUGNOTE[15:40:44,690]: Dependencies of --xvfb already checked: 0 DEBUGNOTE[15:40:44,699]: Dependencies of --xvfb already checked: 0 DEBUGNOTE[15:40:44,709]: storeinfo(): xserver=--xvfb DEBUGNOTE[15:40:44,751]: container user: debian 1000:1000 /home/debian x11docker[15:40:44,796]: Sharing directory /var/www/html/pccastor-com/wp-content/plugins/Loamok_xpra_docker_admin/system_admin-tpls/vms/pccastor_obzy7v/home/pccastor_obzy7v_wallet with container as its home directory /home/debian ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/xinit.log <== ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/stderr <== ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/stdout <== ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log <== ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/message.log <== DEBUGNOTE[15:40:44,124]: check_host(): ps can watch root processes: yes x11docker[15:40:44,138]: Image name: pccastor_obzy7v_wallet:latest Container command: DEBUGNOTE[15:40:44,178]: host user: debian 1000:1000 /home/debian x11docker WARNING: User debian is member of group docker. That allows unprivileged processes on host to gain root privileges. DEBUGNOTE[15:40:44,543]: storeinfo(): cache=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472 DEBUGNOTE[15:40:44,558]: storeinfo(): stdout=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/stdout DEBUGNOTE[15:40:44,572]: storeinfo(): stderr=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/stderr DEBUGNOTE[15:40:44,605]: storeinfo(): x11dockerpid=28330 DEBUGNOTE[15:40:44,669]: x11docker version: 6.9.0 Backend version: Docker version 20.10.10, build b485636 Host system: "Debian GNU/Linux 10 (buster)" Host architecture: amd64 (x86_64) Command: '/usr/bin/x11docker' '-D' '--init=tini' '--xvfb' '--size=1980x1200' '--lang=fr' '--keymap' 'fr-latin9' '--pulseaudio' '--home' '--homebasedir=/var/www/html/pccastor-com/wp-content/plugins/Loamok_xpra_docker_admin/system_admin-tpls/vms/pccastor_obzy7v/home' 'pccastor_obzy7v_wallet:latest' Parsed options: -D --init 'tini' --xvfb --size '1980x1200' --lang 'fr' --keymap 'fr-latin9' --pulseaudio '' --home '' --homebasedir '/var/www/html/pccastor-com/wp-content/plugins/Loamok_xpra_docker_admin/system_admin-tpls/vms/pccastor_obzy7v/home' -- 'pccastor_obzy7v_wallet:latest' DEBUGNOTE[15:40:44,683]: Dependency check for --xvfb: 0 DEBUGNOTE[15:40:44,690]: Dependencies of --xvfb already checked: 0 DEBUGNOTE[15:40:44,699]: Dependencies of --xvfb already checked: 0 DEBUGNOTE[15:40:44,709]: storeinfo(): xserver=--xvfb DEBUGNOTE[15:40:44,751]: container user: debian 1000:1000 /home/debian x11docker[15:40:44,796]: Sharing directory /var/www/html/pccastor-com/wp-content/plugins/Loamok_xpra_docker_admin/system_admin-tpls/vms/pccastor_obzy7v/home/pccastor_obzy7v_wallet with container as its home directory /home/debian ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/xinit.log <== ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/message.log <== DEBUGNOTE[15:40:44,846]: waitforlogentry(): tailstdout: Waiting for logentry "x11docker=ready" in store.info DEBUGNOTE[15:40:44,850]: waitforlogentry(): tailstderr: Waiting for logentry "x11docker=ready" in store.info DEBUGNOTE[15:40:44,868]: storepid(): Stored pid '28883' of 'watchpidlist': 28883 pts/2 00:00:00 bash DEBUGNOTE[15:40:44,894]: storepid(): Stored pid '28904' of 'watchmessagefifo': 28904 pts/2 00:00:00 bash x11docker[15:40:44,909]: Virtual screen size: 1980x1200 x11docker[15:40:44,921]: Physical screen size: x11docker WARNING: Option --pulseaudio allows container applications to catch your audio output and microphone input. DEBUGNOTE[15:40:44,963]: traperror: Command at Line 9033 returned with error code 1: pactl load-module module-native-protocol-unix socket=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/pulseaudio.socket 2>&1 1951 - ::unpriv::setup_sound_pulseaudio::main::main DEBUGNOTE[15:40:44,971]: storeinfo(): error=64 DEBUGNOTE[15:40:44,988]: time to say goodbye (traperror) DEBUGNOTE[15:40:45,000]: traperror: Command at Line 9033 returned with error code 1: $Unpriv "${1:-}" 1951 - ::unpriv::setup_sound_pulseaudio::main::main DEBUGNOTE[15:40:45,009]: storeinfo(): error=64 DEBUGNOTE[15:40:45,036]: time to say goodbye (traperror) DEBUGNOTE[15:40:45,046]: traperror: Command at Line 1951 returned with error code 1: $Unpriv "${1:-}" 9114 - ::setup_sound_pulseaudio::main::main DEBUGNOTE[15:40:45,055]: storeinfo(): error=64 DEBUGNOTE[15:40:45,084]: time to say goodbye (traperror) DEBUGNOTE[15:40:45,096]: traperror: Command at Line 1951 returned with error code 1: Pulseaudiomoduleid="$(unpriv "pactl load-module module-native-protocol-unix socket=$Pulseaudiosocket 2>&1")" 9114 - ::setup_sound_pulseaudio::main::main DEBUGNOTE[15:40:45,103]: storeinfo(): error=64 DEBUGNOTE[15:40:45,128]: time to say goodbye (traperror) DEBUGNOTE[15:40:45,140]: storeinfo(): pulseaudiomoduleid=Échec lors de la connexion : Connexion refusée Échec de pa_context_connect() : Connexion refusée x11docker[15:40:45,203]: Generated pulseaudio client.conf: 1 # Connect to host pulseaudio server using mounted UNIX socket 2 default-server = unix:/x11docker/pulseaudio.socket 3 # Prevent a server running in container 4 autospawn = no 5 daemon-binary = /bin/true 6 # Prevent use of shared memory 7 enable-shm = false 8 DEBUGNOTE[15:40:45,367]: waitforlogentry(): tailstdout: Stopped waiting for x11docker=ready in store.info due to terminating signal. DEBUGNOTE[15:40:45,372]: waitforlogentry(): tailstderr: Stopped waiting for x11docker=ready in store.info due to terminating signal. DEBUGNOTE[15:40:45,456]: storeinfo(): DISPLAY=:141 DEBUGNOTE[15:40:45,473]: storeinfo(): XAUTHORITY=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client DEBUGNOTE[15:40:45,487]: storeinfo(): XSOCKET=/tmp/.X11-unix/X141 DEBUGNOTE[15:40:45,502]: storeinfo(): Xenv= DISPLAY=:141 XAUTHORITY=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X141 DEBUGNOTE[15:40:45,540]: X server command: /usr/bin/Xvfb :141 \ -retro \ +extension RANDR \ +extension RENDER \ +extension GLX \ +extension XVideo \ +extension DOUBLE-BUFFER \ +extension SECURITY \ +extension DAMAGE \ +extension X-Resource \ -extension XINERAMA -xinerama \ -extension MIT-SHM \ +extension Composite +extension COMPOSITE \ +extension XTEST \ -dpms \ -s off \ -auth /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/Xauthority.server \ -nolisten tcp \ -screen 0 1980x1200x24 \ x11docker[15:40:45,685]: --init: Found tini binary: /usr/bin/docker-init DEBUGNOTE[15:40:45,695]: storeinfo(): tini=/usr/bin/docker-init DEBUGNOTE[15:40:45,714]: Users and terminal: x11docker was started by: debian As host user serves (running X, storing cache): debian Container user will be: debian Container user password: x11docker Getting permission to run backend with: eval Terminal for password frontend: bash -c Running in a terminal: yes Running on console: no Running over SSH: yes Running sourced: no bash $-: huBE DEBUGNOTE[15:40:45,724]: storeinfo(): containername=x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 DEBUGNOTE[15:40:45,853]: time to say goodbye (watchpidlist) DEBUGNOTE[15:40:46,248]: docker command: docker run --detach --tty \ --name x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 \ --user 1000:1000 \ --userns=host \ --cap-drop ALL \ --security-opt no-new-privileges \ --security-opt label=type:container_runtime_t \ --volume '/usr/bin/docker-init':'/usr/local/bin/init':ro \ --tmpfs /run:exec --tmpfs /run/lock \ --volume '/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share':'/x11docker':rw \ --volume '/var/www/html/pccastor-com/wp-content/plugins/Loamok_xpra_docker_admin/system_admin-tpls/vms/pccastor_obzy7v/home/pccastor_obzy7v_wallet':'/home/debian':rw \ --volume '/tmp/.X11-unix/X141':'/X141':rw \ --volume /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/pulseaudio.client.conf:/etc/pulse/client.conf:ro \ --workdir '/tmp' \ --entrypoint env \ --env 'container=docker' \ --env 'XAUTHORITY=/x11docker/Xauthority.client' \ --env 'DISPLAY=:141' \ --env 'PULSE_COOKIE=/x11docker/pulseaudio.cookie' \ --env 'PULSE_SERVER=unix:/x11docker/pulseaudio.socket' \ --env 'USER=debian' \ -- pccastor_obzy7v_wallet:latest /usr/local/bin/init -- /bin/sh - /x11docker/containerrc x11docker[15:40:46,523]: Generated dockerrc: 1 #! /usr/bin/env bash 2 3 # dockerrc: 4 # This script runs as root (or member of group docker) on host. 5 # - inspect image 6 # - pull image if needed 7 # - create containerrc 8 # - set up systemd/elogind cgroup if needed 9 # - run window manager in container or from host if needed 10 11 trap '' SIGINT 12 13 askyesno () 14 { 15 local Choice; 16 read -t60 -n1 -p "(timeout after 60s assuming no) [Y|n]" Choice; 17 [ "$?" = '0' ] && { 18 [[ "$Choice" == [YyJj]* ]] || [ -z "$Choice" ] && return 0 19 }; 20 return 1 21 } 22 checkpid () 23 { 24 [ -e "/proc/${1:-NONSENSE}" ] 25 } 26 escapestring () 27 { 28 echo "${1:-}" | LC_ALL=C sed -e 's/[^a-zA-Z0-9,._+@=:/-]/\\&/g; ' 29 } 30 mysleep () 31 { 32 sleep "${1:-1}" 2> /dev/null || sleep 1 33 } 34 pspid () 35 { 36 LC_ALL=C ps -p "${1:-}" 2> /dev/null | grep -v 'TIME' 37 } 38 rmcr () 39 { 40 case "${1:-}" in 41 "") 42 sed "s/$(printf "\r")//g" 43 ;; 44 *) 45 sed -i "s/$(printf "\r")//g" "${1:-}" 46 ;; 47 esac 48 } 49 rocknroll () 50 { 51 [ -s "$Timetosaygoodbyefile" ] && return 1; 52 [ -e "$Timetosaygoodbyefile" ] || return 1; 53 return 0 54 } 55 saygoodbye () 56 { 57 debugnote "time to say goodbye ($*)"; 58 [ -e "$Timetosaygoodbyefile" ] && echo timetosaygoodbye >> $Timetosaygoodbyefile; 59 [ -e "$Timetosaygoodbyefifo" ] && echo timetosaygoodbye >> $Timetosaygoodbyefifo 60 } 61 storeinfo () 62 { 63 [ -e "$Storeinfofile" ] || return 1; 64 case "${1:-}" in 65 dump) 66 grep "^${2:-}=" $Storeinfofile | sed "s/^${2:-}=//" 67 ;; 68 drop) 69 sed -i "/^${2:-}=/d" $Storeinfofile 70 ;; 71 test) 72 grep -q "^${2:-}=" $Storeinfofile 73 ;; 74 *) 75 debugnote "storeinfo(): ${1:-}"; 76 grep -q "^$(echo "${1:-}" | cut -d= -f1)=" $Storeinfofile && { 77 sed -i "/^$(echo "${1:-}" | cut -d= -f1)=/d" $Storeinfofile 78 }; 79 echo "${1:-}" >> $Storeinfofile 80 ;; 81 esac 82 } 83 storepid () 84 { 85 case "${1:-}" in 86 dump) 87 grep -w "${2:-}" "$Storepidfile" | cut -d' ' -f1 88 ;; 89 test) 90 grep -q -w "${2:-}" "$Storepidfile" 91 ;; 92 *) 93 echo "${1:-NOPID}" "${2:-NONAME}" >> "$Storepidfile"; 94 debugnote "storepid(): Stored pid '${1:-}' of '${2:-}': $(pspid ${1:-} ||:)" 95 ;; 96 esac 97 } 98 waitforlogentry () 99 { 100 local Startzeit Uhrzeit Dauer Count=0 Schlaf; 101 local Errorkeys="${4:-}"; 102 local Warten="${5:-60}"; 103 local Error=; 104 Startzeit="$(date +%s ||:)"; 105 Startzeit="${Startzeit:-0}"; 106 [ "$Warten" = "infinity" ] && Warten=32000; 107 debugnote "waitforlogentry(): ${1:-}: Waiting for logentry \"${3:-}\" in $(basename ${2:-})"; 108 while ! grep -q "${3:-}" < "${2:-}"; do 109 Count="$(( $Count + 1 ))"; 110 Uhrzeit="$(date +%s ||:)"; 111 Uhrzeit="${Uhrzeit:-0}"; 112 Dauer="$(( $Uhrzeit - $Startzeit ))"; 113 Schlaf="$(( $Count / 10 ))"; 114 [ "$Schlaf" = "0" ] && Schlaf="0.5"; 115 mysleep "$Schlaf"; 116 [ "$Dauer" -gt "10" ] && debugnote "waitforlogentry(): ${1:-}: Waiting since ${Dauer}s for log entry \"${3:-}\" in $(basename ${2:-})"; 117 [ "$Dauer" -gt "$Warten" ] && error "waitforlogentry(): ${1:-}: Timeout waiting for entry \"${3:-}\" in $(basename ${2:-}) 118 Last lines of $(basename ${2:-}): 119 $(tail "${2:-}")"; 120 [ "$Errorkeys" ] && grep -i -q -E "$Errorkeys" < "${2:-}" && error "waitforlogentry(): ${1:-}: Found error message in logfile. 121 Last lines of logfile $(basename ${2:-}): 122 $(tail "${2:-}")"; 123 rocknroll || { 124 debugnote "waitforlogentry(): ${1:-}: Stopped waiting for ${3:-} in $(basename ${2:-}) due to terminating signal."; 125 Error=1; 126 break 127 }; 128 done; 129 [ "$Error" ] && return 1; 130 debugnote "waitforlogentry(): ${1:-}: Found log entry \"${3:-}\" in $(basename ${2:-})."; 131 return 0 132 } 133 134 warning() { 135 echo "$*:WARNING" | sed "s/\$/ /" >>$Messagefile 136 } 137 note() { 138 echo "$*:NOTE" | sed "s/\$/ /" >>$Messagefile 139 } 140 verbose() { 141 echo "$*:VERBOSE" | sed "s/\$/ /" >>$Messagefile 142 } 143 debugnote() { 144 echo "$*:DEBUGNOTE" | sed "s/\$/ /" >>$Messagefile 145 } 146 error() { 147 echo "$*:ERROR" | sed "s/\$/ /" >>$Messagefile 148 exit 64 149 } 150 stdout() { 151 echo "$*:STDOUT" | sed "s/\$/ /" >>$Messagefile 152 } 153 154 Containercommand="" 155 Imagename="pccastor_obzy7v_wallet:latest" 156 Messagefile='/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/message.fifo' 157 Newxenv=' DISPLAY=:141 XAUTHORITY=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X141' 158 export PATH='/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin' 159 Storeinfofile='/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/store.info' 160 Storepidfile='/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/store.pids' 161 Timetosaygoodbyefile='/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/timetosaygoodbye' 162 Timetosaygoodbyefifo='/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/timetosaygoodbye.fifo' 163 Xserver='--xvfb' 164 Workdir='' 165 166 Containerarchitecture= 167 Containerid= 168 Containerip= 169 Dockerlogspid='' 170 Exec= 171 Entrypoint= 172 Failure= 173 Imagepull= 174 Imageuser= 175 Inspect= 176 Line= 177 Pid1pid= 178 Runtime= 179 Signal= 180 Windowmanagermode= 181 Windowmanagercommand= 182 Wmcontainerid= 183 Wmdockercommand= 184 debugnote 'Running dockerrc: Setup as root or as user docker on host.' 185 PS4='+ dockerrc: $(date +%S+%3N) ' 186 traperror() { # trap ERR: --debug: Output for 'set -o errtrace' 187 debugnote "dockerrc: Command at Line ${2:-} returned with error code ${1:-}: 188 ${4:-} 189 ${3:-} - ${5:-}" 190 saygoodbye dockerrc-traperror 191 exit 64 192 } 193 set -Eu 194 trap 'traperror $? $LINENO $BASH_LINENO "$BASH_COMMAND" $(printf "::%s" ${FUNCNAME[@]})' ERR 195 196 197 # Check whether docker daemon is running, get docker info 198 docker info >>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/docker.info 2>>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log || { 199 error "'docker info' failed. 200 If using docker: Is docker daemon running at all? 201 Try to start docker daemon with 'systemctl start docker'. 202 Last lines of log: 203 $(rmcr < '/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log' | tail)" 204 } 205 206 # Check default runtime 207 Runtime="$( { grep 'Default Runtime' < '/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/docker.info' ||: ;} | awk '{print $3}' )" 208 [ -n "$Runtime" ] && { 209 debugnote "dockerrc: Found default container Runtime: $Runtime" 210 debugnote "dockerrc: All $(grep 'Runtimes' < '/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/docker.info' ||: )" 211 [ "$Runtime" != '' ] && { 212 case $Runtime in 213 kata-runtime) warning 'Found default container runtime kata-runtime. 214 Please run x11docker with --runtime=kata-runtime to avoid issues.' ;; 215 nvidia) [ 'no' = 'yes' ] && warning 'Option --gpu: Found default container runtime nvidia. 216 Please run x11docker with --runtime=nvidia to avoid issues.' ;; 217 runc|crun|oci) ;; 218 *) note "Found unknown container runtime: $Runtime 219 Please report at: https://github.com/mviereck/x11docker" ;; 220 esac 221 } 222 } 223 Runtime='UNDECLARED_RUNTIME' 224 debugnote "dockerrc: Container Runtime: $Runtime" 225 storeinfo "runtime=$Runtime" 226 227 # Refresh images.list for x11docker-gui 228 docker images 2>>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log | grep -v REPOSITORY | awk '{print $1 ":" $2}' >>/home/debian/.cache/x11docker/docker.imagelist.sort 229 rmcr /home/debian/.cache/x11docker/docker.imagelist.sort 230 while read -r Line ; do 231 grep -q "" <<<$Line || echo $Line >> /home/debian/.cache/x11docker/docker.imagelist 232 done < <(sort < /home/debian/.cache/x11docker/docker.imagelist.sort) 233 rm /home/debian/.cache/x11docker/docker.imagelist.sort 234 235 # Check if image pccastor_obzy7v_wallet:latest is available locally 236 Imagepull=no 237 grep -x -q 'pccastor_obzy7v_wallet:latest' < /home/debian/.cache/x11docker/docker.imagelist || grep -x -q 'pccastor_obzy7v_wallet:latest:latest' < /home/debian/.cache/x11docker/docker.imagelist || { 238 docker images | grep -q '^pccastor_obzy7v_wallet:latest ' || { 239 echo 'Image pccastor_obzy7v_wallet:latest not found locally.' >&2 240 echo 'Do you want to pull it from docker hub?' >&2 241 askyesno && Imagepull=yes || error "Image 'pccastor_obzy7v_wallet:latest' not available locally and not pulled from docker hub." 242 } 243 } 244 245 rocknroll || exit 64 246 247 [ "$Imagepull" = 'yes' ] && { 248 note "Pulling image 'pccastor_obzy7v_wallet:latest' from docker hub" 249 docker pull pccastor_obzy7v_wallet:latest 1>&2 || error "Pulling image 'pccastor_obzy7v_wallet:latest' seems to have failed!" 250 } 251 252 rocknroll || exit 64 253 254 Inspect="$(docker inspect pccastor_obzy7v_wallet:latest --format='{{.Config.User}}|{{.Config.WorkingDir}}|{{.Architecture}}')" 255 256 # Check architecture 257 Containerarchitecture="$(cut -d'|' -f3 <<< "$Inspect")" 258 debugnote "dockerrc: Image architecture: $Containerarchitecture" 259 # Check CMD 260 [ -z "$Containercommand" ] && { 261 # extract image command from image if not given on cli 262 Containercommand="$(docker inspect pccastor_obzy7v_wallet:latest --format='{{.Config.Cmd}}')" 263 Containercommand="${Containercommand#[}" 264 Containercommand="${Containercommand%]}" 265 debugnote "dockerrc: Image CMD: $Containercommand" 266 echo "$Containercommand" | grep -q /x11docker/containerrc && error 'Recursion error: Found CMD /x11docker/containerrc in image. 267 Did you use 'docker commit' with an x11docker container? 268 Please build new images with a Dockerfile instead of using docker commit, 269 or provide a different container command.' 270 } 271 272 # Check USER 273 Imageuser="$(cut -d'|' -f1 <<< "$Inspect")" 274 debugnote "dockerrc: Image USER: $Imageuser" 275 [ "$Imageuser" ] && note "Found 'USER $Imageuser' in image. 276 If you want to run with user $Imageuser instead of host user debian, 277 than run with --user=RETAIN." 278 storeinfo containeruser="debian" 279 280 # Check ENTRYPOINT 281 Entrypoint="$(docker inspect pccastor_obzy7v_wallet:latest --format='{{.Config.Entrypoint}}')" 282 Entrypoint="${Entrypoint#[}" 283 Entrypoint="${Entrypoint%]}" 284 debugnote "dockerrc: Image ENTRYPOINT: $Entrypoint" 285 echo "$Entrypoint" | grep -qE 'tini|init|systemd' && { 286 note "There seems to be an init system in ENTRYPOINT of image: 287 $Entrypoint 288 Will disable it as x11docker already runs an init with option --tini. 289 To allow this ENTRYPOINT, run x11docker with option --init=none." 290 Entrypoint= 291 } 292 293 # Check WORKDIR 294 Workdir="$(cut -d'|' -f2 <<< "$Inspect")" 295 debugnote "dockerrc: Image WORKDIR: $Workdir" 296 [ "$Workdir" ] && note "Found 'WORKDIR $Workdir' in image. 297 You can change it with option --workdir=DIR." 298 299 [ -z "$Containercommand$Entrypoint" ] && error 'No container command specified and no CMD or ENTRYPOINT found in image.' 300 301 ######## Create containerrc ######## 302 303 { echo '#! /bin/sh' 304 echo '' 305 echo '# containerrc' 306 echo '# Created startscript for docker run used as container command.' 307 echo '# Runs as unprivileged user in container.' 308 echo '' 309 echo 'exec 6>&1 7>&2' 310 echo 'exec >>/x11docker/container.log 2>&1' 311 echo '' 312 echo 'mysleep () 313 { 314 sleep "${1:-1}" 2> /dev/null || sleep 1 315 }' 316 echo 'rocknroll () 317 { 318 [ -s "$Timetosaygoodbyefile" ] && return 1; 319 [ -e "$Timetosaygoodbyefile" ] || return 1; 320 return 0 321 }' 322 echo 'saygoodbye () 323 { 324 debugnote "time to say goodbye ($*)"; 325 [ -e "$Timetosaygoodbyefile" ] && echo timetosaygoodbye >> $Timetosaygoodbyefile; 326 [ -e "$Timetosaygoodbyefifo" ] && echo timetosaygoodbye >> $Timetosaygoodbyefifo 327 }' 328 echo 'storeinfo () 329 { 330 [ -e "$Storeinfofile" ] || return 1; 331 case "${1:-}" in 332 dump) 333 grep "^${2:-}=" $Storeinfofile | sed "s/^${2:-}=//" 334 ;; 335 drop) 336 sed -i "/^${2:-}=/d" $Storeinfofile 337 ;; 338 test) 339 grep -q "^${2:-}=" $Storeinfofile 340 ;; 341 *) 342 debugnote "storeinfo(): ${1:-}"; 343 grep -q "^$(echo "${1:-}" | cut -d= -f1)=" $Storeinfofile && { 344 sed -i "/^$(echo "${1:-}" | cut -d= -f1)=/d" $Storeinfofile 345 }; 346 echo "${1:-}" >> $Storeinfofile 347 ;; 348 esac 349 }' 350 echo 'waitforlogentry () 351 { 352 local Startzeit Uhrzeit Dauer Count=0 Schlaf; 353 local Errorkeys="${4:-}"; 354 local Warten="${5:-60}"; 355 local Error=; 356 Startzeit="$(date +%s ||:)"; 357 Startzeit="${Startzeit:-0}"; 358 [ "$Warten" = "infinity" ] && Warten=32000; 359 debugnote "waitforlogentry(): ${1:-}: Waiting for logentry \"${3:-}\" in $(basename ${2:-})"; 360 while ! grep -q "${3:-}" < "${2:-}"; do 361 Count="$(( $Count + 1 ))"; 362 Uhrzeit="$(date +%s ||:)"; 363 Uhrzeit="${Uhrzeit:-0}"; 364 Dauer="$(( $Uhrzeit - $Startzeit ))"; 365 Schlaf="$(( $Count / 10 ))"; 366 [ "$Schlaf" = "0" ] && Schlaf="0.5"; 367 mysleep "$Schlaf"; 368 [ "$Dauer" -gt "10" ] && debugnote "waitforlogentry(): ${1:-}: Waiting since ${Dauer}s for log entry \"${3:-}\" in $(basename ${2:-})"; 369 [ "$Dauer" -gt "$Warten" ] && error "waitforlogentry(): ${1:-}: Timeout waiting for entry \"${3:-}\" in $(basename ${2:-}) 370 Last lines of $(basename ${2:-}): 371 $(tail "${2:-}")"; 372 [ "$Errorkeys" ] && grep -i -q -E "$Errorkeys" < "${2:-}" && error "waitforlogentry(): ${1:-}: Found error message in logfile. 373 Last lines of logfile $(basename ${2:-}): 374 $(tail "${2:-}")"; 375 rocknroll || { 376 debugnote "waitforlogentry(): ${1:-}: Stopped waiting for ${3:-} in $(basename ${2:-}) due to terminating signal."; 377 Error=1; 378 break 379 }; 380 done; 381 [ "$Error" ] && return 1; 382 debugnote "waitforlogentry(): ${1:-}: Found log entry \"${3:-}\" in $(basename ${2:-})."; 383 return 0 384 }' 385 echo ' 386 warning() { 387 echo "$*:WARNING" | sed "s/\$/ /" >>$Messagefile 388 } 389 note() { 390 echo "$*:NOTE" | sed "s/\$/ /" >>$Messagefile 391 } 392 verbose() { 393 echo "$*:VERBOSE" | sed "s/\$/ /" >>$Messagefile 394 } 395 debugnote() { 396 echo "$*:DEBUGNOTE" | sed "s/\$/ /" >>$Messagefile 397 } 398 error() { 399 echo "$*:ERROR" | sed "s/\$/ /" >>$Messagefile 400 exit 64 401 } 402 stdout() { 403 echo "$*:STDOUT" | sed "s/\$/ /" >>$Messagefile 404 }' 405 echo 'Messagefile=/x11docker/message.fifo' 406 echo 'Storeinfofile=/x11docker/store.info' 407 echo 'Timetosaygoodbyefile=/x11docker/timetosaygoodbye' 408 echo '' 409 echo 'waitforlogentry containerrc $Storeinfofile containerrootrc=ready infinity' 410 echo 'debugnote "Running containerrc: Unprivileged user commands in container"' 411 echo '' 412 echo "Containercommand=\"$Containercommand\"" 413 echo "Entrypoint=\"$Entrypoint\"" 414 echo '' 415 echo 'verbose "containerrc: Container system:' 416 echo '$(cat /etc/os-release 2>&1 ||:)"' 417 echo '' 418 } >> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/containerrc 419 { 420 echo '' 421 echo '# USER and HOME' 422 echo 'Containeruser="$(storeinfo dump containeruser)"' 423 echo 'Containeruserhome="/home/debian"' 424 echo 'export USER="$Containeruser"' 425 echo '[ "$Containeruserhome" ] && {' 426 echo ' export HOME="$Containeruserhome"' 427 echo '}' 428 echo '' 429 echo '# XDG_RUNTIME_DIR' 430 echo 'Containeruseruid=$(id -u $Containeruser)' 431 echo 'export XDG_RUNTIME_DIR=/tmp/XDG_RUNTIME_DIR' 432 echo '[ -e /run/user/$Containeruseruid ] && ln -s /run/user/$Containeruseruid $XDG_RUNTIME_DIR || mkdir -p -m700 $XDG_RUNTIME_DIR' 433 echo '' 434 echo '# Copy files from /etc/skel into empty HOME' 435 echo '[ -d "$HOME" ] && {' 436 echo ' [ -d /etc/skel ] && [ -z "$(ls -A "$Containeruserhome" 2>/dev/null | grep -v -E "gnupg")" ] && {' 437 echo ' debugnote "containerrc: HOME is empty. Copying from /etc/skel"' 438 echo ' cp -n -R /etc/skel/. $Containeruserhome' 439 echo ' :' 440 echo ' } || {' 441 echo ' debugnote "containerrc: HOME is not empty. Not copying from /etc/skel"' 442 echo ' }' 443 echo '}' 444 echo '' 445 echo '# Create softlink to X unix socket' 446 echo '[ -e /tmp/.X11-unix/X141 ] || ln -s /X141 /tmp/.X11-unix' 447 echo '' 448 echo 'unset WAYLAND_DISPLAY' 449 echo '' 450 echo 'export XDG_SESSION_TYPE=x11' 451 echo '' 452 echo '' 453 echo 'export TERM=xterm' 454 echo 'storeinfo test locale && export LANG="$(storeinfo dump locale)"' 455 echo '[ -e "/usr/share/zoneinfo/UCT" ] || export TZ=UTC-00' 456 echo '[ "$(date -Ihours)" != "2021-11-25T15+00:00" ] && export TZ=UTC-00' 457 echo '[ "$DEBIAN_FRONTEND" = noninteractive ] && unset DEBIAN_FRONTEND && export DEBIAN_FRONTEND' 458 echo '[ "$DEBIAN_FRONTEND" = newt ] && unset DEBIAN_FRONTEND && export DEBIAN_FRONTEND' 459 echo '# container environment (--env)' 460 echo "export 'container=docker'" 461 echo "export 'XAUTHORITY=/x11docker/Xauthority.client'" 462 echo "export 'DISPLAY=:141'" 463 echo "export 'PULSE_COOKIE=/x11docker/pulseaudio.cookie'" 464 echo "export 'PULSE_SERVER=unix:/x11docker/pulseaudio.socket'" 465 echo "export 'USER=debian'" 466 echo '' 467 echo '[ -d "$HOME" ] && cd "$HOME"' 468 [ "$Workdir" ] && echo "[ -d \"$Workdir\" ] && cd \"$Workdir\" # WORKDIR in image" 469 echo '' 470 echo '' 471 echo 'env >> /x11docker/container.environment' 472 echo 'verbose "Container environment:' 473 echo '$(env | sort)"' 474 echo '' 475 echo 'tail -f /x11docker/stdout 2>/dev/null &' 476 echo 'tail -f /x11docker/stderr >&2 2>/dev/null &' 477 echo "exec \$Dbus sh /x11docker/cmdrc >>/x11docker/stdout 2>>/x11docker/stderr" 478 } >> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/containerrc 479 ######## End of containerrc ######## 480 481 # Write containerrc into x11docker.log 482 nl -ba >> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/x11docker.log < /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/containerrc 483 484 ######## Create cmdrc ######## 485 { echo '#! /bin/sh' 486 echo '# Created startscript for cmdrc containing final container command' 487 echo '' 488 echo 'storeinfo () 489 { 490 [ -e "$Storeinfofile" ] || return 1; 491 case "${1:-}" in 492 dump) 493 grep "^${2:-}=" $Storeinfofile | sed "s/^${2:-}=//" 494 ;; 495 drop) 496 sed -i "/^${2:-}=/d" $Storeinfofile 497 ;; 498 test) 499 grep -q "^${2:-}=" $Storeinfofile 500 ;; 501 *) 502 debugnote "storeinfo(): ${1:-}"; 503 grep -q "^$(echo "${1:-}" | cut -d= -f1)=" $Storeinfofile && { 504 sed -i "/^$(echo "${1:-}" | cut -d= -f1)=/d" $Storeinfofile 505 }; 506 echo "${1:-}" >> $Storeinfofile 507 ;; 508 esac 509 }' 510 echo ' 511 warning() { 512 echo "$*:WARNING" | sed "s/\$/ /" >>$Messagefile 513 } 514 note() { 515 echo "$*:NOTE" | sed "s/\$/ /" >>$Messagefile 516 } 517 verbose() { 518 echo "$*:VERBOSE" | sed "s/\$/ /" >>$Messagefile 519 } 520 debugnote() { 521 echo "$*:DEBUGNOTE" | sed "s/\$/ /" >>$Messagefile 522 } 523 error() { 524 echo "$*:ERROR" | sed "s/\$/ /" >>$Messagefile 525 exit 64 526 } 527 stdout() { 528 echo "$*:STDOUT" | sed "s/\$/ /" >>$Messagefile 529 }' 530 echo 'Messagefile=/x11docker/message.fifo' 531 echo "debugnote \"cmdrc: Running container command: 532 $Entrypoint $Containercommand 533 \"" 534 echo '' 535 echo "$Entrypoint $Containercommand " 536 echo '' 537 echo '[ -h "$Homesoftlink" ] && rm $Homesoftlink' 538 echo "storeinfo cmdexitcode=\$?" 539 } >> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/cmdrc 540 ######## End of cmdrc ######## 541 542 # Write cmdrc into x11docker.log 543 nl -ba >> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/x11docker.log < /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/cmdrc 544 545 # Send signal to run X and wait for X to be ready 546 storeinfo readyforX=ready 547 waitforlogentry 'dockerrc' /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/xinit.log 'xinitrc is ready' 'xinit: giving up|unable to connect to X server|Connection refused|server error|Only console users are allowed' 548 549 rocknroll || exit 64 550 551 552 rocknroll || exit 64 553 554 555 #### run docker image #### 556 read Containerid < <(docker run --detach --tty \ 557 --name x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 \ 558 --user 1000:1000 \ 559 --userns=host \ 560 --cap-drop ALL \ 561 --security-opt no-new-privileges \ 562 --security-opt label=type:container_runtime_t \ 563 --volume '/usr/bin/docker-init':'/usr/local/bin/init':ro \ 564 --tmpfs /run:exec --tmpfs /run/lock \ 565 --volume '/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share':'/x11docker':rw \ 566 --volume '/var/www/html/pccastor-com/wp-content/plugins/Loamok_xpra_docker_admin/system_admin-tpls/vms/pccastor_obzy7v/home/pccastor_obzy7v_wallet':'/home/debian':rw \ 567 --volume '/tmp/.X11-unix/X141':'/X141':rw \ 568 --volume /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/pulseaudio.client.conf:/etc/pulse/client.conf:ro \ 569 --workdir '/tmp' \ 570 --entrypoint env \ 571 --env 'container=docker' \ 572 --env 'XAUTHORITY=/x11docker/Xauthority.client' \ 573 --env 'DISPLAY=:141' \ 574 --env 'PULSE_COOKIE=/x11docker/pulseaudio.cookie' \ 575 --env 'PULSE_SERVER=unix:/x11docker/pulseaudio.socket' \ 576 --env 'USER=debian' \ 577 -- pccastor_obzy7v_wallet:latest /usr/local/bin/init -- /bin/sh - /x11docker/containerrc 2>>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log | rmcr) 578 ########################## 579 580 581 [ "$Containerid" ] || { 582 error "Startup of docker failed. Did not receive a container ID. 583 584 Last lines of container log: 585 $(rmcr < /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log | tail)" 586 } 587 storeinfo containerid="$Containerid" 588 # Wait for container to be ready 589 for ((Count=1 ; Count<=40 ; Count++)); do 590 docker exec x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 sh -c : 2>&1 | rmcr >>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log && { debugnote 'dockerrc: Container is up and running.' ; break ; } || debugnote "dockerrc: Container not ready on $Count. attempt, trying again." 591 rocknroll || exit 64 592 mysleep 0.1 593 done 594 595 # Wait for pid 1 in container 596 for ((Count=1 ; Count<=40 ; Count++)); do 597 Pid1pid="$(docker inspect --format '{{.State.Pid}}' x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 2>>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log | rmcr)" 598 debugnote "dockerrc: $Count. check for PID 1: $Pid1pid" 599 checkpid "$Pid1pid" && break 600 rocknroll || exit 64 601 mysleep 0.1 602 done 603 [ "$Pid1pid" = "0" ] && Pid1pid="" 604 [ -z "$Pid1pid" ] && error "dockerrc(): Did not receive PID of PID1 in container. 605 Maybe the container immediately stopped for unknown reasons. 606 Just in case, check if host and image architecture are compatible: 607 Host architecture: amd64 (x86_64), image architecture: $Containerarchitecture. 608 Output of \"docker ps | grep x11docker\": 609 $(docker ps | grep x11docker) 610 611 Content of container log: 612 $(rmcr < /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log | uniq )" 613 storeinfo pid1pid="$Pid1pid" 614 615 # Get IP of container 616 Containerip="$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 2>>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log)" 617 storeinfo containerip=$Containerip 618 619 # Check log for startup failure 620 Failure="$(rmcr < /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log | grep -v grep | grep -E 'Error response from daemon|OCI runtime exec' ||:)" 621 [ "$Failure" ] && { 622 echo "$Failure" >>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log 623 error "Got error message from docker: 624 $Failure 625 626 Last lines of logfile: 627 $(tail /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log)" 628 } 629 630 debugnote 'dockerrc(): Starting containerrootrc with docker exec' 631 # copy containerrootrc inside of container to avoid possible noexec of host home. 632 docker exec x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 sh -c 'cp /x11docker/containerrootrc /tmp/containerrootrc ; chmod 644 /tmp/containerrootrc' 2>&1 | rmcr >>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log 633 # run container root setup. containerrc will wait until setup script is ready. 634 docker exec -u root x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 /bin/sh /tmp/containerrootrc 2>&1 | rmcr >>/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log 635 636 storeinfo dockerrc=ready 637 638 [ "$Containerid" ] || [ "$Wmcontainerid" ] && { 639 # wait for signal of finish() 640 read Signal > /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log 2>&1 & 643 [ "$Wmcontainerid" ] && docker stop $Wmcontainerid >> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log 2>&1 & 644 [ "$Dockerlogspid" ] && kill $Dockerlogspid >> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log 2>&1 & 645 } 646 } & storepid $! dockerstopshell 647 exit 0 x11docker[15:40:46,633]: Generated containerrootrc: 1 #! /bin/sh 2 3 # containerrootrc 4 # This Script is executed as root in container. 5 # - Create container user 6 # - Time zone 7 # - Install NVIDIA driver if requested 8 # - Set up init system services and DBus for --init=systemd|openrc|runit|sysvinit 9 10 # redirect output to have it available before 'docker logs' starts. --init=runit (void) would eat up the output at all for unknown reasons. 11 exec 1>>/x11docker/container.log 2>&1 12 13 storeinfo () 14 { 15 [ -e "$Storeinfofile" ] || return 1; 16 case "${1:-}" in 17 dump) 18 grep "^${2:-}=" $Storeinfofile | sed "s/^${2:-}=//" 19 ;; 20 drop) 21 sed -i "/^${2:-}=/d" $Storeinfofile 22 ;; 23 test) 24 grep -q "^${2:-}=" $Storeinfofile 25 ;; 26 *) 27 debugnote "storeinfo(): ${1:-}"; 28 grep -q "^$(echo "${1:-}" | cut -d= -f1)=" $Storeinfofile && { 29 sed -i "/^$(echo "${1:-}" | cut -d= -f1)=/d" $Storeinfofile 30 }; 31 echo "${1:-}" >> $Storeinfofile 32 ;; 33 esac 34 } 35 rocknroll () 36 { 37 [ -s "$Timetosaygoodbyefile" ] && return 1; 38 [ -e "$Timetosaygoodbyefile" ] || return 1; 39 return 0 40 } 41 42 warning() { 43 echo "$*:WARNING" | sed "s/\$/ /" >>$Messagefile 44 } 45 note() { 46 echo "$*:NOTE" | sed "s/\$/ /" >>$Messagefile 47 } 48 verbose() { 49 echo "$*:VERBOSE" | sed "s/\$/ /" >>$Messagefile 50 } 51 debugnote() { 52 echo "$*:DEBUGNOTE" | sed "s/\$/ /" >>$Messagefile 53 } 54 error() { 55 echo "$*:ERROR" | sed "s/\$/ /" >>$Messagefile 56 exit 64 57 } 58 stdout() { 59 echo "$*:STDOUT" | sed "s/\$/ /" >>$Messagefile 60 } 61 Messagefile=/x11docker/message.fifo 62 Storeinfofile='/x11docker/store.info' 63 Timetosaygoodbyefile=/x11docker/timetosaygoodbye 64 65 debugnote 'Running containerrootrc: Setup as root in container' 66 67 Error='' 68 for Line in cat chmod chown cut cd cp date echo env export grep id ln ls mkdir mv printf rm sed sh sleep tail touch; do 69 command -v "$Line" || { 70 warning "ERROR: Command not found in image: $Line" 71 Error=1 72 } 73 done 74 [ "$Error" ] && error 'Commands for container setup missing in image. 75 You can try with option --no-setup to avoid this error.' 76 77 # Check type of libc 78 ldd --version 2>&1 | grep -q 'musl libc' && Containerlibc='musl' 79 ldd --version 2>&1 | grep -q -E 'GLIBC|GNU libc' && Containerlibc='glibc' 80 debugnote "containerrootrc: Container libc: $Containerlibc" 81 82 # Prepare X environment 83 # Create some system dirs with needed permissions 84 mkdir -v -p /var/lib/dbus /var/run/dbus 85 mkdir -v -p -m 1777 /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix 86 chmod -c 1777 /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix 87 export DISPLAY=:141 XAUTHORITY=/x11docker/Xauthority.client 88 89 # workaround: autostart of xrandr for some desktops like deepin, cinnamon and gnome to fix wrong autoresize 90 echo '#! /bin/sh 91 Output=$(xrandr | grep ' connected' | cut -d" " -f1) 92 Mode=1980x1200 93 xrandr --output $Output --mode $Mode\n' > /usr/local/bin/x11docker-xrandr 94 chmod +x /usr/local/bin/x11docker-xrandr 95 mkdir -p /etc/xdg/autostart 96 echo '[Desktop Entry] 97 Encoding=UTF-8 98 Version=0.9.4 99 Type=Application 100 Name=x11docker-xrandr 101 Comment= 102 Exec=/usr/local/bin/x11docker-xrandr 103 ' > /etc/xdg/autostart/x11docker-xrandr.desktop 104 105 # Time zone 106 [ ! -d /usr/share/zoneinfo ] && [ "$Containerlibc" = "glibc" ] && { 107 mkdir -p /usr/share/zoneinfo 108 cp '/x11docker/libc.localtime' '/usr/share/zoneinfo/UCT' 109 } 110 [ -e '/usr/share/zoneinfo/UCT' ] && ln -f -s '/usr/share/zoneinfo/UCT' /etc/localtime 111 112 # Container system 113 Containersystem="$(grep '^ID=' /etc/os-release 2>/dev/null | cut -d= -f2 || echo 'unknown')" 114 verbose "Container system ID: $Containersystem" 115 116 # Environment variables 117 export 'container=docker' 118 export 'XAUTHORITY=/x11docker/Xauthority.client' 119 export 'DISPLAY=:141' 120 export 'PULSE_COOKIE=/x11docker/pulseaudio.cookie' 121 export 'PULSE_SERVER=unix:/x11docker/pulseaudio.socket' 122 export 'USER=debian' 123 124 # Check container user 125 Containeruser="$(storeinfo dump containeruser)" 126 Containeruser="${Containeruser:-debian}" 127 128 Containeruserhome='/home/debian' 129 # Create user entry in /etc/passwd (and delete possibly existing same uid) 130 cat /etc/passwd | grep -v ':1000:' > /tmp/passwd 131 132 # Disable possible /etc/shadow passwords for other users 133 sed -i 's%:x:%:-:%' /tmp/passwd 134 bash --version >/dev/null 2>&1 && Containerusershell=/bin/bash || Containerusershell=/bin/sh 135 Containeruserentry="debian:x:1000:1000:debian,,,:/home/debian:$Containerusershell" 136 debugnote "containerrootrc: $Containeruserentry" 137 echo "$Containeruserentry" >> /tmp/passwd 138 139 rm /etc/passwd 140 mv /tmp/passwd /etc/passwd || warning 'Unable to change /etc/passwd. That may be a security risk.' 141 142 # Create password entry for container user in /etc/shadow 143 rm -v /etc/shadow || warning 'Cannot change /etc/shadow. That may be a security risk.' 144 echo "debian:sac19FwGGTx/A:17293:0:99999:7:::" > /etc/shadow 145 echo 'root:*:17219:0:99999:7:::' >> /etc/shadow 146 chmod 640 /etc/shadow # can fail depending on available capabilities 147 148 # Create user group entry (and delete possibly existing same gid) 149 cat /etc/group | grep -v ':1000:' > /tmp/group 150 echo "debian:x:1000:" >> /tmp/group 151 mv /tmp/group /etc/group 152 153 # Create /etc/sudoers, delete /etc/sudoers.d. Overwrite possible sudo setups in image. 154 [ -e /etc/sudoers.d ] && rm -v -R /etc/sudoers.d 155 [ -e /etc/sudoers ] && rm -v /etc/sudoers 156 echo '# /etc/sudoers created by x11docker' > /etc/sudoers 157 echo 'Defaults env_reset' >> /etc/sudoers 158 echo 'root ALL=(ALL) ALL' >> /etc/sudoers 159 160 # Restrict PAM configuration of su and sudo 161 mkdir -p /etc/pam.d 162 [ -e /etc/pam.d/sudo ] && rm -v /etc/pam.d/sudo 163 case "$Containersystem" in 164 fedora) 165 echo '#%PAM-1.0' > /etc/pam.d/su 166 echo 'auth sufficient pam_rootok.so' >> /etc/pam.d/su 167 echo 'account sufficient pam_succeed_if.so uid = 0 use_uid quiet' >> /etc/pam.d/su 168 echo 'session include system-auth' >> /etc/pam.d/su 169 ;; 170 *) 171 echo '#%PAM-1.0' > /etc/pam.d/su 172 echo 'auth sufficient pam_rootok.so' >> /etc/pam.d/su # allow root to switch user without a password 173 echo '@include common-auth' >> /etc/pam.d/su 174 echo '@include common-account' >> /etc/pam.d/su 175 echo '@include common-session' >> /etc/pam.d/su 176 ;; 177 esac 178 179 # Set up container user groups 180 # Create HOME 181 [ -e "$Containeruserhome" ] || { 182 mkdir -v -p "$(dirname "$Containeruserhome")" 183 mkdir -v -m 777 "$Containeruserhome" 184 chown -v "$Containeruser":"$Containerusergroup" "$Containeruserhome" && chmod -v 755 "$Containeruserhome" # can fail depending on capabilities 185 } 186 ls -la $Containeruserhome 187 188 rocknroll || exit 64 189 190 191 # disable getty in inittab 192 [ -e /etc/inittab ] && sed -i 's/.*getty/##getty disabled by x11docker## \0/' /etc/inittab 193 194 195 rocknroll || exit 64 196 197 # --lang: Language locale 198 verbose "Searching for language locale matching fr" 199 Locales="$(locale -a)" 200 Langall="$(cat /usr/share/i18n/SUPPORTED | grep -E 'UTF-8|utf8' | cut -d' ' -f1 | cut -d. -f1 | cut -d@ -f1 | sort | uniq)" 201 Langland="$(echo fr | cut -d. -f1)" 202 Langcontainer='' 203 204 echo "$Langland" | grep -q '_' || { 205 Langland="$(echo $Langland | tr '[:upper:]' '[:lower:]')_$(echo $Langland | tr '[:lower:]' '[:upper:]')" 206 echo "$Langall" | grep -q "$Langland" || { 207 echo "$Langall" | grep -i -q "fr" && { 208 Langland="$(echo "$Langall" | grep -i -m1 "fr")" 209 } 210 } 211 } 212 213 Langland="$(echo "$Langland" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')_$(echo "$Langland" | cut -d_ -f2 | tr '[:lower:]' '[:upper:]')" 214 215 echo "$Locales" | grep -q "$Langland.UTF-8" && Langcontainer="$Langland.UTF-8" 216 echo "$Locales" | grep -q "$Langland.utf8" && Langcontainer="$Langland.utf8" 217 218 [ -z "$Langcontainer" ] && { 219 [ -e /usr/share/i18n/SUPPORTED ] || note "Option --lang: /usr/share/i18n/SUPPORTED not found. 220 Please install package 'locales' in image (belongs to glibc). 221 Look here to find a package for your image system: 222 https://github.com/mviereck/x11docker/wiki/dependencies#dependencies-in-image" 223 224 Langcontainer="$Langland.utf8" 225 note "Option --lang: Generating language locale $Langcontainer". 226 227 command -v localedef >/dev/null || note 'Option --lang: Command localedef not found in image. 228 Need it for language locale creation. 229 Look here to find a package for your image system: 230 https://github.com/mviereck/x11docker/wiki/dependencies#dependencies-in-image' 231 localedef --verbose --force -i "$Langland" -f UTF-8 $Langcontainer || verbose "localedef exit code: $?" 232 233 locale -a | grep -q "$Langcontainer" || { 234 note "Option --lang: Generation of locale $Langcontainer failed." 235 Langcontainer='' 236 } 237 } || { 238 debugnote "Option --lang: Found locale in image: $Langcontainer" 239 } 240 241 [ "$Langcontainer" ] && { 242 storeinfo locale="$Langcontainer" 243 echo "LANG=$Langcontainer" > /etc/default/locale 244 } || note 'Option --lang: Desired locale for 'fr' not found and not generated.' 245 246 debugnote "Option --lang: Output of locale -a: 247 $(locale -a)" 248 249 rocknroll || exit 64 250 251 storeinfo containerrootrc=ready 252 x11docker[15:40:46,657]: Generated xinitrc: 1 #! /bin/sh 2 disable_xhost () 3 { 4 local Line=; 5 command -v xhost > /dev/null || { 6 warning "Command 'xhost' not found. 7 Can not check for possibly allowed network access to X. 8 Please install 'xhost'."; 9 return 1 10 }; 11 xhost 2>&1 | tail -n +2 /dev/stdin | while read -r Line; do 12 debugnote "xhost: Removing entry $Line"; 13 xhost -$Line; 14 done; 15 xhost -; 16 [ "$(xhost 2>&1 | wc -l)" -gt "1" ] && { 17 warning "Remaining xhost permissions found on display ${DISPLAY:-} 18 $(xhost 2>&1 )"; 19 return 1 20 }; 21 xhost 2>&1 | grep "access control disabled" && { 22 warning "Failed to restrict xhost permissions. 23 Access to display ${DISPLAY:-} is allowed for everyone."; 24 return 1 25 }; 26 return 0 27 } 28 pspid () 29 { 30 LC_ALL=C ps -p "${1:-}" 2> /dev/null | grep -v 'TIME' 31 } 32 rocknroll () 33 { 34 [ -s "$Timetosaygoodbyefile" ] && return 1; 35 [ -e "$Timetosaygoodbyefile" ] || return 1; 36 return 0 37 } 38 storeinfo () 39 { 40 [ -e "$Storeinfofile" ] || return 1; 41 case "${1:-}" in 42 dump) 43 grep "^${2:-}=" $Storeinfofile | sed "s/^${2:-}=//" 44 ;; 45 drop) 46 sed -i "/^${2:-}=/d" $Storeinfofile 47 ;; 48 test) 49 grep -q "^${2:-}=" $Storeinfofile 50 ;; 51 *) 52 debugnote "storeinfo(): ${1:-}"; 53 grep -q "^$(echo "${1:-}" | cut -d= -f1)=" $Storeinfofile && { 54 sed -i "/^$(echo "${1:-}" | cut -d= -f1)=/d" $Storeinfofile 55 }; 56 echo "${1:-}" >> $Storeinfofile 57 ;; 58 esac 59 } 60 storepid () 61 { 62 case "${1:-}" in 63 dump) 64 grep -w "${2:-}" "$Storepidfile" | cut -d' ' -f1 65 ;; 66 test) 67 grep -q -w "${2:-}" "$Storepidfile" 68 ;; 69 *) 70 echo "${1:-NOPID}" "${2:-NONAME}" >> "$Storepidfile"; 71 debugnote "storepid(): Stored pid '${1:-}' of '${2:-}': $(pspid ${1:-} ||:)" 72 ;; 73 esac 74 } 75 76 warning() { 77 echo "$*:WARNING" | sed "s/\$/ /" >>$Messagefile 78 } 79 note() { 80 echo "$*:NOTE" | sed "s/\$/ /" >>$Messagefile 81 } 82 verbose() { 83 echo "$*:VERBOSE" | sed "s/\$/ /" >>$Messagefile 84 } 85 debugnote() { 86 echo "$*:DEBUGNOTE" | sed "s/\$/ /" >>$Messagefile 87 } 88 error() { 89 echo "$*:ERROR" | sed "s/\$/ /" >>$Messagefile 90 exit 64 91 } 92 stdout() { 93 echo "$*:STDOUT" | sed "s/\$/ /" >>$Messagefile 94 } 95 getscreensize() { 96 CurrentXaxis="$(xrandr | grep primary | cut -d' ' -f4 | cut -dx -f1 )" 97 CurrentYaxis="$(xrandr | grep primary | cut -d' ' -f4 | cut -dx -f2 | cut -d+ -f1)" 98 } 99 checkscreensize() { 100 getscreensize 101 [ "$Xaxis" = "$CurrentXaxis" ] || return 1 102 [ "$Yaxis" = "$CurrentYaxis" ] || return 1 103 return 0 104 } 105 getprimary() { 106 xrandr | grep -q primary || xrandr --output $(xrandr | grep ' connected' | head -n1 | cut -d' ' -f1) --primary 107 echo $(xrandr | grep primary | cut -d' ' -f1) 108 } 109 110 Messagefile='/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/message.fifo' 111 Output="$(getprimary)" 112 Storeinfofile='/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/store.info' 113 Storepidfile='/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/store.pids' 114 Timetosaygoodbyefile='/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/timetosaygoodbye' 115 116 export PATH='/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin' 117 118 Cookie='' 119 Line='' 120 Var='' 121 122 debugnote 'Running xinitrc' 123 124 export DISPLAY=:141 XAUTHORITY=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X141 125 # background color 126 xsetroot -solid '#7F7F7F' 2>/dev/null 127 128 # create new XAUTHORITY cookies 129 :> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client 130 131 verbose 'Can not use cookies created over SSH. Will bake one myself.' 132 133 [ -s '/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client' ] || { 134 [ 'trusted' = 'untrusted' ] && note 'Could not create untrusted cookie. 135 Maybe your X server misses extension SECURITY.' 136 } 137 [ -s '/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client' ] || { 138 # still no cookie? try to create one without extension security 139 debugnote 'xinitrc: Failed to retrieve trusted cookie from X server. Will bake one myself.' 140 echo 'Failed to retrieve trusted cookie from X server. Will bake one myself.' 141 xauth -v -i -f /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client add :141 . 2ea903beebd82b13c6121229f81db18d 142 ls -l /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client 143 } 144 145 # Prepare cookie with localhost identification disabled by ffff, needed if X socket is shared. ffff means 'familiy wild' 146 Cookie="$(xauth -i -f /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client nlist | sed -e 's/^..../ffff/')" 147 echo "$Cookie" | xauth -v -i -f /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client nmerge - 148 149 debugnote "xinitrc: Created cookie: $(xauth -f /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client list 2>&1)" 150 ls -l /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client 151 cp /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/Xauthority.server 152 chmod 644 /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client 153 154 [ -s '/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client' ] || warning 'Cookie creation failed!' 155 export XAUTHORITY=/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client 156 [ 'yes' = 'no' ] || [ ! -s '/home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/Xauthority.client' ] && unset XAUTHORITY && warning '--xvfb: X server :141 runs without cookie authentication.' 157 158 # clean xhost 159 verbose 'Disabling any possible access to new X server possibly granted by xhost' 160 disable_xhost 161 162 # Keyboard layout 163 164 # create set of different screen resolutions 165 xrandr --newmode "1984x1200" 199.25 1984 2120 2328 2672 1200 1203 1213 1245 -hsync +vsync 166 xrandr --addmode $Output "1984x1200" 167 while read Line; do 168 Line="$(echo "$Line" | sed 's/Modeline//g')" 169 Line="$(echo "$Line" | sed 's/"//g')" 170 xrandr --newmode $Line 2>/dev/null 171 xrandr --addmode "$Output" $(echo $Line | cut -d' ' -f1) 2>/dev/null 172 done < "/home/debian/.cache/x11docker/modelines.1980x1200" 173 174 175 verbose "Output of xrandr on :141 176 $(xrandr)" 177 178 echo 'xinitrc: xinitrc is ready' 179 storeinfo xinitrc=ready 180 181 # wait for the end 182 read Var /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/share/container.log <== WARNING: No swap limit support ==> /home/debian/.cache/x11docker/pccastor_obzy7v_wallet-latest-54843897472/message.log <== DEBUGNOTE[15:40:46,825]: dockerrc: Found default container Runtime: runc DEBUGNOTE[15:40:46,847]: dockerrc: All Runtimes: runc DEBUGNOTE[15:40:46,868]: dockerrc: Container Runtime: UNDECLARED_RUNTIME DEBUGNOTE[15:40:46,886]: storeinfo(): runtime=UNDECLARED_RUNTIME DEBUGNOTE[15:40:46,924]: waitforlogentry(): start_docker(): Waiting for logentry "dockerrc=ready" in store.info DEBUGNOTE[15:40:46,926]: storeinfo(): xtermrc=ready DEBUGNOTE[15:40:47,226]: waitforlogentry(): start_xserver(): Stopped waiting for readyforX=ready in store.info due to terminating signal. DEBUGNOTE[15:40:47,235]: traperror: Command at Line 9257 returned with error code 1: return 1 9271 - ::main::main DEBUGNOTE[15:40:47,242]: storeinfo(): error=64 DEBUGNOTE[15:40:47,261]: time to say goodbye (traperror) DEBUGNOTE[15:40:47,270]: time to say goodbye (main) DEBUGNOTE[15:40:47,279]: Terminating x11docker. DEBUGNOTE[15:40:47,289]: time to say goodbye (finish) DEBUGNOTE[15:40:47,339]: finish(): Checking pid 29857 (containershell): 29857 pts/2 00:00:00 bash DEBUGNOTE[15:40:47,370]: termpid(): Terminating 29857 (containershell): 29857 pts/2 00:00:00 bash DEBUGNOTE[15:40:47,516]: finish(): Checking pid 28904 (watchmessagefifo): 28904 pts/2 00:00:00 bash DEBUGNOTE[15:40:47,560]: finish(): Checking pid 28883 (watchpidlist): (already gone) DEBUGNOTE[15:40:47,646]: Removing container x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 Error: No such container: x11docker_X141_pccastor_obzy7v_wallet-latest_54843897472 DEBUGNOTE[15:40:47,706]: termpid(): Terminating 28904 (watchmessagefifo): 28904 pts/2 00:00:00 bash DEBUGNOTE[15:40:47,841]: x11docker exit code: 64