Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide for Dummies (like me ^^) #29

Open
Bonifatius94 opened this issue Jan 18, 2020 · 11 comments
Open

Guide for Dummies (like me ^^) #29

Bonifatius94 opened this issue Jan 18, 2020 · 11 comments
Labels
enhancement New feature or request

Comments

@Bonifatius94
Copy link

Hi Eric! Great work! I appreciate it a lot!

Could you please make a little 5 to 10 commands setup guide to get your stuff to work on some popular linux distros? This would be great :D

I've done something like the following commands for my setup onto Ubuntu 18.04 LTS.

# install docker and git
sudo apt-get update && sudo apt-get install -y docker.io git
sudo usermod -aG docker $USER
reboot

# install x11docker
cd ~
git clone https://github.com/mviereck/x11docker
sudo cp x11docker/x11docker* /usr/bin/
sudo /usr/bin/x11docker --install

# pull the latest docker image
docker pull erichough/kodi:latest

# create dockerized kodi system service definition (you need to play a bit around with the settings of the [service] section to get this how you need it)
sudo nano /etc/systemd/system/kodi.service
================================
[Unit]
Description=Dockerized Kodi
Requires=docker.service
After=network.target docker.service

[Service]
# Pulling the docker image before every service startup is not required as we've already pulled the image once. This also allows to fix the kodi-docker version, but also avoids that updates are pulled automatically.
#ExecStartPre=/usr/bin/docker pull erichough/kodi
ExecStart=/usr/bin/x11docker --xorg --pulseaudio erichough/kodi
# I've decided to disable the restart option as long as I need to make changes to the service as kodi will always restart when you try exit it. You can enable this option if you got everything set up.
#Restart=always
KillMode=process

[Install]
WantedBy=multi-user.target
================================

# enable the kodi service, so it starts up automatically at boot
sudo systemctl daemon-reload && sudo systemctl enable kodi
reboot

# the dockerized kodi should start automatically after the reboot

I've already tested this approach, so you could put it to your github wiki or something like that ;)

Best wishes
Marco

@ehough
Copy link
Owner

ehough commented Jan 21, 2020

Great idea! I will add something like this as soon as I can. Thanks for the sample!

@Bonifatius94
Copy link
Author

You're welcome to use my snippet!

I've actually found a little misstake. I guess the line "sudo /usr/bin/x11docker --install" can be removed. It should not harm, but is unnecessary.

@RobertusIT
Copy link

RobertusIT commented Oct 1, 2021

You're welcome to use my snippet!

I've actually found a little misstake. I guess the line "sudo /usr/bin/x11docker --install" can be removed. It should not harm, but is unnecessary.

Hi,

i have tried your tutorial , without success.

I have this error:

`Ubuntu 21.04 KODI tty1

KODI login: root
Password: 
Welcome to Ubuntu 21.04 (GNU/Linux 5.11.22-4-pve x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
Last login: Fri Oct  1 10:05:44 UTC 2021 on lxc/tty1
root@KODI:~# systemctl status kodi
* kodi.service - Dockerized Kodi
     Loaded: loaded (/etc/systemd/system/kodi.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2021-10-01 10:07:48 UTC; 29s ago
    Process: 563 ExecStart=/usr/bin/x11docker --xorg --pulseaudio erichough/kodi (code=exited, status=64)
   Main PID: 563 (code=exited, status=64)
        CPU: 521ms

Oct 01 10:07:47 KODI x11docker[1096]:     To run from TTY or within Wayland, install:
Oct 01 10:07:47 KODI x11docker[1096]:       weston and Xwayland
Oct 01 10:07:47 KODI x11docker[1096]:   You can look for the package name of this command at:
Oct 01 10:07:47 KODI x11docker[1096]:  https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
Oct 01 10:07:47 KODI x11docker[1096]:   Type 'x11docker --help' for usage information
Oct 01 10:07:47 KODI x11docker[1096]:   Debug options: '--verbose' (full log) or '--debug' (log excerpt).
Oct 01 10:07:47 KODI x11docker[1096]:   Logfile will be: /root/.cache/x11docker/x11docker.log
Oct 01 10:07:47 KODI x11docker[1096]:   Please report issues at https://github.com/mviereck/x11docker
Oct 01 10:07:48 KODI systemd[1]: kodi.service: Main process exited, code=exited, status=64/USAGE
Oct 01 10:07:48 KODI systemd[1]: kodi.service: Failed with result 'exit-code'.`

If I try that, I have this error:

`root@KODI:~# /usr/bin/x11docker --install
x11docker WARNING: Running as user root.
  Maybe $(logname) did not provide an unprivileged user.
  Please use option --hostuser=USER to specify an unprivileged user.
  Otherwise, new X server runs as root, and container user will be root.

x11docker WARNING: User root is member of group docker.
  That allows unprivileged processes on host to gain root privileges.


x11docker ERROR: File x11docker not found in current folder.
  Try 'x11docker --update' instead.

  Type 'x11docker --help' for usage information
  Debug options: '--verbose' (full log) or '--debug' (log excerpt).
  Logfile will be: /root/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker`

And If i tried to update x11docker, I have this output:

`root@KODI:~# x11docker --update
x11docker WARNING: Running as user root.
  Maybe $(logname) did not provide an unprivileged user.
  Please use option --hostuser=USER to specify an unprivileged user.
  Otherwise, new X server runs as root, and container user will be root.

x11docker WARNING: User root is member of group docker.
  That allows unprivileged processes on host to gain root privileges.

x11docker note: Current installed version: x11docker 6.9.0

--2021-10-01 10:17:37--  https://raw.githubusercontent.com/mviereck/x11docker/master/CHANGELOG.md
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.108.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 100056 (98K) [text/plain]
Saving to: 'CHANGELOG.md'

CHANGELOG.md                      100%[============================================================>]  97.71K  --.-KB/s    in 0.03s   

2021-10-01 10:17:37 (3.07 MB/s) - 'CHANGELOG.md' saved [100056/100056]

x11docker note: Downloading latest x11docker release v6.9.0 from github.

--2021-10-01 10:17:37--  https://codeload.github.com/mviereck/x11docker/tar.gz/v6.9.0
Resolving codeload.github.com (codeload.github.com)... 140.82.121.10
Connecting to codeload.github.com (codeload.github.com)|140.82.121.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: 'x11docker-update.tar.gz'

x11docker-update.tar.gz               [ <=>                                                         ] 171.39K  --.-KB/s    in 0.1s    

2021-10-01 10:17:38 (1.43 MB/s) - 'x11docker-update.tar.gz' saved [175505]

x11docker note: Extracting tar.gz archive.


x11docker note: Installing x11docker and x11docker-gui in /usr/bin

x11docker note: Installing icon for x11docker with xdg-icon-resource

/usr/bin/x11docker: line 1427: xdg-icon-resource: command not found
x11docker WARNING: Could not install icon for x11docker.
  Is 'xdg-icon-resource' (xdg-utils) installed on your system?

/usr/bin/x11docker: line 1429: xdg-icon-resource: command not found
x11docker note: Creating application entry for x11docker.

x11docker note: Could not find 'kaptain' for x11docker-gui.
  Consider to install 'kaptain' (version 0.73 or higher).
  It's useful for x11docker-gui only, though. x11docker itself doesn't need it.
  If your distributions does not provide kaptain, look at kaptain repository:
    https://github.com/mviereck/kaptain
  Fallback: x11docker-gui will try to use image x11docker/kaptain.

x11docker note: Storing README.md, CHANGELOG.md and LICENSE.txt in
  /usr/share/doc/x11docker

x11docker note: Installed x11docker version 6.9.0

x11docker note: Removing downloaded temporary files.

x11docker note: Version 6.9.0 was already installed before this update.
  If you want the latest beta version from master branch, use --update-master.

x11docker note: Excerpt of x11docker changelog:
## [6.9.0](https://github.com/mviereck/x11docker/releases/tag/v6.9.0) - 2021-06-02
### Added
 - `--backend=BACKEND`: Experimental option to choose a container backend.
   Currently supported: `docker`, `podman` and `nerdctl`.
   [(#255)](https://github.com/mviereck/x11docker/issues/255)
   [(#357)](https://github.com/mviereck/x11docker/issues/357)
 - Support of rootless docker.
   [(#327)](https://github.com/mviereck/x11docker/issues/327)
 - `--composite`: New option to enable or disable X extension Composite.
   Can help to fix issues with `--nxagent`.
   [(#345)](https://github.com/mviereck/x11docker/issues/345)
 - `--no-setup`: Disable x11docker setup in container. (Formerly experimental.)
### Changed
 - `--pw [=FRONTEND]`: Argument `FRONTEND` is optional now to allow easy
   switch to rootful nerdctl or podman. Setting `FRONTEND` requires `=`.
 - `--xhost [=STR]`: Agument `STR` is optional now. If empty, set to
   `+SI:localuser:$USER`. Setting `STR` requires `=`.
### Fixed
 - `x11docker-gui`: Fixed `--share` bug. Add several missing options.
   [(#358)](https://github.com/mviereck/x11docker/issues/358)
 - `--init=s6-overlay`: Use `--tmpfs /run:exec`
   [(#340)](https://github.com/mviereck/x11docker/issues/340)
 - `containerrootrc`: Don't run `docker exec --privileged` for container root
   setup to avoid possible abuse by corrupted core utils.
 - `--limit`: Change free memory check.
   [(#360)](https://github.com/mviereck/x11docker/issues/360)
### Deprecated
 - `--podman`: Use `--backend=podman` instead. (Formerly experimental)

x11docker note: Ready.`

@Bonifatius94
Copy link
Author

Sorry @RobertusIT, but this is only tested for Ubuntu 18.04 LTS. I didn't use that snippet since then. You'll need to figure it out yourself, I guess.

@RobertusIT
Copy link

RobertusIT commented Oct 1, 2021

Sorry @RobertusIT, but this is only tested for Ubuntu 18.04 LTS. I didn't use that snippet since then. You'll need to figure it out yourself, I guess.

Hi,

thanks to reply

I have installed 18.04 but doesn't works, same error:

`Ubuntu 18.04.1 LTS KODI-UBUNTU tty1

KODI-UBUNTU login: root
Password: 
Last login: Fri Oct  1 10:35:30 UTC 2021 on lxc/tty1
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 5.11.22-4-pve x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

New release '20.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

root@KODI-UBUNTU:~# systemctl enable kodi
root@KODI-UBUNTU:~# systemctl status kodi
* kodi.service - Dockerized Kodi
   Loaded: loaded (/etc/systemd/system/kodi.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2021-10-01 10:59:03 UTC; 29s ago
 Main PID: 587 (code=exited, status=64)

Oct 01 10:59:03 KODI-UBUNTU x11docker[587]:     To run from TTY or within Wayland, install:
Oct 01 10:59:03 KODI-UBUNTU x11docker[587]:       weston and Xwayland
Oct 01 10:59:03 KODI-UBUNTU x11docker[587]:   You can look for the package name of this command at:
Oct 01 10:59:03 KODI-UBUNTU x11docker[587]:  https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
Oct 01 10:59:03 KODI-UBUNTU x11docker[587]:   Type 'x11docker --help' for usage information
Oct 01 10:59:03 KODI-UBUNTU x11docker[587]:   Debug options: '--verbose' (full log) or '--debug' (log excerpt).
Oct 01 10:59:03 KODI-UBUNTU x11docker[587]:   Logfile will be: /root/.cache/x11docker/x11docker.log
Oct 01 10:59:03 KODI-UBUNTU x11docker[587]:   Please report issues at https://github.com/mviereck/x11docker
Oct 01 10:59:03 KODI-UBUNTU systemd[1]: kodi.service: Main process exited, code=exited, status=64/n/a
Oct 01 10:59:03 KODI-UBUNTU systemd[1]: kodi.service: Failed with result 'exit-code'`

Maybe needed to install some others stuff into host ? outside docker container?

I use proxmox and i have created:

  • an lxc container
  • install docker
  • followed your tutorial
  • i didn't installed stuff into host ( outside docker ) maybe i need to install wayland or other stuff in host ( outside docker ) ? If yes, how ?

@Bonifatius94
Copy link
Author

Then I don't know what to do, sorry. You'll need to figure it out yourself. Maybe it's just a machine-related / driver-related issue because we are using different devices etc.

@RobertusIT
Copy link

RobertusIT commented Oct 1, 2021

I have this error now:


`root@KODI-UBUNTU:~# systemctl status kodi
* kodi.service - Dockerized Kodi
   Loaded: loaded (/etc/systemd/system/kodi.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-10-01 17:00:41 UTC; 16s ago
 Main PID: 2346 (bash)
    Tasks: 14 (limit: 18974)
   CGroup: /system.slice/kodi.service
           |-2346 bash /usr/bin/x11docker --xorg --pulseaudio erichough/kodi
           |-2781 bash /usr/bin/x11docker --xorg --pulseaudio erichough/kodi
           |-2783 tail --pid=2346 --retry -n +1 -F /root/.cache/x11docker/erichough-kodi-07641451141/share/stderr /root/.cache/x11docke
           |-2784 bash /usr/bin/x11docker --xorg --pulseaudio erichough/kodi
           |-2785 bash /usr/bin/x11docker --xorg --pulseaudio erichough/kodi
           |-3778 tail --pid=2346 -n +1 -f /root/.cache/x11docker/erichough-kodi-07641451141/share/stdout
           |-3779 tail --pid=2346 -n +1 -f /root/.cache/x11docker/erichough-kodi-07641451141/share/stderr
           |-3956 bash /usr/bin/x11docker --xorg --pulseaudio erichough/kodi
           `-3957 docker rm -f x11docker_X105_erichough-kodi_07641451141

Oct 01 17:00:43 KODI-UBUNTU x11docker[2346]: (EE)
Oct 01 17:00:43 KODI-UBUNTU x11docker[2346]: (WW) xf86CloseConsole: KDSETMODE failed: Bad file descriptor
Oct 01 17:00:43 KODI-UBUNTU x11docker[2346]: (WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor
Oct 01 17:00:43 KODI-UBUNTU x11docker[2346]: (EE) Server terminated with error (1). Closing log file.
Oct 01 17:00:43 KODI-UBUNTU x11docker[2346]:   Type 'x11docker --help' for usage information
Oct 01 17:00:43 KODI-UBUNTU x11docker[2346]:   Debug options: '--verbose' (full log) or '--debug' (log excerpt).
Oct 01 17:00:43 KODI-UBUNTU x11docker[2346]:   Logfile will be: /root/.cache/x11docker/x11docker.log
Oct 01 17:00:43 KODI-UBUNTU x11docker[2346]:   Please report issues at https://github.com/mviereck/x11docker
Oct 01 17:00:57 KODI-UBUNTU x11docker[2346]: Connection failure: Connection refused
Oct 01 17:00:57 KODI-UBUNTU x11docker[2346]: pa_context_connect() failed: Connection refused`


@ukrolelo
Copy link

ukrolelo commented Oct 4, 2021

Hi RobertusIT :),
My suggestion is to do what it's says:
Goto https://github.com/mviereck/x11docker
Make a new issue and provide Logfile /root/.cache/x11docker/x11docker.log
Check if there are some private information that you don't want to disclose.
As there are only 6 issues, i would think that your problem will be resolved prety fast.

@ukrolelo
Copy link

ukrolelo commented Oct 4, 2021

Yeah and don't forge to run with
Debug options: '--verbose' (full log) or '--debug' (log excerpt).

@RobertusIT
Copy link

``> Hi RobertusIT :), My suggestion is to do what it's says: Goto https://github.com/mviereck/x11docker Make a new issue and provide Logfile /root/.cache/x11docker/x11docker.log Check if there are some private information that you don't want to disclose. As there are only 6 issues, i would think that your problem will be resolved prety fast.

I didn't have any logs

drwxr-xr-x 2 root root 4096 Oct  5 07:35 .
drwx------ 3 root root 4096 Oct  5 07:30 ..
-rw-r--r-- 1 root root    0 Oct  5 07:30 displaynumbers.21_10_05
-rw-r--r-- 1 root root    0 Oct  5 07:32 docker.imagelist
-rw-r--r-- 1 root root    0 Oct  5 07:32 x11docker.log

I have tried to launch verbose and debug flag, but no way

root@KODI:~/.cache/x11docker# systemctl status kodi
* kodi.service - Dockerized Kodi
   Loaded: loaded (/etc/systemd/system/kodi.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2021-10-05 07:32:43 UTC; 3min 40s ago
  Process: 589 ExecStart=/usr/bin/x11docker --xorg --pulseaudio erichough/kodi (code=exited, status=64)
 Main PID: 589 (code=exited, status=64)

Oct 05 07:32:42 KODI x11docker[589]:     To run from TTY or within Wayland, install:
Oct 05 07:32:42 KODI x11docker[589]:       weston and Xwayland
Oct 05 07:32:42 KODI x11docker[589]:   You can look for the package name of this command at:
Oct 05 07:32:42 KODI x11docker[589]:  https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
Oct 05 07:32:42 KODI x11docker[589]:   Type 'x11docker --help' for usage information
Oct 05 07:32:42 KODI x11docker[589]:   Debug options: '--verbose' (full log) or '--debug' (log excerpt).
Oct 05 07:32:42 KODI x11docker[589]:   Logfile will be: /root/.cache/x11docker/x11docker.log
Oct 05 07:32:42 KODI x11docker[589]:   Please report issues at https://github.com/mviereck/x11docker
Oct 05 07:32:43 KODI systemd[1]: kodi.service: Main process exited, code=exited, status=64/n/a
Oct 05 07:32:43 KODI systemd[1]: kodi.service: Failed with result 'exit-code'.
root@KODI:~/.cache/x11docker# ls -la
total 8
drwxr-xr-x 2 root root 4096 Oct  5 07:35 .
drwx------ 3 root root 4096 Oct  5 07:30 ..
-rw-r--r-- 1 root root    0 Oct  5 07:30 displaynumbers.21_10_05
-rw-r--r-- 1 root root    0 Oct  5 07:32 docker.imagelist
-rw-r--r-- 1 root root    0 Oct  5 07:32 x11docker.log
root@KODI:~/.cache/x11docker# /usr/bin/x11docker --install
x11docker WARNING: Running as user root.
  Maybe $(logname) did not provide an unprivileged user.
  Please use option --hostuser=USER to specify an unprivileged user.
  Otherwise, new X server runs as root, and container user will be root.

x11docker WARNING: User root is member of group docker.
  That allows unprivileged processes on host to gain root privileges.


x11docker ERROR: File x11docker not found in current folder.
  Try 'x11docker --update' instead.

  Type 'x11docker --help' for usage information
  Debug options: '--verbose' (full log) or '--debug' (log excerpt).
  Logfile will be: /root/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

root@KODI:~/.cache/x11docker# systemctl status kodi
* kodi.service - Dockerized Kodi
   Loaded: loaded (/etc/systemd/system/kodi.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2021-10-05 07:32:43 UTC; 5min ago
  Process: 589 ExecStart=/usr/bin/x11docker --xorg --pulseaudio erichough/kodi (code=exited, status=64)
 Main PID: 589 (code=exited, status=64)

Oct 05 07:32:42 KODI x11docker[589]:     To run from TTY or within Wayland, install:
Oct 05 07:32:42 KODI x11docker[589]:       weston and Xwayland
Oct 05 07:32:42 KODI x11docker[589]:   You can look for the package name of this command at:
Oct 05 07:32:42 KODI x11docker[589]:  https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
Oct 05 07:32:42 KODI x11docker[589]:   Type 'x11docker --help' for usage information
Oct 05 07:32:42 KODI x11docker[589]:   Debug options: '--verbose' (full log) or '--debug' (log excerpt).
Oct 05 07:32:42 KODI x11docker[589]:   Logfile will be: /root/.cache/x11docker/x11docker.log
Oct 05 07:32:42 KODI x11docker[589]:   Please report issues at https://github.com/mviereck/x11docker
Oct 05 07:32:43 KODI systemd[1]: kodi.service: Main process exited, code=exited, status=64/n/a
Oct 05 07:32:43 KODI systemd[1]: kodi.service: Failed with result 'exit-code'.
root@KODI:~/.cache/x11docker# x11docker --verbose
root@KODI:~/.cache/x11docker# systemctl status kodi
* kodi.service - Dockerized Kodi
   Loaded: loaded (/etc/systemd/system/kodi.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2021-10-05 07:32:43 UTC; 6min ago
  Process: 589 ExecStart=/usr/bin/x11docker --xorg --pulseaudio erichough/kodi (code=exited, status=64)
 Main PID: 589 (code=exited, status=64)

Oct 05 07:32:42 KODI x11docker[589]:     To run from TTY or within Wayland, install:
Oct 05 07:32:42 KODI x11docker[589]:       weston and Xwayland
Oct 05 07:32:42 KODI x11docker[589]:   You can look for the package name of this command at:
Oct 05 07:32:42 KODI x11docker[589]:  https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
Oct 05 07:32:42 KODI x11docker[589]:   Type 'x11docker --help' for usage information
Oct 05 07:32:42 KODI x11docker[589]:   Debug options: '--verbose' (full log) or '--debug' (log excerpt).
Oct 05 07:32:42 KODI x11docker[589]:   Logfile will be: /root/.cache/x11docker/x11docker.log
Oct 05 07:32:42 KODI x11docker[589]:   Please report issues at https://github.com/mviereck/x11docker
Oct 05 07:32:43 KODI systemd[1]: kodi.service: Main process exited, code=exited, status=64/n/a
Oct 05 07:32:43 KODI systemd[1]: kodi.service: Failed with result 'exit-code'.
root@KODI:~/.cache/x11docker# ls -la
total 8
drwxr-xr-x 2 root root 4096 Oct  5 07:38 .
drwx------ 3 root root 4096 Oct  5 07:30 ..
-rw-r--r-- 1 root root    0 Oct  5 07:30 displaynumbers.21_10_05
-rw-r--r-- 1 root root    0 Oct  5 07:38 docker.imagelist
-rw-r--r-- 1 root root    0 Oct  5 07:38 x11docker.log
root@KODI:~/.cache/x11docker# x11docker --debug  
DEBUGNOTE[07:39:10,316]: check_host(): ps can watch root processes: yes
DEBUGNOTE[07:39:10,340]: host user: root 0:0 /root
x11docker WARNING: Running as user root.
  Maybe $(logname) did not provide an unprivileged user.
  Please use option --hostuser=USER to specify an unprivileged user.
  Otherwise, new X server runs as root, and container user will be root.

x11docker WARNING: User root is member of group docker.
  That allows unprivileged processes on host to gain root privileges.

DEBUGNOTE[07:39:10,524]: storeinfo(): cache=/root/.cache/x11docker/xonly-19550249056
DEBUGNOTE[07:39:10,530]: storeinfo(): stdout=/root/.cache/x11docker/xonly-19550249056/share/stdout
DEBUGNOTE[07:39:10,538]: storeinfo(): stderr=/root/.cache/x11docker/xonly-19550249056/share/stderr
DEBUGNOTE[07:39:10,556]: storeinfo(): x11dockerpid=2156
DEBUGNOTE[07:39:10,601]: 
x11docker version: 6.9.0
Backend version:   Docker version 20.10.7, build 20.10.7-0ubuntu1~18.04.2
Host system:       "Ubuntu 18.04.1 LTS"
Host architecture: amd64 (x86_64)
Command:           '/usr/bin/x11docker' '--debug' 
Parsed options:     --debug --
DEBUGNOTE[07:39:10,608]: --xorg: Xorg not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,613]: Dependency check for --xorg: 1
DEBUGNOTE[07:39:10,619]: --weston-xwayland: weston not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,630]: --weston-xwayland: Xwayland not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,634]: Dependency check for --weston-xwayland: 1
DEBUGNOTE[07:39:10,638]: --kwin-xwayland: kwin_wayland not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,641]: --kwin-xwayland: Xwayland not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,645]: Dependency check for --kwin-xwayland: 1
DEBUGNOTE[07:39:10,649]: --xephyr: Neither Xephyr nor Xnest found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,654]: --xephyr needs a running X server. DISPLAY is empty.
DEBUGNOTE[07:39:10,658]: Dependency check for --xephyr: 1
DEBUGNOTE[07:39:10,661]: --kwin-xwayland: kwin_wayland not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,665]: --kwin-xwayland: Xwayland not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,668]: Dependency check for --kwin-xwayland: 1
DEBUGNOTE[07:39:10,672]: --hostdisplay needs a running X server. DISPLAY is empty.
DEBUGNOTE[07:39:10,677]: Dependency check for --hostdisplay: 1
DEBUGNOTE[07:39:10,680]: --runx: runx is available on MS Windows only.
DEBUGNOTE[07:39:10,684]: --runx: runx not found. 
  Need runx from https://github.com/mviereck/runx
DEBUGNOTE[07:39:10,691]: Dependency check for --runx: 1
DEBUGNOTE[07:39:10,699]: --xwin: XWin is available in Cygwin on MS Windows only.
DEBUGNOTE[07:39:10,702]: Dependency check for --xwin: 1
DEBUGNOTE[07:39:10,706]: --nxagent: nxagent not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,711]: --nxagent needs a running X server. DISPLAY is empty.
DEBUGNOTE[07:39:10,717]: Dependency check for --nxagent: 1
DEBUGNOTE[07:39:10,721]: --weston-xwayland: weston not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,724]: --weston-xwayland: Xwayland not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,727]: Dependency check for --weston-xwayland: 1
DEBUGNOTE[07:39:10,732]: --xpra: xpra not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,737]: --xpra needs a running X server. DISPLAY is empty. Wayland support is experimental option.
DEBUGNOTE[07:39:10,741]: Dependency check for --xpra: 1
DEBUGNOTE[07:39:10,745]: --kwin-xwayland: kwin_wayland not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,753]: --kwin-xwayland: Xwayland not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,757]: Dependency check for --kwin-xwayland: 1
DEBUGNOTE[07:39:10,761]: --weston-xwayland: weston not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,764]: --weston-xwayland: Xwayland not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,768]: Dependency check for --weston-xwayland: 1
DEBUGNOTE[07:39:10,771]: --xorg: Xorg not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,775]: Dependency check for --xorg: 1
DEBUGNOTE[07:39:10,781]: --xephyr: Neither Xephyr nor Xnest found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,785]: --xephyr needs a running X server. DISPLAY is empty.
DEBUGNOTE[07:39:10,789]: Dependency check for --xephyr: 1
DEBUGNOTE[07:39:10,794]: --xorg: Xorg not found.
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages
DEBUGNOTE[07:39:10,797]: Dependency check for --xorg: 1

x11docker ERROR: Did not find a possibility to provide a display.
  Recommendations:
    To run within an already running X server, install one or all of:
      Xephyr xpra nxagent
    To run with GPU acceleration, install:
      weston and Xwayland, optionally also: xpra and xdotool
    To run from TTY or within Wayland, install:
      weston and Xwayland
  You can look for the package name of this command at: 
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages

  Type 'x11docker --help' for usage information
  Debug options: '--verbose' (full log) or '--debug' (log excerpt).
  Logfile will be: /root/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

DEBUGNOTE[07:39:10,805]: time to say goodbye (error)
DEBUGNOTE[07:39:10,810]: traperror: Command at Line 471 returned with error code 1:
  [ -e "$Timetosaygoodbyefifo" ]
  2738 - ::error::check_xserver::main::main
DEBUGNOTE[07:39:10,814]: storeinfo(): error=64
DEBUGNOTE[07:39:10,825]: time to say goodbye (traperror)
DEBUGNOTE[07:39:10,834]: storeinfo(): error=64
DEBUGNOTE[07:39:10,849]: Terminating x11docker.
DEBUGNOTE[07:39:10,853]: time to say goodbye (finish)
DEBUGNOTE[07:39:10,857]: traperror: Command at Line 550 returned with error code 1:
  [ -e "$Timetosaygoodbyefifo" ]
  478 - ::finish::error::check_xserver::main::main
DEBUGNOTE[07:39:10,861]: storeinfo(): error=64
DEBUGNOTE[07:39:10,871]: time to say goodbye (traperror)
DEBUGNOTE[07:39:10,884]: x11docker exit code: 64
root@KODI:~/.cache/x11docker# ls -la
total 8
drwxr-xr-x 2 root root 4096 Oct  5 07:39 .
drwx------ 3 root root 4096 Oct  5 07:30 ..
-rw-r--r-- 1 root root    0 Oct  5 07:30 displaynumbers.21_10_05
-rw-r--r-- 1 root root    0 Oct  5 07:39 docker.imagelist
-rw-r--r-- 1 root root    0 Oct  5 07:39 x11docker.log
root@KODI:~/.cache/x11docker# 

@RobertusIT
Copy link

I also tried to install:

apt-get install xpra
apt-get install nxagent
apt install xserver-xephyr
apt-get install weston

This one is the kodi status

root@KODI:~# systemctl status kodi
● kodi.service - Dockerized Kodi
   Loaded: loaded (/etc/systemd/system/kodi.service; enabled; vendor preset: ena
   Active: failed (Result: exit-code) since Tue 2021-10-05 08:15:39 UTC; 38s ago
  Process: 605 ExecStart=/usr/bin/x11docker --xorg --pulseaudio erichough/kodi (
 Main PID: 605 (code=exited, status=64)
    Tasks: 0 (limit: 18974)
   CGroup: /system.slice/kodi.service

Oct 05 08:15:39 KODI x11docker[605]:     ;;
Oct 05 08:15:39 KODI x11docker[605]: esac; [ "$Pulseaudiomode" = "tcp" ] && star
Oct 05 08:15:39 KODI x11docker[605]: $(pstree -cp $Pid1pid 2>&1 ||:)"; debugnote
Oct 05 08:15:39 KODI x11docker[605]: $(pstree -p $$ 2>&1 ||:)
Oct 05 08:15:39 KODI x11docker[605]:   $(storepid test dockerstopshell && echo "
Oct 05 08:15:39 KODI x11docker[605]:     $(pstree -p $(storepid dump dockerstops
Oct 05 08:15:39 KODI x11docker[605]: $(cat $Storeinfofile)"; debugnote "storepid
Oct 05 08:15:39 KODI x11docker[605]: $(cat $Storepidfile)"; [ "$Showinfofile" =
Oct 05 08:15:39 KODI systemd[1]: kodi.service: Main process exited, code=exited,
Oct 05 08:15:39 KODI systemd[1]: kodi.service: Failed with result 'exit-code'.
lines 1-18/18 (END)...skipping...
● kodi.service - Dockerized Kodi
   Loaded: loaded (/etc/systemd/system/kodi.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2021-10-05 08:15:39 UTC; 38s ago
  Process: 605 ExecStart=/usr/bin/x11docker --xorg --pulseaudio erichough/kodi (code=exited, status=64)
 Main PID: 605 (code=exited, status=64)
    Tasks: 0 (limit: 18974)
   CGroup: /system.slice/kodi.service

Oct 05 08:15:39 KODI x11docker[605]:     ;;
Oct 05 08:15:39 KODI x11docker[605]: esac; [ "$Pulseaudiomode" = "tcp" ] && start_pulseaudiotcp; checkpid "$Pid1pid" && debugnote "Process tree of ${Hostexe:-container}: (maybe not complete yet)
Oct 05 08:15:39 KODI x11docker[605]: $(pstree -cp $Pid1pid 2>&1 ||:)"; debugnote "Process tree of x11docker:
Oct 05 08:15:39 KODI x11docker[605]: $(pstree -p $$ 2>&1 ||:)
Oct 05 08:15:39 KODI x11docker[605]:   $(storepid test dockerstopshell && echo "Lost child of dockerrc (dockerstopshell):
Oct 05 08:15:39 KODI x11docker[605]:     $(pstree -p $(storepid dump dockerstopshell) 2>&1 ||:)")"; debugnote "storeinfo(): Stored info:
Oct 05 08:15:39 KODI x11docker[605]: $(cat $Storeinfofile)"; debugnote "storepid(): Stored pids:
Oct 05 08:15:39 KODI x11docker[605]: $(cat $Storepidfile)"; [ "$Showinfofile" = "yes" ] && echo "$Storeinfofile"; [ "$Showcache" = "yes" ] && echo "$Cachefolder"; [ "$Showdisplayenvironment" = "yes" ] && echo "$(storeinfo dump Xenv)"; [ "$Showcontainerid" = "yes" ] && echo "$(storeinfo dump containerid)"; [ "$Showcontainerpid1pid" = "yes" ] && echo "$Pid1pid"; storeinfo "x11docke
Oct 05 08:15:39 KODI systemd[1]: kodi.service: Main process exited, code=exited, status=64/n/a
Oct 05 08:15:39 KODI systemd[1]: kodi.service: Failed with result 'exit-code'.

And now i have this log:

root@KODI:~/.cache/x11docker# cat x11docker.log
==> /root/.cache/x11docker/erichough-kodi-21737990640/share/stderr <==

==> /root/.cache/x11docker/erichough-kodi-21737990640/share/stdout <==

==> /root/.cache/x11docker/erichough-kodi-21737990640/share/container.log <==

==> /root/.cache/x11docker/erichough-kodi-21737990640/message.log <==

DEBUGNOTE[08:15:38,046]: check_host(): Command tty failed. Guess if running on console: yes
DEBUGNOTE[08:15:38,055]: check_host(): ps can watch root processes: yes
x11docker[08:15:38,061]: Image name: erichough/kodi
  Container command:

x11docker note: Your terminal seems to be not POSIX compliant.
  Command 'logname' does not return a value.
  Consider to use another terminal emulator.
  Fallback: Will try to check $SUDO_USER and $PKEXEC_UID.

x11docker note: Will use $(id -un) = root as host user.

DEBUGNOTE[08:15:38,080]: host user: root 0:0 /root
x11docker WARNING: Running as user root.
  Maybe $(logname) did not provide an unprivileged user.
  Please use option --hostuser=USER to specify an unprivileged user.
  Otherwise, new X server runs as root, and container user will be root.

DEBUGNOTE[08:15:38,242]: storeinfo(): cache=/root/.cache/x11docker/erichough-kodi-21737990640
DEBUGNOTE[08:15:38,246]: storeinfo(): stdout=/root/.cache/x11docker/erichough-kodi-21737990640/share/stdout
DEBUGNOTE[08:15:38,251]: storeinfo(): stderr=/root/.cache/x11docker/erichough-kodi-21737990640/share/stderr
DEBUGNOTE[08:15:38,264]: storeinfo(): x11dockerpid=605
DEBUGNOTE[08:15:38,324]:
x11docker version: 6.9.0
Backend version:   Docker version 20.10.7, build 20.10.7-0ubuntu1~18.04.2
Host system:       "Ubuntu 18.04.1 LTS"
Host architecture: amd64 (x86_64)
Command:           '/usr/bin/x11docker' '--xorg' '--pulseaudio' 'erichough/kodi'
Parsed options:     --xorg --pulseaudio '' -- 'erichough/kodi'
DEBUGNOTE[08:15:38,327]: Dependency check for --xorg: 0
DEBUGNOTE[08:15:38,330]: Dependencies of --xorg already checked: 0
DEBUGNOTE[08:15:38,331]: Dependencies of --xorg already checked: 0
DEBUGNOTE[08:15:38,333]: storeinfo(): xserver=--xorg
x11docker note: Option --pulseaudio: pactl not found.
  Is pulseaudio installed and running on your host system?
  Fallback: Disabling --pulseaudio, enabling option --alsa

x11docker WARNING: x11docker will run Xorg as root.

x11docker note: Option --user=root: Enabling option --sudouser.

DEBUGNOTE[08:15:38,351]: container user: root 0:0 /root

==> /root/.cache/x11docker/erichough-kodi-21737990640/xinit.log <==

==> /root/.cache/x11docker/erichough-kodi-21737990640/share/stderr <==

==> /root/.cache/x11docker/erichough-kodi-21737990640/share/stdout <==

==> /root/.cache/x11docker/erichough-kodi-21737990640/share/container.log <==

==> /root/.cache/x11docker/erichough-kodi-21737990640/message.log <==

DEBUGNOTE[08:15:38,046]: check_host(): Command tty failed. Guess if running on console: yes
DEBUGNOTE[08:15:38,055]: check_host(): ps can watch root processes: yes
x11docker[08:15:38,061]: Image name: erichough/kodi
  Container command:

x11docker note: Your terminal seems to be not POSIX compliant.
  Command 'logname' does not return a value.
  Consider to use another terminal emulator.
  Fallback: Will try to check $SUDO_USER and $PKEXEC_UID.

x11docker note: Will use $(id -un) = root as host user.

DEBUGNOTE[08:15:38,080]: host user: root 0:0 /root
x11docker WARNING: Running as user root.
  Maybe $(logname) did not provide an unprivileged user.
  Please use option --hostuser=USER to specify an unprivileged user.
  Otherwise, new X server runs as root, and container user will be root.

DEBUGNOTE[08:15:38,242]: storeinfo(): cache=/root/.cache/x11docker/erichough-kodi-21737990640
DEBUGNOTE[08:15:38,246]: storeinfo(): stdout=/root/.cache/x11docker/erichough-kodi-21737990640/share/stdout
DEBUGNOTE[08:15:38,251]: storeinfo(): stderr=/root/.cache/x11docker/erichough-kodi-21737990640/share/stderr
DEBUGNOTE[08:15:38,264]: storeinfo(): x11dockerpid=605
DEBUGNOTE[08:15:38,324]:
x11docker version: 6.9.0
Backend version:   Docker version 20.10.7, build 20.10.7-0ubuntu1~18.04.2
Host system:       "Ubuntu 18.04.1 LTS"
Host architecture: amd64 (x86_64)
Command:           '/usr/bin/x11docker' '--xorg' '--pulseaudio' 'erichough/kodi'
Parsed options:     --xorg --pulseaudio '' -- 'erichough/kodi'
DEBUGNOTE[08:15:38,327]: Dependency check for --xorg: 0
DEBUGNOTE[08:15:38,330]: Dependencies of --xorg already checked: 0
DEBUGNOTE[08:15:38,331]: Dependencies of --xorg already checked: 0
DEBUGNOTE[08:15:38,333]: storeinfo(): xserver=--xorg
x11docker note: Option --pulseaudio: pactl not found.
  Is pulseaudio installed and running on your host system?
  Fallback: Disabling --pulseaudio, enabling option --alsa

x11docker WARNING: x11docker will run Xorg as root.

x11docker note: Option --user=root: Enabling option --sudouser.

DEBUGNOTE[08:15:38,351]: container user: root 0:0 /root

==> /root/.cache/x11docker/erichough-kodi-21737990640/xinit.log <==

==> /root/.cache/x11docker/erichough-kodi-21737990640/message.log <==
DEBUGNOTE[08:15:38,373]: waitforlogentry(): tailstderr: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[08:15:38,372]: waitforlogentry(): tailstdout: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[08:15:38,384]: storepid(): Stored pid '1062' of 'watchpidlist':    1062 ?        00:00:00 bash
DEBUGNOTE[08:15:38,390]: storepid(): Stored pid '1075' of 'watchmessagefifo':    1075 ?        00:00:00 bash
x11docker[08:15:38,400]: Virtual screen size:

x11docker[08:15:38,405]: Physical screen size:


x11docker[08:15:38,412]: Detected host window manager: WM_NOT_FOUND

x11docker WARNING: ALSA sound with option --alsa degrades container isolation.
  Shares device files in /dev/snd, container gains access to sound hardware.
  Container applications can catch audio output and microphone input.

x11docker WARNING: Option --alsa: /dev/snd not found.
  Sound support not possible.

DEBUGNOTE[08:15:38,424]: check_vt(): TTYs currently known to kernel:    1  2  3  4  5  6
x11docker note: New Xorg server  will run on tty 8.
  Access it with [CTRL][ALT][F8].

x11docker WARNING: On debian 9, switching often between multiple X servers can
  cause a crash of one X server. This bug may be debian specific and is probably
  some sort of race condition. If you know more about this or it occurs on
  other systems, too, please report at https://github.com/mviereck/x11docker.

  You can avoid this issue with switching to a black tty before switching to X.

DEBUGNOTE[08:15:38,439]: storeinfo(): DISPLAY=:103
DEBUGNOTE[08:15:38,443]: storeinfo(): XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client
DEBUGNOTE[08:15:38,448]: storeinfo(): XSOCKET=/tmp/.X11-unix/X103
DEBUGNOTE[08:15:38,453]: storeinfo(): Xenv= DISPLAY=:103 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X103
DEBUGNOTE[08:15:38,468]: X server command:
  /usr/bin/Xorg :103 vt8  \
  -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 -tst \
  -dpms \
  -s off \
  -auth /root/.cache/x11docker/erichough-kodi-21737990640/Xauthority.server \
  -nolisten tcp \
  -verbose \
  -keeptty \

x11docker[08:15:38,522]: --init: Found tini binary: /usr/bin/docker-init

DEBUGNOTE[08:15:38,524]: storeinfo(): tini=/usr/bin/docker-init
DEBUGNOTE[08:15:38,531]: Users and terminal:
  x11docker was started by:                       root
  As host user serves (running X, storing cache): root
  Container user will be:                         root
  Container user password:                        x11docker
  Getting permission to run backend with:         eval
  Terminal for password frontend:                 bash -c
  Running in a terminal:                          no
  Running on console:                             yes
  Running over SSH:                               no
  Running sourced:                                no
  bash $-:                                        hB
x11docker WARNING: Option --sudouser severly reduces container security.
  Container gains additional capabilities to allow sudo and su.
  If an application breaks out of container, it can harm your system
  in many ways without you noticing. Default password: x11docker

x11docker note: Option --sudouser: Enabling option --newprivileges=yes.
  You can avoid this with --newprivileges=no

x11docker WARNING: Option --newprivileges=yes: x11docker does not set
  docker run option --security-opt=no-new-privileges.
  That degrades container security.
  However, this is still within a default docker setup.

DEBUGNOTE[08:15:38,533]: storeinfo(): containername=x11docker_X103_erichough-kodi_21737990640
DEBUGNOTE[08:15:38,725]: docker command:
  docker run --detach --tty \
  --name x11docker_X103_erichough-kodi_21737990640 \
  --user 0:0 \
  --userns=host \
  --cap-drop ALL \
  --cap-add AUDIT_WRITE \
  --cap-add CHOWN \
  --cap-add DAC_OVERRIDE \
  --cap-add FOWNER \
  --cap-add FSETID \
  --cap-add KILL \
  --cap-add SETGID \
  --cap-add SETPCAP \
  --cap-add SETUID \
  --security-opt label=type:container_runtime_t \
  --volume '/usr/bin/docker-init':'/usr/local/bin/init':ro \
  --tmpfs /run:exec --tmpfs /run/lock \
  --volume '/root/.cache/x11docker/erichough-kodi-21737990640/share':'/x11docker':rw \
  --volume '/tmp/.X11-unix/X103':'/X103':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xauthority.client' \
  --env 'DISPLAY=:103' \
  --env 'USER=root' \
  -- erichough/kodi /usr/local/bin/init -- /bin/sh - /x11docker/containerrc
x11docker[08:15:38,869]: 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="erichough/kodi"
   156  Messagefile='/root/.cache/x11docker/erichough-kodi-21737990640/share/message.fifo'
   157  Newxenv=' DISPLAY=:103 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X103'
   158  export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games'
   159  Storeinfofile='/root/.cache/x11docker/erichough-kodi-21737990640/share/store.info'
   160  Storepidfile='/root/.cache/x11docker/erichough-kodi-21737990640/store.pids'
   161  Timetosaygoodbyefile='/root/.cache/x11docker/erichough-kodi-21737990640/share/timetosaygoodbye'
   162  Timetosaygoodbyefifo='/root/.cache/x11docker/erichough-kodi-21737990640/share/timetosaygoodbye.fifo'
   163  Xserver='--xorg'
   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
   186
   187  # Check whether docker daemon is running, get docker info
   188  docker info >>/root/.cache/x11docker/erichough-kodi-21737990640/docker.info 2>>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log  || {
   189    error "'docker info' failed.
   190    If using docker: Is docker daemon running at all?
   191    Try to start docker daemon with 'systemctl start docker'.
   192    Last lines of log:
   193  $(rmcr < '/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log' | tail)"
   194  }
   195
   196  # Check default runtime
   197  Runtime="$( { grep 'Default Runtime' < '/root/.cache/x11docker/erichough-kodi-21737990640/docker.info' ||: ;} | awk '{print $3}' )"
   198  [ -n "$Runtime" ] && {
   199    debugnote "dockerrc: Found default container Runtime: $Runtime"
   200    debugnote "dockerrc: All $(grep 'Runtimes' < '/root/.cache/x11docker/erichough-kodi-21737990640/docker.info' ||: )"
   201    [ "$Runtime" != '' ] && {
   202      case $Runtime in
   203        kata-runtime)  warning 'Found default container runtime kata-runtime.
   204    Please run x11docker with --runtime=kata-runtime to avoid issues.' ;;
   205        nvidia) [ 'no' = 'yes' ] &&  warning 'Option --gpu: Found default container runtime nvidia.
   206    Please run x11docker with --runtime=nvidia to avoid issues.' ;;
   207        runc|crun|oci) ;;
   208        *) note "Found unknown container runtime: $Runtime
   209    Please report at:  https://github.com/mviereck/x11docker" ;;
   210      esac
   211    }
   212  }
   213  Runtime='UNDECLARED_RUNTIME'
   214  debugnote "dockerrc: Container Runtime: $Runtime"
   215  storeinfo "runtime=$Runtime"
   216
   217  # Refresh images.list for x11docker-gui
   218  docker images 2>>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log | grep -v REPOSITORY | awk '{print $1 ":" $2}' >>/root/.cache/x11docker/docker.imagelist.sort
   219  rmcr /root/.cache/x11docker/docker.imagelist.sort
   220  while read -r Line ; do
   221    grep -q "<none>" <<<$Line || echo $Line >> /root/.cache/x11docker/docker.imagelist
   222  done < <(sort < /root/.cache/x11docker/docker.imagelist.sort)
   223  rm /root/.cache/x11docker/docker.imagelist.sort
   224
   225  # Check if image erichough/kodi is available locally
   226  Imagepull=no
   227
   228  rocknroll || exit 64
   229
   230  [ "$Imagepull" = 'yes' ] && {
   231    note "Pulling image 'erichough/kodi' from docker hub"
   232    env DISPLAY='' DBUS_SESSION_BUS_ADDRESS='' bash           -c "notify-send 'x11docker: Pulling image erichough/kodi'" 2>/dev/null &
   233     docker pull erichough/kodi 1>&2 || error "Pulling image 'erichough/kodi' seems to have failed!"
   234  }
   235
   236  rocknroll || exit 64
   237
   238  Inspect="$(docker inspect erichough/kodi --format='{{.Config.User}}|{{.Config.WorkingDir}}|{{.Architecture}}')"
   239
   240  # Check architecture
   241  Containerarchitecture="$(cut -d'|' -f3 <<< "$Inspect")"
   242  debugnote "dockerrc: Image architecture: $Containerarchitecture"
   243  # Check CMD
   244  [ -z "$Containercommand" ] && {
   245    # extract image command from image if not given on cli
   246    Containercommand="$(docker inspect erichough/kodi --format='{{.Config.Cmd}}')"
   247    Containercommand="${Containercommand#[}"
   248    Containercommand="${Containercommand%]}"
   249    debugnote "dockerrc: Image CMD: $Containercommand"
   250    echo "$Containercommand" | grep -q /x11docker/containerrc && error 'Recursion error: Found CMD /x11docker/containerrc in image.
   251        Did you use 'docker commit' with an x11docker container?
   252        Please build new images with a Dockerfile instead of using docker commit,
   253        or provide a different container command.'
   254  }
   255
   256  # Check USER
   257  Imageuser="$(cut -d'|' -f1 <<< "$Inspect")"
   258  debugnote "dockerrc: Image USER: $Imageuser"
   259  [ "$Imageuser" ] && note "Found 'USER $Imageuser' in image.
   260    If you want to run with user $Imageuser instead of host user root,
   261    than run with --user=RETAIN."
   262  storeinfo containeruser="root"
   263
   264  # Check ENTRYPOINT
   265  Entrypoint="$(docker inspect erichough/kodi --format='{{.Config.Entrypoint}}')"
   266  Entrypoint="${Entrypoint#[}"
   267  Entrypoint="${Entrypoint%]}"
   268  debugnote "dockerrc: Image ENTRYPOINT: $Entrypoint"
   269  echo "$Entrypoint" | grep -qE 'tini|init|systemd' && {
   270    note "There seems to be an init system in ENTRYPOINT of image:
   271          $Entrypoint
   272        Will disable it as x11docker already runs an init with option --tini.
   273        To allow this ENTRYPOINT, run x11docker with option --init=none."
   274    Entrypoint=
   275  }
   276
   277  # Check WORKDIR
   278  Workdir="$(cut -d'|' -f2 <<< "$Inspect")"
   279  debugnote "dockerrc: Image WORKDIR: $Workdir"
   280  [ "$Workdir" ] && note "Found 'WORKDIR $Workdir' in image.
   281        You can change it with option --workdir=DIR."
   282
   283  [ -z "$Containercommand$Entrypoint" ] && error 'No container command specified and no CMD or ENTRYPOINT found in image.'
   284
   285  ######## Create containerrc ########
   286
   287  { echo '#! /bin/sh'
   288    echo ''
   289    echo '# containerrc'
   290    echo '# Created startscript for docker run used as container command.'
   291    echo '# Runs as unprivileged user in container.'
   292    echo ''
   293    echo 'exec 6>&1 7>&2'
   294    echo 'exec >>/x11docker/container.log 2>&1'
   295    echo ''
   296    echo 'mysleep ()
   297  {
   298      sleep "${1:-1}" 2> /dev/null || sleep 1
   299  }'
   300    echo 'rocknroll ()
   301  {
   302      [ -s "$Timetosaygoodbyefile" ] && return 1;
   303      [ -e "$Timetosaygoodbyefile" ] || return 1;
   304      return 0
   305  }'
   306    echo 'saygoodbye ()
   307  {
   308      debugnote "time to say goodbye ($*)";
   309      [ -e "$Timetosaygoodbyefile" ] && echo timetosaygoodbye >> $Timetosaygoodbyefile;
   310      [ -e "$Timetosaygoodbyefifo" ] && echo timetosaygoodbye >> $Timetosaygoodbyefifo
   311  }'
   312    echo 'storeinfo ()
   313  {
   314      [ -e "$Storeinfofile" ] || return 1;
   315      case "${1:-}" in
   316          dump)
   317              grep "^${2:-}=" $Storeinfofile | sed "s/^${2:-}=//"
   318          ;;
   319          drop)
   320              sed -i "/^${2:-}=/d" $Storeinfofile
   321          ;;
   322          test)
   323              grep -q "^${2:-}=" $Storeinfofile
   324          ;;
   325          *)
   326              debugnote "storeinfo(): ${1:-}";
   327              grep -q "^$(echo "${1:-}" | cut -d= -f1)=" $Storeinfofile && {
   328                  sed -i "/^$(echo "${1:-}" | cut -d= -f1)=/d" $Storeinfofile
   329              };
   330              echo "${1:-}" >> $Storeinfofile
   331          ;;
   332      esac
   333  }'
   334    echo 'waitforlogentry ()
   335  {
   336      local Startzeit Uhrzeit Dauer Count=0 Schlaf;
   337      local Errorkeys="${4:-}";
   338      local Warten="${5:-60}";
   339      local Error=;
   340      Startzeit="$(date +%s ||:)";
   341      Startzeit="${Startzeit:-0}";
   342      [ "$Warten" = "infinity" ] && Warten=32000;
   343      debugnote "waitforlogentry(): ${1:-}: Waiting for logentry \"${3:-}\" in $(basename ${2:-})";
   344      while ! grep -q "${3:-}" < "${2:-}"; do
   345          Count="$(( $Count + 1 ))";
   346          Uhrzeit="$(date +%s ||:)";
   347          Uhrzeit="${Uhrzeit:-0}";
   348          Dauer="$(( $Uhrzeit - $Startzeit ))";
   349          Schlaf="$(( $Count / 10 ))";
   350          [ "$Schlaf" = "0" ] && Schlaf="0.5";
   351          mysleep "$Schlaf";
   352          [ "$Dauer" -gt "10" ] && debugnote "waitforlogentry(): ${1:-}: Waiting since ${Dauer}s for log entry \"${3:-}\" in $(basename ${2:-})";
   353          [ "$Dauer" -gt "$Warten" ] && error "waitforlogentry(): ${1:-}: Timeout waiting for entry \"${3:-}\" in $(basename ${2:-})
   354    Last lines of $(basename ${2:-}):
   355  $(tail "${2:-}")";
   356          [ "$Errorkeys" ] && grep -i -q -E "$Errorkeys" < "${2:-}" && error "waitforlogentry(): ${1:-}: Found error message in logfile.
   357    Last lines of logfile $(basename ${2:-}):
   358  $(tail "${2:-}")";
   359          rocknroll || {
   360              debugnote "waitforlogentry(): ${1:-}: Stopped waiting for ${3:-} in $(basename ${2:-}) due to terminating signal.";
   361              Error=1;
   362              break
   363          };
   364      done;
   365      [ "$Error" ] && return 1;
   366      debugnote "waitforlogentry(): ${1:-}: Found log entry \"${3:-}\" in $(basename ${2:-}).";
   367      return 0
   368  }'
   369    echo '
   370  warning() {
   371    echo "$*:WARNING"   | sed "s/\$/ /" >>$Messagefile
   372  }
   373  note() {
   374    echo "$*:NOTE"      | sed "s/\$/ /" >>$Messagefile
   375  }
   376  verbose() {
   377    echo "$*:VERBOSE"   | sed "s/\$/ /" >>$Messagefile
   378  }
   379  debugnote() {
   380    echo "$*:DEBUGNOTE" | sed "s/\$/ /" >>$Messagefile
   381  }
   382  error() {
   383    echo "$*:ERROR"     | sed "s/\$/ /" >>$Messagefile
   384    exit 64
   385  }
   386  stdout() {
   387    echo "$*:STDOUT"    | sed "s/\$/ /" >>$Messagefile
   388  }'
   389    echo 'Messagefile=/x11docker/message.fifo'
   390    echo 'Storeinfofile=/x11docker/store.info'
   391    echo 'Timetosaygoodbyefile=/x11docker/timetosaygoodbye'
   392    echo ''
   393    echo 'waitforlogentry containerrc $Storeinfofile containerrootrc=ready  infinity'
   394    echo 'debugnote "Running containerrc: Unprivileged user commands in container"'
   395    echo ''
   396    echo "Containercommand=\"$Containercommand\""
   397    echo "Entrypoint=\"$Entrypoint\""
   398    echo ''
   399    echo 'verbose "containerrc: Container system:'
   400    echo '$(cat /etc/os-release 2>&1 ||:)"'
   401    echo ''
   402  } >> /root/.cache/x11docker/erichough-kodi-21737990640/share/containerrc
   403  {
   404    echo ''
   405    echo '# USER and HOME'
   406    echo 'Containeruser="$(storeinfo dump containeruser)"'
   407    echo 'Containeruserhome="/home/root"'
   408    echo 'export USER="$Containeruser"'
   409    echo '[ "$Containeruserhome" ] && {'
   410    echo '  export HOME="$Containeruserhome"'
   411    echo '}'
   412    echo ''
   413    echo '# XDG_RUNTIME_DIR'
   414    echo 'Containeruseruid=$(id -u $Containeruser)'
   415    echo 'export XDG_RUNTIME_DIR=/tmp/XDG_RUNTIME_DIR'
   416    echo '[ -e /run/user/$Containeruseruid ] && ln -s /run/user/$Containeruseruid $XDG_RUNTIME_DIR || mkdir -p -m700 $XDG_RUNTIME_DIR'
   417    echo ''
   418    echo '# Copy files from /etc/skel into empty HOME'
   419    echo '[ -d "$HOME" ] && {'
   420    echo '  [ -d /etc/skel ] && [ -z "$(ls -A "$Containeruserhome" 2>/dev/null | grep -v -E "gnupg")" ] && {'
   421    echo '    debugnote "containerrc: HOME is empty. Copying from /etc/skel"'
   422    echo '    cp -n -R /etc/skel/. $Containeruserhome'
   423    echo '    :'
   424    echo '  } || {'
   425    echo '    debugnote "containerrc: HOME is not empty. Not copying from /etc/skel"'
   426    echo '  }'
   427    echo '}'
   428    echo ''
   429    echo '# Create softlink to X unix socket'
   430    echo '[ -e /tmp/.X11-unix/X103 ] || ln -s /X103 /tmp/.X11-unix'
   431    echo ''
   432    echo 'unset WAYLAND_DISPLAY'
   433    echo ''
   434    echo 'export XDG_SESSION_TYPE=x11'
   435    echo ''
   436    echo ''
   437    echo 'export TERM=xterm'
   438    echo 'storeinfo test locale && export LANG="$(storeinfo dump locale)"'
   439    echo '[ -e "/usr/share/zoneinfo/UTC" ] || export TZ=UTC-00'
   440    echo '[ "$(date -Ihours)" != "2021-10-05T08+00:00" ] && export TZ=UTC-00'
   441    echo '[ "$DEBIAN_FRONTEND" = noninteractive ] && unset DEBIAN_FRONTEND && export DEBIAN_FRONTEND'
   442    echo '[ "$DEBIAN_FRONTEND" = newt ]           && unset DEBIAN_FRONTEND && export DEBIAN_FRONTEND'
   443    echo '# container environment (--env)'
   444    echo "export 'container=docker'"
   445    echo "export 'XAUTHORITY=/x11docker/Xauthority.client'"
   446    echo "export 'DISPLAY=:103'"
   447    echo "export 'USER=root'"
   448    echo ''
   449    echo '[ -d "$HOME" ] && cd "$HOME"'
   450    [ "$Workdir" ] && echo "[ -d \"$Workdir\" ] && cd \"$Workdir\"    # WORKDIR in image"
   451    echo ''
   452    echo ''
   453    echo 'env >> /x11docker/container.environment'
   454    echo 'verbose "Container environment:'
   455    echo '$(env | sort)"'
   456    echo ''
   457    echo 'tail -f /x11docker/stdout     2>/dev/null &'
   458    echo 'tail -f /x11docker/stderr >&2 2>/dev/null &'
   459    echo "exec \$Dbus sh /x11docker/cmdrc >>/x11docker/stdout 2>>/x11docker/stderr"
   460  } >> /root/.cache/x11docker/erichough-kodi-21737990640/share/containerrc
   461  ######## End of containerrc ########
   462
   463  # Write containerrc into x11docker.log
   464  nl -ba >> /root/.cache/x11docker/erichough-kodi-21737990640/share/x11docker.log < /root/.cache/x11docker/erichough-kodi-21737990640/share/containerrc
   465
   466  ######## Create cmdrc ########
   467  { echo '#! /bin/sh'
   468    echo '# Created startscript for cmdrc containing final container command'
   469    echo ''
   470    echo 'storeinfo ()
   471  {
   472      [ -e "$Storeinfofile" ] || return 1;
   473      case "${1:-}" in
   474          dump)
   475              grep "^${2:-}=" $Storeinfofile | sed "s/^${2:-}=//"
   476          ;;
   477          drop)
   478              sed -i "/^${2:-}=/d" $Storeinfofile
   479          ;;
   480          test)
   481              grep -q "^${2:-}=" $Storeinfofile
   482          ;;
   483          *)
   484              debugnote "storeinfo(): ${1:-}";
   485              grep -q "^$(echo "${1:-}" | cut -d= -f1)=" $Storeinfofile && {
   486                  sed -i "/^$(echo "${1:-}" | cut -d= -f1)=/d" $Storeinfofile
   487              };
   488              echo "${1:-}" >> $Storeinfofile
   489          ;;
   490      esac
   491  }'
   492    echo '
   493  warning() {
   494    echo "$*:WARNING"   | sed "s/\$/ /" >>$Messagefile
   495  }
   496  note() {
   497    echo "$*:NOTE"      | sed "s/\$/ /" >>$Messagefile
   498  }
   499  verbose() {
   500    echo "$*:VERBOSE"   | sed "s/\$/ /" >>$Messagefile
   501  }
   502  debugnote() {
   503    echo "$*:DEBUGNOTE" | sed "s/\$/ /" >>$Messagefile
   504  }
   505  error() {
   506    echo "$*:ERROR"     | sed "s/\$/ /" >>$Messagefile
   507    exit 64
   508  }
   509  stdout() {
   510    echo "$*:STDOUT"    | sed "s/\$/ /" >>$Messagefile
   511  }'
   512    echo 'Messagefile=/x11docker/message.fifo'
   513    echo "debugnote \"cmdrc: Running container command:
   514    $Entrypoint $Containercommand
   515    \""
   516    echo ''
   517    echo "$Entrypoint $Containercommand  "
   518    echo ''
   519    echo '[ -h "$Homesoftlink" ] && rm $Homesoftlink'
   520    echo "storeinfo cmdexitcode=\$?"
   521  } >> /root/.cache/x11docker/erichough-kodi-21737990640/share/cmdrc
   522  ######## End of cmdrc ########
   523
   524  # Write cmdrc into x11docker.log
   525  nl -ba >> /root/.cache/x11docker/erichough-kodi-21737990640/share/x11docker.log < /root/.cache/x11docker/erichough-kodi-21737990640/share/cmdrc
   526
   527  # Send signal to run X and wait for X to be ready
   528  storeinfo readyforX=ready
   529  waitforlogentry 'dockerrc' /root/.cache/x11docker/erichough-kodi-21737990640/xinit.log 'xinitrc is ready' 'xinit: giving up|unable to connect to X server|Connection refused|server error|Only console users are allowed'
   530
   531  rocknroll || exit 64
   532
   533  # run window manager (in image or from host)
   534  Windowmanagermode="container"
   535  Windowmanagercommand="x11docker/openbox sh -c 'openbox --sm-disable --config-file /etc/x11docker/openbox-nomenu.rc'"
   536  Wmdockercommand="docker run --detach \
   537    --name x11docker_X103_erichough-kodi_21737990640_WM \
   538    --user 1999:1999 \
   539    --cap-drop=ALL   --security-opt=no-new-privileges   --security-opt label=type:container_runtime_t \
   540    --volume '/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client':'/x11docker/Xauthority.client':rw \
   541    --volume '/tmp/.X11-unix/X103':'/tmp/.X11-unix/X103':rw \
   542    --env 'XAUTHORITY=/x11docker/Xauthority.client' \
   543    --env 'DISPLAY=:103'"
   544  [ "$Windowmanagermode" = "container" ] && {
   545    docker inspect "$(cut -d' ' -f1 <<<"$Windowmanagercommand")" >>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log 2>&1 && {
   546      Wmdockercommand="$Wmdockercommand \
   547    -- $Windowmanagercommand"
   548      debugnote "dockerrc: Window manager container: Generated docker command:
   549  $Wmdockercommand"
   550      note "Option --wm: Starting window manager image: x11docker/openbox sh -c 'openbox --sm-disable --config-file /etc/x11docker/openbox-nomenu.rc'"
   551      Wmcontainerid="$(eval $Wmdockercommand)"
   552      [ "$Wmcontainerid" ] && {
   553        debugnote "dockerrc: Window manager container: $Wmcontainerid"
   554        for ((Count=1 ; Count<=10 ; Count++)); do
   555          Pid1pid="$(docker inspect --format '{{.State.Pid}}' $Wmcontainerid 2>>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log | rmcr)"
   556          debugnote "dockerrc: Window manager container: $Count. check for PID 1: $Pid1pid"
   557          checkpid "$Pid1pid" && break
   558          rocknroll || exit 64
   559          mysleep 0.2
   560        done
   561      }
   562      checkpid "$Pid1pid" && storepid "$Pid1pid" wmcontainerpid1
   563      checkpid "$Pid1pid" || { note "Option --wm: Failed to run window manager image: $Windowmanagercommand." && Windowmanagermode=host ; }
   564    } || {
   565      note "Option --wm: Did not find window manager image
   566        $(cut -d' ' -f1 <<<"$Windowmanagercommand")
   567    to provide a containerized window manager. Please run:
   568        docker pull x11docker/openbox
   569    If you want to use a host window manager instead and avoid this warning,
   570    use option                         --wm=host  or  --wm=COMMAND
   571    or provide a local image with e.g. --wm=x11docker/fvwm
   572    To run without a window manager:   --wm=none  or  --desktop
   573    Fallback: Will try to run a host window manager: WM_NOT_FOUND"
   574      Windowmanagermode=host
   575    }
   576  }
   577  [ "$Windowmanagermode" = "host" ] && {
   578    command -v WM_NOT_FOUND >/dev/null || note 'Did not find a host window manager.
   579    Please pull image x11docker/openbox or provide a recommended one:
   580    xfwm4 metacity marco openbox sawfish'
   581    note 'Option --wm: Starting host window manager: WM_NOT_FOUND'
   582    [ "$(id -u)" = '0' ]  && su root -c 'env  DISPLAY=:103 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X103 WM_NOT_FOUND >>/root/.cache/x11docker/erichough-kodi-21737990640/xinit.log 2>&1 & storepid $! windowmanager' || \
   583                                                 env  DISPLAY=:103 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X103 WM_NOT_FOUND >>/root/.cache/x11docker/erichough-kodi-21737990640/xinit.log 2>&1 & storepid $! windowmanager
   584  }
   585
   586  rocknroll || exit 64
   587
   588
   589  #### run docker image ####
   590  read Containerid < <(docker run --detach --tty \
   591    --name x11docker_X103_erichough-kodi_21737990640 \
   592    --user 0:0 \
   593    --userns=host \
   594    --cap-drop ALL \
   595    --cap-add AUDIT_WRITE \
   596    --cap-add CHOWN \
   597    --cap-add DAC_OVERRIDE \
   598    --cap-add FOWNER \
   599    --cap-add FSETID \
   600    --cap-add KILL \
   601    --cap-add SETGID \
   602    --cap-add SETPCAP \
   603    --cap-add SETUID \
   604    --security-opt label=type:container_runtime_t \
   605    --volume '/usr/bin/docker-init':'/usr/local/bin/init':ro \
   606    --tmpfs /run:exec --tmpfs /run/lock \
   607    --volume '/root/.cache/x11docker/erichough-kodi-21737990640/share':'/x11docker':rw \
   608    --volume '/tmp/.X11-unix/X103':'/X103':rw \
   609    --workdir '/tmp' \
   610    --entrypoint env \
   611    --env 'container=docker' \
   612    --env 'XAUTHORITY=/x11docker/Xauthority.client' \
   613    --env 'DISPLAY=:103' \
   614    --env 'USER=root' \
   615    -- erichough/kodi /usr/local/bin/init -- /bin/sh - /x11docker/containerrc 2>>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log | rmcr)
   616  ##########################
   617
   618
   619  [ "$Containerid" ] || {
   620      error "Startup of docker failed. Did not receive a container ID.
   621
   622    Last lines of container log:
   623  $(rmcr < /root/.cache/x11docker/erichough-kodi-21737990640/share/container.log | tail)"
   624  }
   625  storeinfo containerid="$Containerid"
   626  # Wait for container to be ready
   627  for ((Count=1 ; Count<=40 ; Count++)); do
   628    docker exec x11docker_X103_erichough-kodi_21737990640 sh -c : 2>&1 | rmcr >>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log && { debugnote 'dockerrc: Container is up and running.' ; break ; } || debugnote "dockerrc: Container not ready on $Count. attempt, trying again."
   629    rocknroll || exit 64
   630    mysleep 0.1
   631  done
   632
   633  # Wait for pid 1 in container
   634  for ((Count=1 ; Count<=40 ; Count++)); do
   635    Pid1pid="$(docker inspect --format '{{.State.Pid}}' x11docker_X103_erichough-kodi_21737990640 2>>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log | rmcr)"
   636    debugnote "dockerrc: $Count. check for PID 1: $Pid1pid"
   637    checkpid "$Pid1pid" && break
   638    rocknroll || exit 64
   639    mysleep 0.1
   640  done
   641  [ "$Pid1pid" = "0" ] && Pid1pid=""
   642  [ -z "$Pid1pid" ] && error "dockerrc(): Did not receive PID of PID1 in container.
   643    Maybe the container immediately stopped for unknown reasons.
   644    Just in case, check if host and image architecture are compatible:
   645    Host architecture: amd64 (x86_64), image architecture: $Containerarchitecture.
   646    Output of \"docker ps | grep x11docker\":
   647  $(docker ps | grep x11docker)
   648
   649    Content of container log:
   650  $(rmcr < /root/.cache/x11docker/erichough-kodi-21737990640/share/container.log | uniq )"
   651  storeinfo pid1pid="$Pid1pid"
   652
   653  # Get IP of container
   654  Containerip="$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' x11docker_X103_erichough-kodi_21737990640 2>>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log)"
   655  storeinfo containerip=$Containerip
   656
   657  # Check log for startup failure
   658  Failure="$(rmcr < /root/.cache/x11docker/erichough-kodi-21737990640/share/container.log | grep -v grep | grep -E 'Error response from daemon|OCI runtime exec' ||:)"
   659  [ "$Failure" ] && {
   660    echo "$Failure" >>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log
   661    error "Got error message from docker:
   662  $Failure
   663
   664    Last lines of logfile:
   665  $(tail /root/.cache/x11docker/erichough-kodi-21737990640/share/container.log)"
   666  }
   667
   668  debugnote 'dockerrc(): Starting containerrootrc with docker exec'
   669  # copy containerrootrc inside of container to avoid possible noexec of host home.
   670  docker exec x11docker_X103_erichough-kodi_21737990640 sh -c 'cp /x11docker/containerrootrc /tmp/containerrootrc ; chmod 644 /tmp/containerrootrc' 2>&1 | rmcr >>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log
   671  # run container root setup. containerrc will wait until setup script is ready.
   672  docker exec -u root x11docker_X103_erichough-kodi_21737990640 /bin/sh /tmp/containerrootrc 2>&1 | rmcr >>/root/.cache/x11docker/erichough-kodi-21737990640/share/container.log
   673
   674  storeinfo dockerrc=ready
   675
   676  [ "$Containerid" ] || [ "$Wmcontainerid" ] && {
   677    # wait for signal of finish()
   678    read Signal </root/.cache/x11docker/erichough-kodi-21737990640/dockerrc.stopfifo
   679    [ "$Signal" = "stop" ] && {
   680      [ "$Containerid" ]   && docker stop $Containerid     >> /root/.cache/x11docker/erichough-kodi-21737990640/share/container.log 2>&1 &
   681      [ "$Wmcontainerid" ] && docker stop $Wmcontainerid   >> /root/.cache/x11docker/erichough-kodi-21737990640/share/container.log 2>&1 &
   682      [ "$Dockerlogspid" ] && kill $Dockerlogspid              >> /root/.cache/x11docker/erichough-kodi-21737990640/share/container.log 2>&1 &
   683    }
   684  } & storepid $! dockerstopshell
   685  exit 0

x11docker[08:15:38,944]: 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=:103 XAUTHORITY=/x11docker/Xauthority.client
    88
    89
    90  # Time zone
    91  [ ! -d /usr/share/zoneinfo ] && [ "$Containerlibc" = "glibc" ] && {
    92    mkdir -p /usr/share/zoneinfo
    93    cp '/x11docker/libc.localtime' '/usr/share/zoneinfo/UTC'
    94  }
    95  [ -e '/usr/share/zoneinfo/UTC' ] && ln -f -s '/usr/share/zoneinfo/UTC' /etc/localtime
    96
    97  # Container system
    98  Containersystem="$(grep '^ID=' /etc/os-release 2>/dev/null | cut -d= -f2 || echo 'unknown')"
    99  verbose "Container system ID: $Containersystem"
   100
   101  # Environment variables
   102  export 'container=docker'
   103  export 'XAUTHORITY=/x11docker/Xauthority.client'
   104  export 'DISPLAY=:103'
   105  export 'USER=root'
   106
   107  # Check container user
   108  Containeruser="$(storeinfo dump containeruser)"
   109  Containeruser="${Containeruser:-root}"
   110
   111  Containeruserhome='/home/root'
   112  # Create user entry in /etc/passwd (and delete possibly existing same uid)
   113  cat /etc/passwd | grep -v ':0:' > /tmp/passwd
   114
   115  # Disable possible /etc/shadow passwords for other users
   116  sed -i 's%:x:%:-:%' /tmp/passwd
   117  bash --version >/dev/null 2>&1 && Containerusershell=/bin/bash || Containerusershell=/bin/sh
   118  Containeruserentry="root:x:0:0:root,,,:/home/root:$Containerusershell"
   119  debugnote "containerrootrc: $Containeruserentry"
   120  echo "$Containeruserentry" >> /tmp/passwd
   121
   122  rm /etc/passwd
   123  mv /tmp/passwd /etc/passwd || warning 'Unable to change /etc/passwd. That may be a security risk.'
   124
   125  # Create password entry for container user in /etc/shadow
   126  rm -v /etc/shadow || warning 'Cannot change /etc/shadow. That may be a security risk.'
   127  echo "root:sac19FwGGTx/A:17293:0:99999:7:::" > /etc/shadow
   128  echo 'root:sac19FwGGTx/A:17219:0:99999:7:::' >> /etc/shadow  # with option --sudouser, set root password 'x11docker'
   129  sed -i 's%root:-:%root:x:%' /etc/passwd                               # allow password in /etc/shadow
   130  chmod 640 /etc/shadow   # can fail depending on available capabilities
   131
   132  # Create user group entry (and delete possibly existing same gid)
   133  cat /etc/group | grep -v ':0:'    > /tmp/group
   134  echo "root:x:0:" >> /tmp/group
   135  mv /tmp/group /etc/group
   136
   137  # Create /etc/sudoers, delete /etc/sudoers.d. Overwrite possible sudo setups in image.
   138  [ -e /etc/sudoers.d ] && rm -v -R /etc/sudoers.d
   139  [ -e /etc/sudoers ]   && rm -v /etc/sudoers
   140  echo '# /etc/sudoers created by x11docker' > /etc/sudoers
   141  echo 'Defaults  env_reset'                >> /etc/sudoers
   142  echo 'root ALL=(ALL) ALL'                 >> /etc/sudoers
   143  echo 'root ALL=(ALL) ALL' >> /etc/sudoers
   144
   145  # Set up container user groups
   146  # Create HOME
   147  [ -e "$Containeruserhome" ] || {
   148    mkdir -v -p "$(dirname "$Containeruserhome")"
   149    mkdir -v -m 777 "$Containeruserhome"
   150    chown -v "$Containeruser":"$Containerusergroup" "$Containeruserhome" && chmod -v 755 "$Containeruserhome"  # can fail depending on capabilities
   151  }
   152  ls -la $Containeruserhome
   153
   154  rocknroll || exit 64
   155
   156
   157  # disable getty in inittab
   158  [ -e /etc/inittab ] && sed -i 's/.*getty/##getty disabled by x11docker## \0/' /etc/inittab
   159
   160
   161  rocknroll || exit 64
   162
   163  storeinfo containerrootrc=ready
   164

x11docker[08:15:38,951]: 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='/root/.cache/x11docker/erichough-kodi-21737990640/share/message.fifo'
   111  Output="$(getprimary)"
   112  Storeinfofile='/root/.cache/x11docker/erichough-kodi-21737990640/share/store.info'
   113  Storepidfile='/root/.cache/x11docker/erichough-kodi-21737990640/store.pids'
   114  Timetosaygoodbyefile='/root/.cache/x11docker/erichough-kodi-21737990640/share/timetosaygoodbye'
   115
   116  export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games'
   117
   118  Cookie=''
   119  Line=''
   120  Var=''
   121
   122  debugnote 'Running xinitrc'
   123
   124  export  DISPLAY=:103 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X103
   125  # background color
   126  xsetroot -solid '#7F7F7F' 2>/dev/null
   127
   128  # create new XAUTHORITY cookies
   129  :> /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client
   130
   131  echo 'Requesting trusted cookie from X server'
   132  xauth -v -i -f /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client generate :103 . trusted timeout 3600
   133
   134  [ -s '/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client' ] || {
   135    [ 'trusted' = 'untrusted' ] && note 'Could not create untrusted cookie.
   136    Maybe your X server misses extension SECURITY.'
   137  }
   138  [ -s '/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client' ] || {
   139    # still no cookie? try to create one without extension security
   140    debugnote 'xinitrc: Failed to retrieve trusted cookie from X server. Will bake one myself.'
   141    echo 'Failed to retrieve trusted cookie from X server. Will bake one myself.'
   142    xauth -v -i -f /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client add :103 . d9704788d4c43dd8eaf582df1292b6e1
   143    ls -l /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client
   144  }
   145
   146  # Prepare cookie with localhost identification disabled by ffff, needed if X socket is shared. ffff means 'familiy wild'
   147  Cookie="$(xauth -i -f /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client nlist | sed -e 's/^..../ffff/')"
   148  echo "$Cookie" | xauth -v -i -f /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client nmerge -
   149
   150  debugnote "xinitrc: Created cookie: $(xauth -f /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client list 2>&1)"
   151  ls -l /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client
   152  cp /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client /root/.cache/x11docker/erichough-kodi-21737990640/Xauthority.server
   153  chmod 644 /root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client
   154
   155  [ -s '/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client' ] || warning 'Cookie creation failed!'
   156  export XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client
   157  [ 'yes' = 'no' ] || [ ! -s '/root/.cache/x11docker/erichough-kodi-21737990640/share/Xauthority.client' ] && unset XAUTHORITY && warning '--xorg: X server :103 runs without cookie authentication.'
   158
   159  # clean xhost
   160  verbose 'Disabling any possible access to new X server possibly granted by xhost'
   161  disable_xhost
   162
   163  # Keyboard layout
   164
   165  # determine screen size
   166  [ -n "$(xrandr | grep connected | grep -v disconnected)" ] && {
   167    getscreensize
   168    Xaxis="$CurrentXaxis"
   169    Yaxis="$CurrentYaxis"
   170    Xaxis="${Xaxis%.*}"
   171    Yaxis="${Yaxis%.*}"
   172    Screensize="${Xaxis}x${Yaxis}"
   173
   174    :
   175  } || {
   176    Xaxis=4720
   177    Yaxis=3840
   178    Screensize="${Xaxis}x${Yaxis}"
   179    note "Could not detect any connected monitor.
   180    Running on a server? Will try to set a framebuffer size
   181    with "xrandr --fb $Screensize" that may serve as a virtual display."
   182    xrandr --fb $Screensize
   183  }
   184
   185  verbose "Output of xrandr on :103
   186  $(xrandr)"
   187
   188  echo 'xinitrc: xinitrc is ready'
   189  storeinfo xinitrc=ready
   190
   191  # wait for the end
   192  read Var </root/.cache/x11docker/erichough-kodi-21737990640/share/timetosaygoodbye.fifo

DEBUGNOTE[08:15:38,961]: storepid(): Stored pid '1600' of 'containershell':    1600 ?        00:00:00 bash
DEBUGNOTE[08:15:38,975]: Running xtermrc: Ask for password if needed (no)
DEBUGNOTE[08:15:38,984]: waitforlogentry(): start_xserver(): Waiting for logentry "readyforX=ready" in store.info
DEBUGNOTE[08:15:38,993]: Running dockerrc: Setup as root or as user docker on host.
DEBUGNOTE[08:15:39,055]: dockerrc: Found default container Runtime: runc
DEBUGNOTE[08:15:39,068]: dockerrc: All  Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
DEBUGNOTE[08:15:39,084]: dockerrc: Container Runtime: UNDECLARED_RUNTIME
DEBUGNOTE[08:15:39,095]: storeinfo(): runtime=UNDECLARED_RUNTIME
DEBUGNOTE[08:15:39,157]: dockerrc: Image architecture:
DEBUGNOTE[08:15:39,194]: dockerrc: Image CMD:
DEBUGNOTE[08:15:39,211]: dockerrc: Image USER:
DEBUGNOTE[08:15:39,225]: storeinfo(): containeruser=root
DEBUGNOTE[08:15:39,256]: dockerrc: Image ENTRYPOINT:
DEBUGNOTE[08:15:39,264]: waitforlogentry(): start_docker(): Waiting for logentry "dockerrc=ready" in store.info
DEBUGNOTE[08:15:39,268]: dockerrc: Image WORKDIR:
x11docker ERROR: No container command specified and no CMD or ENTRYPOINT found in image.

  Type 'x11docker --help' for usage information
  Debug options: '--verbose' (full log) or '--debug' (log excerpt).
  Logfile will be: /root/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

DEBUGNOTE[08:15:39,280]: time to say goodbye (error)
DEBUGNOTE[08:15:39,283]: storeinfo(): error=64
DEBUGNOTE[08:15:39,290]: time to say goodbye (finish-subshell)
x11docker WARNING: Could not display message on X:
No container command specified and no CMD or ENTRYPOINT found in image.

  Type 'x11docker --help' for usage information
  Debug options: '--verbose' (full log) or '--debug' (log excerpt).
  Logfile will be: /root/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

DEBUGNOTE[08:15:39,379]: time to say goodbye (watchpidlist)
DEBUGNOTE[08:15:39,395]: waitforlogentry(): tailstderr: Stopped waiting for x11docker=ready in store.info due to terminating signal.
DEBUGNOTE[08:15:39,394]: waitforlogentry(): tailstdout: Stopped waiting for x11docker=ready in store.info due to terminating signal.
DEBUGNOTE[08:15:39,501]: waitforlogentry(): start_xserver(): Stopped waiting for readyforX=ready in store.info due to terminating signal.
DEBUGNOTE[08:15:39,504]: time to say goodbye (main)
DEBUGNOTE[08:15:39,506]: Terminating x11docker.
DEBUGNOTE[08:15:39,509]: time to say goodbye (finish)
DEBUGNOTE[08:15:39,523]: finish(): Checking pid 1600 (containershell):    1600 ?        00:00:00 bash
DEBUGNOTE[08:15:39,529]: termpid(): Terminating 1600 (containershell):    1600 ?        00:00:00 bash
DEBUGNOTE[08:15:39,641]: finish(): Checking pid 1075 (watchmessagefifo): (already gone)
DEBUGNOTE[08:15:39,656]: finish(): Checking pid 1062 (watchpidlist): (already gone)
DEBUGNOTE[08:15:39,694]: Removing container x11docker_X103_erichough-kodi_21737990640
    Error: No such container: x11docker_X103_erichough-kodi_21737990640
DEBUGNOTE[08:15:39,712]: x11docker exit code: 64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants