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

kodi container on proxmox/LXC #387

Closed
RobertusIT opened this issue Oct 5, 2021 · 70 comments
Closed

kodi container on proxmox/LXC #387

RobertusIT opened this issue Oct 5, 2021 · 70 comments

Comments

@RobertusIT
Copy link

Hi

I wish to install Kodi in lxc docker container, on Proxmox, and exist a git about that

But no luck, please can you help me ?

I make all logs that i can get, here

I really really wish to have kodi in docker with audio and video hdmi.

@mviereck
Copy link
Owner

mviereck commented Oct 5, 2021

Running x11docker by a systemd service is a quite special setup.
I recommend to track down the issue without systemd and to run x11docker directly from command line without anything special:

x11docker erichough/kodi

Some lines in the verbose output look odd:


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:

x11docker should detect CMD or ENTRYPOINT in the image, but it didn't.
Please show me the output of:

python --version
docker inspect erichough/kodi

@RobertusIT
Copy link
Author

RobertusIT commented Oct 5, 2021

Running x11docker by a systemd service is a quite special setup. I recommend to track down the issue without systemd and to run x11docker directly from command line without anything special:

x11docker erichough/kodi

**In first thanks to reply and support.

I'll do that and this is the output.**

login as: root
[email protected]'s password:
Linux NUC-i3 5.11.22-4-pve #1 SMP PVE 5.11.22-8 (Fri, 27 Aug 2021 11:51:34 +0200                                ) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Oct  5 10:09:59 2021 from 192.168.178.21
root@NUC-i3:~# pct enter 105
root@KODI:~# x11docker erichough/kodi
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.

Failed to connect to bus: No such file or directory
x11docker WARNING: Environment variables DISPLAY and WAYLAND_DISPLAY are empty,
  but it seems x11docker was started within X, not from console.
  Please set DISPLAY and XAUTHORITY.
  If you have started x11docker with su or sudo, su/sudo may be configured to
  unset X environment variables. It may work if you run x11docker with
    sudo -E x11docker [...]
  If your system does not support 'sudo -E', you can try
    sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY x11docker [...]
  Otherwise, you can use tools like gksu/gksudo/kdesu/kdesudo/lxsu/lxsudo.

x11docker note: Using X server option --xorg

x11docker WARNING: x11docker will run Xorg as root.

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

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.

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.

Image erichough/kodi not found locally.
Do you want to pull it from docker hub?
(timeout after 60s assuming no) [Y|n]Yx11docker note: Pulling image 'erichough/kodi' from docker hub

Using default tag: latest
latest: Pulling from erichough/kodi
83ee3a23efb7: Pull complete
db98fc6f11f0: Pull complete
f611acd52c6c: Pull complete
4b3e4a4ee00d: Pull complete
95ebc55a8959: Pull complete
9403378b9f9a: Pull complete
Digest: sha256:f68c635adc43962de4df2f82b99e1b9fedb736c37d83635c1517b31169ad5ec9
Status: Downloaded newer image for erichough/kodi:latest
docker.io/erichough/kodi:latest

x11docker ERROR: waitforlogentry(): dockerrc: Found error message in logfile.
  Last lines of logfile xinit.log:
(EE)
(EE)
Please consult the The X.Org Foundation support
         at http://wiki.x.org
 for help.
(EE) Please also check the log file at "/var/log/Xorg.105.log" for additional information.
(EE)
(WW) xf86CloseConsole: KDSETMODE failed: Bad file descriptor
(WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor
(EE) Server terminated with error (1). Closing log file.

  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:~#

Some lines in the verbose output look odd:


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:

x11docker should detect CMD or ENTRYPOINT in the image, but it didn't. Please show me the output of:

python --version
docker inspect erichough/kodi

Here the output about python version and docker inspect:

root@KODI:~# python --version
Python 2.7.17
root@KODI:~# docker inspect erichough/kodi
[
    {
        "Id": "sha256:6f559cd7ac430b7afa0d1a3382eccf241fb2b538be0cf574c2d1c843183ed461",
        "RepoTags": [
            "erichough/kodi:latest"
        ],
        "RepoDigests": [
            "erichough/kodi@sha256:f68c635adc43962de4df2f82b99e1b9fedb736c37d83635c1517b31169ad5ec9"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2021-02-23T05:01:38.482793251Z",
        "Container": "d67385d1c2c919a6b7397622e071aea9af1f30ad6139e8f6d5ca4f3b92e5f799",
        "ContainerConfig": {
            "Hostname": "d67385d1c2c9",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) ",
                "ENTRYPOINT [\"/usr/local/bin/entrypoint.sh\"]"
            ],
            "Image": "sha256:79b78ed3bf4c5c269d1b61fe4015b636fa2e4981b370f9c0e17a130da9fbe6cf",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/usr/local/bin/entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "DockerVersion": "19.03.8",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": null,
            "Image": "sha256:79b78ed3bf4c5c269d1b61fe4015b636fa2e4981b370f9c0e17a130da9fbe6cf",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/usr/local/bin/entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 628063853,
        "VirtualSize": 628063853,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/d000ba143bfe2d26fdf59fbb503c4653609680f220678b77028a0fdaa1     101dc7/diff:/var/lib/docker/overlay2/2ae37ec3da89e5f9148c086ae9f05048404daa9cea114a3106603e71eda44051/diff:/var/     lib/docker/overlay2/c8f5dd4b4c031acfc4c45983059a22524bc5549a3fdb63352600b68233242cfa/diff:/var/lib/docker/overla     y2/c8c828bd352330861364f64d2f95e394bb8ee635ed939e90d82a3b76ca956368/diff:/var/lib/docker/overlay2/3fbc7105a63b4c     a885be91ba8866be321f653dd47e5d17042df3d66440defd83/diff",
                "MergedDir": "/var/lib/docker/overlay2/e3375ad132942ecedbffc8b9fbe2262c9b99b4d91edb01da845f86fb0     45d65d9/merged",
                "UpperDir": "/var/lib/docker/overlay2/e3375ad132942ecedbffc8b9fbe2262c9b99b4d91edb01da845f86fb04     5d65d9/diff",
                "WorkDir": "/var/lib/docker/overlay2/e3375ad132942ecedbffc8b9fbe2262c9b99b4d91edb01da845f86fb045     d65d9/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:9f32931c9d28f10104a8eb1330954ba90e76d92b02c5256521ba864feec14009",
                "sha256:dbf2c0f42a39b60301f6d3936f7f8adb59bb97d31ec11cc4a049ce81155fef89",
                "sha256:02473afd360bd5391fa51b6e7849ce88732ae29f50f3630c3551f528eba66d1e",
                "sha256:ff61086450f5d7b8754efcfd65ac15006f308b55535af79fbb5cc984b2719e99",
                "sha256:86fd6249f3cb25d95b36f8e04378667f3f39776b198617ca89c295132a0b6cac",
                "sha256:d44d60450d040945f7bc6b877f4a9e66b52d3325db8b2351503d55a40ec86c48"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]
root@KODI:~#

If needed or can help, i get a new fresh lxc with ubuntu 18.04 and launch a set of command that you suggest.

@mviereck
Copy link
Owner

mviereck commented Oct 5, 2021

I am not sure how the system is set up. I don't know proxmox and you tell something about lxc.
Maybe the issue is due to this special setup.

Please try if docker can run at all:

docker run --rm alpine ls

If this shows some directory names and does not show an error, docker is able to run. (Within an lxc container it is likely to fail.)

How do you access the system? Remotely over ssh? Is a monitor attached?

@RobertusIT
Copy link
Author

I am not sure how the system is set up. I don't know proxmox and you tell something about lxc. Maybe the issue is due to this special setup.

Please try if docker can run at all:

docker run --rm alpine ls

If this shows some directory names and does not show an error, docker is able to run. (Within an lxc container it is likely to fail.)

How do you access the system? Remotely over ssh? Is a monitor attached?

root@KODI:~# docker run --rm alpine ls
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
a0d0a0d46f8b: Pull complete 
Digest: sha256:e1c082e3d3c45cccac829840a25941e679c25d438cc8412c2fa221cf1a824e6a
Status: Downloaded newer image for alpine:latest
docker: Error response from daemon: AppArmor enabled on system but the docker-default profile could not be loaded: running `/sbin/apparmor_parser apparmor_parser -Kr /var/lib/docker/tmp/docker-default788719653` failed with output: apparmor_parser: Unable to replace "docker-default".  Permission denied; attempted to load a profile while confined?

error: exit status 243.
root@KODI:~# 

Monitor is attached.
Proxmox is like VMware, so you have in a machine, some virtual machine, and you can create also lxc docker container, that share host kernel and others like gpu audio ethernet etc

@mviereck
Copy link
Owner

mviereck commented Oct 5, 2021

docker: Error response from daemon: AppArmor enabled on system but the docker-default profile could not be loaded: running /sbin/apparmor_parser apparmor_parser -Kr /var/lib/docker/tmp/docker-default788719653 failed with output: apparmor_parser: Unable to replace "docker-default". Permission denied; attempted to load a profile while confined?

This is an error of your system setup and independent from x11docker. Please fix that first.
I don't know immediately what is wrong, so please research yourself.

you can create also lxc docker container,

This is a bit confusing, because lxc and docker are two different software solutions using the same linux kernel features. You can either use lxc or docker. So you don't use lxc here but only docker.

@RobertusIT
Copy link
Author

docker: Error response from daemon: AppArmor enabled on system but the docker-default profile could not be loaded: running /sbin/apparmor_parser apparmor_parser -Kr /var/lib/docker/tmp/docker-default788719653 failed with output: apparmor_parser: Unable to replace "docker-default". Permission denied; attempted to load a profile while confined?

This is an error of your system setup and independent from x11docker. Please fix that first. I don't know immediately what is wrong, so please research yourself.

you can create also lxc docker container,

This is a bit confusing, because lxc and docker are two different software solutions using the same linux kernel features. You can either use lxc or docker. So you don't use lxc here but only docker.

I have installed an LXC with ubuntu 18.04, then inside, I have installed docker.

Not needeed docker? only LXC is enough?

root@KODI:~# docker run --rm alpine ls
bin
dev
etc
home
lib
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var
root@KODI:~# 

Done, i don't understand what do this command, anyway output video, is the same, proxmox, not others things, right?

@mviereck
Copy link
Owner

mviereck commented Oct 5, 2021

root@KODI:~# docker run --rm alpine ls

This time the command worked. Did you change anything?
It just runs a docker container of alpine with the command ls. I just wanted to see if docker works at all.

Not needeed docker? only LXC is enough?

x11docker supports docker, but not LXC.
If in your setup docker runs in LXC without an error, than that might be ok.

If you have a monitor attached: Is there an X server already running, e.g. with some desktop on it?
Can you run regular graphical X applications?

@RobertusIT
Copy link
Author

root@KODI:~# docker run --rm alpine ls

This time the command worked. Did you change anything? It just runs a docker container of alpine with the command ls. I just wanted to see if docker works at all.

To fix this, I read this thread and i execute these commands: ( from reinstall Apparmor link inside this thread )

apt remove apparmor --purge -y
rm -rf /etc/apparmor*

Not needeed docker? only LXC is enough?

x11docker supports docker, but not LXC. If in your setup docker runs in LXC without an error, than that might be ok.

I have another LXC with docker and portainer:

image

So i guess to say, that works docker inside LXC. I'm not an expert anyway.

If you have a monitor attached: Is there an X server already running, e.g. with some desktop on it? Can you run regular graphical X applications?

Proxmox is debian host. https://en.wikipedia.org/wiki/Proxmox_Virtual_Environment

So have a base system in debian that contain only basilar packages to execute proxmox.

Into proxmox you can create lxc container , virtual machine etc

I hope to be clear.

If i install kodi in host, works, because is in the main, with proxmox.

But is wrong do that, because host OS, need to be clear as possible, to avoid any trouble, and also because if i reboot kodi, reboot all virtual machine.

And also docker or virtual machine, is better for backup.

With a virtual machine, i can make a gpu passthrough, but not audio, because i can do that, but like i said, audio is in a group with also ethernet and other stuff, so isn't possible use only audio passthrough for a virtual machine, and ethernet for others in the same time.

LXC i guess do that because use the host kernel.

@mviereck
Copy link
Owner

mviereck commented Oct 5, 2021

Thank you for the system description. i try to understand it.

To fix this, I read this thread and i execute these commands: ( from reinstall Apparmor link inside this thread )

So you have found and fixed the issue, good.

In the LXC where you want to run x11docker, can you run other graphical applications, for example xterm?

Edit: What do you get if you try to run X server Xorg directly, e.g. Xorg :8?

@RobertusIT
Copy link
Author

RobertusIT commented Oct 5, 2021

Thank you for the system description. i try to understand it.

To fix this, I read this thread and i execute these commands: ( from reinstall Apparmor link inside this thread )

So you have found and fixed the issue, good.

In the LXC where you want to run x11docker, can you run other graphical applications, for example xterm?

Edit: What do you get if you try to run X server Xorg directly, e.g. Xorg :8?

root@KODI:~# xterm

Command 'xterm' not found, but can be installed with:

apt install xterm

root@KODI:~# apt install xterm
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libutempter0 xbitmaps
Suggested packages:
  xfonts-cyrillic
The following NEW packages will be installed:
  libutempter0 xbitmaps xterm
0 upgraded, 3 newly installed, 0 to remove and 192 not upgraded.
Need to get 697 kB of archives.
After this operation, 2252 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libutempter0 amd64 1.1.6-3 [7898 B]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 xbitmaps all 1.1.1-2 [28.1 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 xterm amd64 330-1ubuntu2.2 [661 kB]
Fetched 697 kB in 1s (1274 kB/s)
Selecting previously unselected package libutempter0:amd64.
(Reading database ... 38735 files and directories currently installed.)
Preparing to unpack .../libutempter0_1.1.6-3_amd64.deb ...
Unpacking libutempter0:amd64 (1.1.6-3) ...
Selecting previously unselected package xbitmaps.
Preparing to unpack .../xbitmaps_1.1.1-2_all.deb ...
Unpacking xbitmaps (1.1.1-2) ...
Selecting previously unselected package xterm.
Preparing to unpack .../xterm_330-1ubuntu2.2_amd64.deb ...
Unpacking xterm (330-1ubuntu2.2) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Setting up xbitmaps (1.1.1-2) ...
Setting up libutempter0:amd64 (1.1.6-3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Setting up xterm (330-1ubuntu2.2) ...
update-alternatives: using /usr/bin/xterm to provide /usr/bin/x-terminal-emulator (x-terminal-emulator) in auto mode
update-alternatives: using /usr/bin/lxterm to provide /usr/bin/x-terminal-emulator (x-terminal-emulator) in auto mode
root@KODI:~# xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s
xterm: DISPLAY is not set
root@KODI:~# 
root@KODI:~# cat /etc/ssh/sshd_config | grep X
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#       X11Forwarding no

@RobertusIT
Copy link
Author

Thank you for the system description. i try to understand it.

To fix this, I read this thread and i execute these commands: ( from reinstall Apparmor link inside this thread )

So you have found and fixed the issue, good.
In the LXC where you want to run x11docker, can you run other graphical applications, for example xterm?
Edit: What do you get if you try to run X server Xorg directly, e.g. Xorg :8?

root@KODI:~# xterm

Command 'xterm' not found, but can be installed with:

apt install xterm

root@KODI:~# apt install xterm
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libutempter0 xbitmaps
Suggested packages:
  xfonts-cyrillic
The following NEW packages will be installed:
  libutempter0 xbitmaps xterm
0 upgraded, 3 newly installed, 0 to remove and 192 not upgraded.
Need to get 697 kB of archives.
After this operation, 2252 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libutempter0 amd64 1.1.6-3 [7898 B]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 xbitmaps all 1.1.1-2 [28.1 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 xterm amd64 330-1ubuntu2.2 [661 kB]
Fetched 697 kB in 1s (1274 kB/s)
Selecting previously unselected package libutempter0:amd64.
(Reading database ... 38735 files and directories currently installed.)
Preparing to unpack .../libutempter0_1.1.6-3_amd64.deb ...
Unpacking libutempter0:amd64 (1.1.6-3) ...
Selecting previously unselected package xbitmaps.
Preparing to unpack .../xbitmaps_1.1.1-2_all.deb ...
Unpacking xbitmaps (1.1.1-2) ...
Selecting previously unselected package xterm.
Preparing to unpack .../xterm_330-1ubuntu2.2_amd64.deb ...
Unpacking xterm (330-1ubuntu2.2) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Setting up xbitmaps (1.1.1-2) ...
Setting up libutempter0:amd64 (1.1.6-3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Setting up xterm (330-1ubuntu2.2) ...
update-alternatives: using /usr/bin/xterm to provide /usr/bin/x-terminal-emulator (x-terminal-emulator) in auto mode
update-alternatives: using /usr/bin/lxterm to provide /usr/bin/x-terminal-emulator (x-terminal-emulator) in auto mode
root@KODI:~# xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s
xterm: DISPLAY is not set
root@KODI:~# 
root@KODI:~# cat /etc/ssh/sshd_config | grep X
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#       X11Forwarding no
root@KODI:~# **Xorg :8**

X.Org X Server 1.19.6
Release Date: 2017-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.15.0-140-generic x86_64 Ubuntu
Current Operating System: Linux KODI 5.11.22-4-pve #1 SMP PVE 5.11.22-8 (Fri, 27 Aug 2021 11:51:34 +0200) x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.11.22-4-pve root=/dev/mapper/pve-root ro quiet
Build Date: 08 April 2021  01:57:21PM
xorg-server 2:1.19.6-1ubuntu4.9 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.34.0
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.8.log", Time: Tue Oct  5 15:00:44 2021
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE) 
Fatal server error:
(EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory)
(EE) 
(EE) 
Please consult the The X.Org Foundation support 
         at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/var/log/Xorg.8.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.
root@KODI:~# 

@mviereck
Copy link
Owner

mviereck commented Oct 5, 2021

xterm: Xt error: Can't open display: %s
xterm: DISPLAY is not set

So even if you have a graphical desktop, it is not available in the LXC container.
Can you show me ls /tmp/.X11-unix?

(EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory)

So you cannot run an additional Xorg in the LXC container.

Is there a recommended way to run graphical applications in a LXC container in proxmox?

@mviereck
Copy link
Owner

mviereck commented Oct 5, 2021

Basically I see two possible ways now:
Way 1: Somehow allowing graphical applications within a proxmox LXC container. You would have to research how that is possible.
Way 2: Installing docker and x11docker outside LXC on the host.

@RobertusIT
Copy link
Author

xterm: Xt error: Can't open display: %s
xterm: DISPLAY is not set

So even if you have a graphical desktop, it is not available in the LXC container. Can you show me ls /tmp/.X11-unix?

(EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory)

So you cannot run an additional Xorg in the LXC container.

Is there a recommended way to run graphical applications in a LXC container in proxmox?


root@KODI:~# ls /tmp/.X11-unix
root@KODI:~# 
root@KODI:~# 
root@KODI:~# 
root@KODI:~# 
root@KODI:~# cd /tmp/
.ICE-unix/
.Test-unix/
.X11-unix/
.XIM-unix/
.font-unix/
systemd-private-6382d4fd0363403485179013d1712164-systemd-resolved.service-fTWb8a/
root@KODI:~# cd /tmp/
.ICE-unix/
.Test-unix/
.X11-unix/
.XIM-unix/
.font-unix/
systemd-private-6382d4fd0363403485179013d1712164-systemd-resolved.service-fTWb8a/
root@KODI:~# cd /tmp/.X11-unix
root@KODI:/tmp/.X11-unix# ls
root@KODI:/tmp/.X11-unix# ls -la
total 8
drwxrwxrwt 2 root root 4096 Oct  5 15:00 .
drwxrwxrwt 8 root root 4096 Oct  5 15:06 ..
root@KODI:/tmp/.X11-unix# 

Seems to be empty.

I have an LXC with docker, GPU passthrough, portainer, that use ffmpeg, so to don't waste cpu, i make gpu passthrough for ffmpeg. But i didn't have any output video.

This is the container lxc info:

arch: amd64
cores: 4
features: nesting=1
hostname: FRIGATE
memory: 4096
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=EE:4A:86:8A:F4:71,type=veth
onboot: 1
ostype: debian
protection: 0
rootfs: local-lvm:vm-101-disk-0,size=12G
swap: 1024
lxc.mount.entry: /dev/bus/usb/002/ dev/bus/usb/002/ none bind,optional,create=dir 0, 0
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file 0, 0
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.cgroup2.devices.allow: c 226:0 rwm
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.cgroup2.devices.allow: c 29:0 rwm
lxc.apparmor.profile: unconfined
lxc.cgroup2.devices.allow: a
lxc.cap.drop:
lxc.mount.auto: cgroup:rw

Where
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file 0, 0 - is the GPU
lxc.cgroup2.devices.allow: c 226:128 rwm - is the gpu
lxc.cgroup2.devices.allow: c 189:* rwm - is Google Coral USB ( for Artificial Intelligence )

Now the LXC kodi container, have the similar configuration:

arch: amd64
cores: 2
features: nesting=1
hostname: KODI
memory: 2048
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=EE:F7:86:D5:EF:1C,ip=dhcp,type=veth
ostype: ubuntu
rootfs: USB:105/vm-105-disk-0.raw,size=32G
swap: 512
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file 0, 0
lxc.cgroup2.devices.allow: c 226:0 rwm
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.cgroup2.devices.allow: c 29:0 rwm
lxc.apparmor.profile: unconfined
lxc.cgroup2.devices.allow: a
lxc.cap.drop:
lxc.mount.auto: cgroup:rw

From this link, seems that is possible in LXC, have an output
Or this

@mviereck
Copy link
Owner

mviereck commented Oct 5, 2021

From this link, seems that is possible in LXC, have an output
Or this

If you want to go this way, please try out. Once you get e.g. xterm running in LXC, it is possible to run x11docker, too.

@RobertusIT
Copy link
Author

From this link, seems that is possible in LXC, have an output
Or this

If you want to go this way, please try out. Once you get e.g. xterm running in LXC, it is possible to run x11docker, too.

I follow roght now this procedure, but how can i start xterm ? which command ?

I can follow this guide but the most of things, are already done in my LXC, so when i finish to do this tutorial, how can i test xterm ?

@mviereck
Copy link
Owner

mviereck commented Oct 5, 2021

I follow roght now this procedure, but how can i start xterm ? which command ?

As you did above: Just type xterm. In your test it failed with DISPLAY is not set.

root@KODI:~# xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s
xterm: DISPLAY is not set

xterm is a terminal emulator that needs a graphical X server. Nothing special, just some arbitrary desktop application. It serves as a simple test case if graphical applications work at all.

@mviereck mviereck changed the title Tried to install kodi kodi container on proxmox/LXC Oct 5, 2021
@RobertusIT
Copy link
Author

RobertusIT commented Oct 6, 2021

I follow roght now this procedure, but how can i start xterm ? which command ?

As you did above: Just type xterm. In your test it failed with DISPLAY is not set.

root@KODI:~# xterm
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm: Xt error: Can't open display: %s
xterm: DISPLAY is not set

xterm is a terminal emulator that needs a graphical X server. Nothing special, just some arbitrary desktop application. It serves as a simple test case if graphical applications work at all.

I have installed

apt-get install xubuntu-desktop

And istalled a lot of things

Then in the config of lxc container, i setup this:

arch: amd64
cores: 2
features: nesting=1
hostname: KODI
memory: 2048
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=EE:F7:86:D5:EF:1C,ip=dhcp,type=veth
ostype: ubuntu
rootfs: USB:105/vm-105-disk-0.raw,size=32G
swap: 512
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file 0, 0
lxc.cgroup2.devices.allow: c 226:0 rwm
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.cgroup2.devices.allow: c 29:0 rwm
lxc.apparmor.profile: unconfined
lxc.cgroup2.devices.allow: a
lxc.cap.drop:
lxc.mount.auto: cgroup:rw
lxc.mount.entry: /dev/tty7 dev/tty7 none bind,optional,create=file
lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file
lxc.mount.entry: /dev/dri/card0 dev/dri/card0 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 4:7 rwm
lxc.cgroup2.devices.allow: c 13:* rwm
lxc.mount.entry: /dev/input dev/input none bind,optional,create=dir

In according about this tutorial

And now I have video output.

PXL_20211005_225824358

So seems that output is possible, but how can we setup kodi and not ubuntu?

kodi status is always stopped anyway and i guess this installation is dirty in this way.

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 Wed 2021-10-06 08:21:53 UTC; 4min 5s ago
  Process: 740 ExecStart=/usr/bin/x11docker --xorg --pulseaudio erichough/kodi (code=exited, status=64)
 Main PID: 740 (code=exited, status=64)
    Tasks: 0 (limit: 18974)
   CGroup: /system.slice/kodi.service

Oct 06 08:21:38 KODI x11docker[740]: (WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor
Oct 06 08:21:38 KODI x11docker[740]: (EE) Server terminated with error (1). Closing log file.
Oct 06 08:21:38 KODI x11docker[740]:   Type 'x11docker --help' for usage information
Oct 06 08:21:38 KODI x11docker[740]:   Debug options: '--verbose' (full log) or '--debug' (log excerpt).
Oct 06 08:21:38 KODI x11docker[740]:   Logfile will be: /root/.cache/x11docker/x11docker.log
Oct 06 08:21:38 KODI x11docker[740]:   Please report issues at https://github.com/mviereck/x11docker
Oct 06 08:21:53 KODI x11docker[740]: Connection failure: Connection refused
Oct 06 08:21:53 KODI x11docker[740]: pa_context_connect() failed: Connection refused
Oct 06 08:21:53 KODI systemd[1]: kodi.service: Main process exited, code=exited, status=64/n/a
Oct 06 08:21:53 KODI systemd[1]: kodi.service: Failed with result 'exit-code'.
root@KODI:~# 

@mviereck
Copy link
Owner

mviereck commented Oct 6, 2021

Try to run directly, not through systemd:

x11docker --pulseaudio --gpu erichough/kodi

@RobertusIT
Copy link
Author

Try to run directly, not through systemd:

x11docker --pulseaudio --gpu erichough/kodi
root@KODI:~# x11docker --pulseaudio --gpu erichough/kodi
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: Using X server option --xorg

x11docker WARNING: Option --gpu degrades container isolation.
  Container gains access to GPU hardware.
  This allows reading host window content (palinopsia leak)
  and GPU rootkits (compare proof of concept: jellyfish).

x11docker WARNING: x11docker will run Xorg as root.

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

x11docker WARNING: Option --pulseaudio allows container applications
  to catch your audio output and microphone input.

Connection failure: Connection refused
pa_context_connect() failed: Connection refused
x11docker note: New Xorg server  will run on tty 1.
  Access it with [CTRL][ALT][F1].

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.

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.

x11docker WARNING: Sharing device file: /dev/dri


x11docker ERROR: waitforlogentry(): dockerrc: Found error message in logfile. 
                                                                                Last lines of logfile xinit.log: 
                                                                                                                 (EE)  
                                                                                                                       (EE)  
                                                                                                                             Please consult the The X.Org Foundation support  
                                         at http://wiki.x.org 
                                                               for help.  
                                                                          (EE) Please also check the log file at "/var/log/Xorg.111.log" for additional information. 
                              (EE)  
                                    (WW) xf86CloseConsole: KDSETMODE failed: Inappropriate ioctl for device 
                                                                                                            (WW) xf86CloseConsole: VT_GETMODE failed: Inappropriate ioctl for device 
                                              (EE) Server terminated with error (1). Closing log file.

                                                                                                        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

                                                                Connection failure: Connection refused
                                                                                                      pa_context_connect() failed: Connection refused
              root@KODI:~# 

@mviereck
Copy link
Owner

mviereck commented Oct 6, 2021

It seems it is not possible to run an additional Xorg in LXC.
Please install weston and Xwayland and try again.
Add option --debug and show me the output.

@RobertusIT
Copy link
Author

Xwayland

root@KODI:~# **apt-get install weston**
Reading package lists... Done
Building dependency tree       
Reading state information... Done
weston is already the newest version (3.0.0-1).
0 upgraded, 0 newly installed, 0 to remove and 76 not upgraded.
root@KODI:~# **apt-get install Xwayland** 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package Xwayland

weston is already installed
Xwayland i don't know how to, i searched around, without success, seems a little bit tricky to install Xwayland.

Here debug about weston:

root@KODI:~# weston --debug
Date: 2021-10-06 UTC
[11:26:05.396] weston 3.0.0
               http://wayland.freedesktop.org
               Bug reports to: https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston&version=3.0.0
               Build: unknown (not built from git or tarball)
[11:26:05.396] Command line: weston --debug
[11:26:05.396] OS: Linux, 5.11.22-4-pve, #1 SMP PVE 5.11.22-8 (Fri, 27 Aug 2021 11:51:34 +0200), x86_64
[11:26:05.396] Starting with no config file.
[11:26:05.396] Output repaint window is 7 ms maximum.
[11:26:05.396] Loading module '/usr/lib/x86_64-linux-gnu/libweston-3/drm-backend.so'
[11:26:05.397] initializing drm backend
[11:26:05.397] logind: failed to get session seat
[11:26:05.397] logind: cannot setup systemd-logind helper (-61), using legacy fallback
[11:26:05.397] <stdin> not a vt
[11:26:05.397] if running weston from ssh, use --tty to specify a tty
[11:26:05.397] fatal: drm backend should be run using weston-launch binary or as root
[11:26:05.397] fatal: failed to create compositor backend
root@KODI:~# 

@mviereck
Copy link
Owner

mviereck commented Oct 6, 2021

Xwayland i don't know how to, i searched around, without success, seems a little bit tricky to install Xwayland.

Try: apt-get install xwayland

I mean --debug for x11docker, like:

x11docker --gpu --pulseaudio --debug erichough/kodi

@RobertusIT
Copy link
Author

Xwayland i don't know how to, i searched around, without success, seems a little bit tricky to install Xwayland.

Try: apt-get install xwayland

I mean --debug for x11docker, like:

x11docker --gpu --pulseaudio --debug erichough/kodi
root@KODI:~# **apt-get install xwayland**
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  xwayland
0 upgraded, 1 newly installed, 0 to remove and 76 not upgraded.
Need to get 863 kB of archives.
After this operation, 2502 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 xwayland amd64 2:1.19.6-1ubuntu4.9 [863 kB]
Fetched 863 kB in 1s (1634 kB/s)
Selecting previously unselected package xwayland.
(Reading database ... 113271 files and directories currently installed.)
Preparing to unpack .../xwayland_2%3a1.19.6-1ubuntu4.9_amd64.deb ...
Unpacking xwayland (2:1.19.6-1ubuntu4.9) ...
Setting up xwayland (2:1.19.6-1ubuntu4.9) ...
root@KODI:~# `x11docker --gpu --pulseaudio --debug erichough/kodi`
DEBUGNOTE[11:46:17,834]: check_host(): ps can watch root processes: yes
DEBUGNOTE[11:46:17,865]: 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[11:46:18,040]: storeinfo(): cache=/root/.cache/x11docker/erichough-kodi-20777757789
DEBUGNOTE[11:46:18,046]: storeinfo(): stdout=/root/.cache/x11docker/erichough-kodi-20777757789/share/stdout
DEBUGNOTE[11:46:18,052]: storeinfo(): stderr=/root/.cache/x11docker/erichough-kodi-20777757789/share/stderr
DEBUGNOTE[11:46:18,076]: storeinfo(): x11dockerpid=3965
DEBUGNOTE[11:46:18,123]: 
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' '--gpu' '--pulseaudio' '--debug' 'erichough/kodi' 
Parsed options:     --gpu --pulseaudio '' --debug -- 'erichough/kodi'
DEBUGNOTE[11:46:18,129]: Dependency check for --xorg: 0
DEBUGNOTE[11:46:18,133]: Dependencies of --xorg already checked: 0 
DEBUGNOTE[11:46:18,136]: Dependencies of --xorg already checked: 0 
x11docker note: Using X server option --xorg

DEBUGNOTE[11:46:18,140]: storeinfo(): xserver=--xorg
x11docker WARNING: Option --gpu degrades container isolation.
  Container gains access to GPU hardware.
  This allows reading host window content (palinopsia leak)
  and GPU rootkits (compare proof of concept: jellyfish).

x11docker WARNING: x11docker will run Xorg as root.

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

DEBUGNOTE[11:46:18,168]: container user: root 0:0 /root
DEBUGNOTE[11:46:18,195]: waitforlogentry(): tailstdout: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:46:18,200]: waitforlogentry(): tailstderr: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:46:18,218]: storepid(): Stored pid '4470' of 'watchpidlist':    4470 pts/0    00:00:00 bash
DEBUGNOTE[11:46:18,236]: storepid(): Stored pid '4489' of 'watchmessagefifo':    4489 pts/0    00:00:00 bash
x11docker WARNING: Option --pulseaudio allows container applications
  to catch your audio output and microphone input.

Connection failure: Connection refused
pa_context_connect() failed: Connection refused
DEBUGNOTE[11:46:18,290]: traperror: Command at Line 9033 returned with error code 1:
  pactl load-module module-native-protocol-unix socket=/root/.cache/x11docker/erichough-kodi-20777757789/share/pulseaudio.socket 2>&1
  1951 - ::unpriv::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:46:18,293]: storeinfo(): error=64
DEBUGNOTE[11:46:18,300]: time to say goodbye (traperror)
DEBUGNOTE[11:46:18,304]: traperror: Command at Line 9033 returned with error code 1:
  $Unpriv "${1:-}"
  1951 - ::unpriv::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:46:18,308]: storeinfo(): error=64
DEBUGNOTE[11:46:18,317]: time to say goodbye (traperror)
DEBUGNOTE[11:46:18,321]: traperror: Command at Line 1951 returned with error code 1:
  $Unpriv "${1:-}"
  9114 - ::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:46:18,326]: storeinfo(): error=64
DEBUGNOTE[11:46:18,335]: time to say goodbye (traperror)
DEBUGNOTE[11:46:18,342]: traperror: Command at Line 1951 returned with error code 1:
  Pulseaudiomoduleid="$(unpriv "pactl load-module module-native-protocol-unix socket=$Pulseaudiosocket 2>&1")"
  9114 - ::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:46:18,349]: storeinfo(): error=64
DEBUGNOTE[11:46:18,361]: time to say goodbye (traperror)
DEBUGNOTE[11:46:18,364]: storeinfo(): pulseaudiomoduleid=Connection failure: Connection refused
pa_context_connect() failed: Connection refused
x11docker note: New Xorg server  will run on tty 1.
  Access it with [CTRL][ALT][F1].

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[11:46:18,471]: storeinfo(): DISPLAY=:116
DEBUGNOTE[11:46:18,489]: storeinfo(): XAUTHORITY=/root/.cache/x11docker/erichough-kodi-20777757789/share/Xauthority.client
DEBUGNOTE[11:46:18,495]: storeinfo(): XSOCKET=/tmp/.X11-unix/X116
DEBUGNOTE[11:46:18,503]: storeinfo(): XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:46:18,510]: storeinfo(): Xenv= DISPLAY=:116 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-20777757789/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X116 XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:46:18,527]: X server command:
  /usr/bin/Xorg :116 vt1  \
  -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-20777757789/Xauthority.server \
  -nolisten tcp \
  -verbose \
  -keeptty \
  
DEBUGNOTE[11:46:18,608]: storeinfo(): tini=/usr/bin/docker-init
DEBUGNOTE[11:46:18,631]: 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:                          yes
  Running on console:                             yes
  Running over SSH:                               no
  Running sourced:                                no
  bash $-:                                        huBE
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[11:46:18,643]: storeinfo(): containername=x11docker_X116_erichough-kodi_20777757789
DEBUGNOTE[11:46:18,706]: waitforlogentry(): tailstdout: Stopped waiting for x11docker=ready in store.info due to terminating signal.
DEBUGNOTE[11:46:18,731]: waitforlogentry(): tailstderr: Stopped waiting for x11docker=ready in store.info due to terminating signal.
x11docker WARNING: Sharing device file: /dev/dri

DEBUGNOTE[11:46:18,856]: docker command:
  docker run --detach --tty \
  --name x11docker_X116_erichough-kodi_20777757789 \
  --user 0:0 \
  --userns=host \
  --group-add 44 \
  --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-20777757789/share':'/x11docker':rw \
  --device '/dev/dri':'/dev/dri':rw \
  --volume '/tmp/.X11-unix/X116':'/X116':rw \
  --volume /root/.cache/x11docker/erichough-kodi-20777757789/pulseaudio.client.conf:/etc/pulse/client.conf:ro \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xauthority.client' \
  --env 'DISPLAY=:116' \
  --env 'PULSE_COOKIE=/x11docker/pulseaudio.cookie' \
  --env 'PULSE_SERVER=unix:/x11docker/pulseaudio.socket' \
  --env 'USER=root' \
  -- erichough/kodi /usr/local/bin/init -- /bin/sh - /x11docker/containerrc
DEBUGNOTE[11:46:19,113]: storepid(): Stored pid '5328' of 'containershell':    5328 pts/0    00:00:00 bash
DEBUGNOTE[11:46:19,119]: Running xtermrc: Ask for password if needed (no)
DEBUGNOTE[11:46:19,139]: Running dockerrc: Setup as root or as user docker on host.
DEBUGNOTE[11:46:19,142]: waitforlogentry(): start_xserver(): Waiting for logentry "readyforX=ready" in store.info
DEBUGNOTE[11:46:19,179]: dockerrc: Found default container Runtime: runc
DEBUGNOTE[11:46:19,205]: dockerrc: All  Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
DEBUGNOTE[11:46:19,217]: time to say goodbye (watchpidlist)
DEBUGNOTE[11:46:19,225]: dockerrc: Container Runtime: UNDECLARED_RUNTIME
DEBUGNOTE[11:46:19,243]: storeinfo(): runtime=UNDECLARED_RUNTIME
DEBUGNOTE[11:46:19,248]: waitforlogentry(): start_docker(): Waiting for logentry "dockerrc=ready" in store.info
DEBUGNOTE[11:46:19,255]: storeinfo(): xtermrc=ready
DEBUGNOTE[11:46:19,655]: waitforlogentry(): start_xserver(): Stopped waiting for readyforX=ready in store.info due to terminating signal.
DEBUGNOTE[11:46:19,660]: traperror: Command at Line 9257 returned with error code 1:
  return 1
  9271 - ::main::main
DEBUGNOTE[11:46:19,664]: storeinfo(): error=64
DEBUGNOTE[11:46:19,675]: time to say goodbye (traperror)
DEBUGNOTE[11:46:19,682]: time to say goodbye (main)
DEBUGNOTE[11:46:19,686]: Terminating x11docker.
DEBUGNOTE[11:46:19,690]: time to say goodbye (finish)
DEBUGNOTE[11:46:19,706]: finish(): Checking pid 5328 (containershell):    5328 pts/0    00:00:00 bash
DEBUGNOTE[11:46:19,715]: termpid(): Terminating 5328 (containershell):    5328 pts/0    00:00:00 bash
/usr/bin/x11docker: line 920:  5328 Terminated              { trap '' SIGINT; case $X11dockermode in 
    run)
        start_docker
    ;;
    exe)
        start_hostexe
    ;;
esac; Pid1pid="$(storeinfo dump pid1pid)"; case $X11dockermode in 
    run)
        case "$Winsubsystem" in 
            "")
                setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
            ;;
            *)
                setonwatchpidlist "CONTAINER$Containername"
            ;;
        esac
    ;;
    exe)
        setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
    ;;
esac; case $Xserver in 
    --tty | --hostdisplay | --hostwayland | --weston | --kwin)

    ;;
    *)
        Xinitpid="$(pgrep -a xinit 2>/dev/null | grep "xinit $Xinitrc" | awk '{print $1}')"; checkpid "$Xinitpid" && setonwatchpidlist $Xinitpid xinit; echo $Xcommand | grep -q Xorgwrapper && Line="Xorg $Newdisplay" || Line="$(head -n1 <<< "$Xcommand" | tr -d '\\')"; Xserverpid=$(ps aux | rmcr | grep "$(echo "${Line:-nothingtolookfor}" | cut -d' ' -f1-2)" | grep -v grep | grep -v xinit | awk '{print $2}'); checkpid "$Xserverpid" && setonwatchpidlist "$Xserverpid" Xserver
    ;;
esac; [ "$Pulseaudiomode" = "tcp" ] && start_pulseaudiotcp; checkpid "$Pid1pid" && debugnote "Process tree of ${Hostexe:-container}: (maybe not complete yet)
$(pstree -cp $Pid1pid 2>&1 ||:)"; debugnote "Process tree of x11docker:
$(pstree -p $$ 2>&1 ||:)
  $(storepid test dockerstopshell && echo "Lost child of dockerrc (dockerstopshell):
    $(pstree -p $(storepid dump dockerstopshell) 2>&1 ||:)")"; debugnote "storeinfo(): Stored info:
$(cat $Storeinfofile)"; debugnote "storepid(): Stored pids:
$(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 "x11docker=ready"; } 0<&0
DEBUGNOTE[11:46:19,841]: finish(): Checking pid 4489 (watchmessagefifo):    4489 pts/0    00:00:00 bash
DEBUGNOTE[11:46:19,856]: finish(): Checking pid 4470 (watchpidlist): (already gone)
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
DEBUGNOTE[11:46:19,905]: Removing container x11docker_X116_erichough-kodi_20777757789
    Error: No such container: x11docker_X116_erichough-kodi_20777757789
DEBUGNOTE[11:46:19,929]: termpid(): Terminating 4489 (watchmessagefifo):    4489 pts/0    00:00:00 bash
/usr/bin/x11docker: line 920:  4489 Terminated              watchmessagefifo
DEBUGNOTE[11:46:20,044]: x11docker exit code: 64

@mviereck
Copy link
Owner

mviereck commented Oct 6, 2021

Oh, x11docker tried to run with option --xorg again.
Please try:

x11docker --gpu --pulseaudio --weston-xwayland --debug erichough/kodi

or:

x11docker --gpu --pulseaudio --hostdisplay --debug erichough/kodi

@RobertusIT
Copy link
Author

Oh, x11docker tried to run with option --xorg again. Please try:

x11docker --gpu --pulseaudio --weston-xwayland --debug erichough/kodi
KODI login: root
Password: 
Last login: Wed Oct  6 11:36:41 UTC 2021 on lxc/tty1
**run-parts: /etc/update-motd.d/98-fsck-at-reboot exited with return code 1**
root@KODI:~# **x11docker --gpu --pulseaudio --weston-xwayland --debug erichough/kodi**
DEBUGNOTE[11:51:55,096]: check_host(): ps can watch root processes: yes
DEBUGNOTE[11:51:55,130]: 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[11:51:55,308]: storeinfo(): cache=/root/.cache/x11docker/erichough-kodi-21115028676
DEBUGNOTE[11:51:55,315]: storeinfo(): stdout=/root/.cache/x11docker/erichough-kodi-21115028676/share/stdout
DEBUGNOTE[11:51:55,321]: storeinfo(): stderr=/root/.cache/x11docker/erichough-kodi-21115028676/share/stderr
DEBUGNOTE[11:51:55,343]: storeinfo(): x11dockerpid=2375
DEBUGNOTE[11:51:55,385]: 
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' '--gpu' '--pulseaudio' '--weston-xwayland' '--debug' 'erichough/kodi' 
Parsed options:     --gpu --pulseaudio '' --weston-xwayland --debug -- 'erichough/kodi'
DEBUGNOTE[11:51:55,389]: Dependency check for --weston-xwayland: 0
DEBUGNOTE[11:51:55,393]: Dependencies of --weston-xwayland already checked: 0 
DEBUGNOTE[11:51:55,396]: Dependencies of --weston-xwayland already checked: 0 
DEBUGNOTE[11:51:55,400]: storeinfo(): xserver=--weston-xwayland
x11docker WARNING: Option --gpu degrades container isolation.
  Container gains access to GPU hardware.
  This allows reading host window content (palinopsia leak)
  and GPU rootkits (compare proof of concept: jellyfish).

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

DEBUGNOTE[11:51:55,419]: container user: root 0:0 /root
DEBUGNOTE[11:51:55,447]: waitforlogentry(): tailstderr: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:51:55,449]: waitforlogentry(): tailstdout: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:51:55,450]: storepid(): Stored pid '2867' of 'watchpidlist':    2867 pts/0    00:00:00 bash
DEBUGNOTE[11:51:55,472]: storepid(): Stored pid '2891' of 'watchmessagefifo':    2891 pts/0    00:00:00 bash
x11docker WARNING: Option --pulseaudio allows container applications
  to catch your audio output and microphone input.

Connection failure: Connection refused
pa_context_connect() failed: Connection refused
DEBUGNOTE[11:51:55,528]: traperror: Command at Line 9033 returned with error code 1:
  pactl load-module module-native-protocol-unix socket=/root/.cache/x11docker/erichough-kodi-21115028676/share/pulseaudio.socket 2>&1
  1951 - ::unpriv::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:51:55,531]: storeinfo(): error=64
DEBUGNOTE[11:51:55,538]: time to say goodbye (traperror)
DEBUGNOTE[11:51:55,542]: traperror: Command at Line 9033 returned with error code 1:
  $Unpriv "${1:-}"
  1951 - ::unpriv::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:51:55,546]: storeinfo(): error=64
DEBUGNOTE[11:51:55,555]: time to say goodbye (traperror)
DEBUGNOTE[11:51:55,560]: traperror: Command at Line 1951 returned with error code 1:
  $Unpriv "${1:-}"
  9114 - ::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:51:55,563]: storeinfo(): error=64
DEBUGNOTE[11:51:55,572]: time to say goodbye (traperror)
DEBUGNOTE[11:51:55,579]: traperror: Command at Line 1951 returned with error code 1:
  Pulseaudiomoduleid="$(unpriv "pactl load-module module-native-protocol-unix socket=$Pulseaudiosocket 2>&1")"
  9114 - ::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:51:55,583]: storeinfo(): error=64
DEBUGNOTE[11:51:55,594]: time to say goodbye (traperror)
DEBUGNOTE[11:51:55,598]: storeinfo(): pulseaudiomoduleid=Connection failure: Connection refused
pa_context_connect() failed: Connection refused
DEBUGNOTE[11:51:55,683]: storeinfo(): DISPLAY=:120
DEBUGNOTE[11:51:55,690]: storeinfo(): XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21115028676/share/Xauthority.client
DEBUGNOTE[11:51:55,696]: storeinfo(): XSOCKET=/tmp/.X11-unix/X120
DEBUGNOTE[11:51:55,702]: storeinfo(): WAYLAND_DISPLAY=wayland-120
DEBUGNOTE[11:51:55,714]: storeinfo(): XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:51:55,720]: storeinfo(): Xenv= DISPLAY=:120 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21115028676/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X120 WAYLAND_DISPLAY=wayland-120 XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:51:55,739]: X server command:
  /usr/bin/Xwayland :120  \
  -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-21115028676/Xauthority.server \
  -nolisten tcp \
  
DEBUGNOTE[11:51:55,743]: Compositor command:
  weston \
  --socket=wayland-120 \
  --backend=drm-backend.so \
  --config='/root/.cache/x11docker/erichough-kodi-21115028676/weston.ini'
DEBUGNOTE[11:51:55,791]: storeinfo(): tini=/usr/bin/docker-init
DEBUGNOTE[11:51:55,800]: 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:                          yes
  Running on console:                             yes
  Running over SSH:                               no
  Running sourced:                                no
  bash $-:                                        huBE
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[11:51:55,805]: storeinfo(): containername=x11docker_X120_erichough-kodi_21115028676
x11docker WARNING: Sharing device file: /dev/dri

DEBUGNOTE[11:51:55,964]: waitforlogentry(): tailstdout: Stopped waiting for x11docker=ready in store.info due to terminating signal.
DEBUGNOTE[11:51:55,976]: waitforlogentry(): tailstderr: Stopped waiting for x11docker=ready in store.info due to terminating signal.
DEBUGNOTE[11:51:56,025]: docker command:
  docker run --detach --tty \
  --name x11docker_X120_erichough-kodi_21115028676 \
  --user 0:0 \
  --userns=host \
  --group-add 44 \
  --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-21115028676/share':'/x11docker':rw \
  --device '/dev/dri':'/dev/dri':rw \
  --volume '/tmp/.X11-unix/X120':'/X120':rw \
  --volume /root/.cache/x11docker/erichough-kodi-21115028676/pulseaudio.client.conf:/etc/pulse/client.conf:ro \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xauthority.client' \
  --env 'DISPLAY=:120' \
  --env 'PULSE_COOKIE=/x11docker/pulseaudio.cookie' \
  --env 'PULSE_SERVER=unix:/x11docker/pulseaudio.socket' \
  --env 'USER=root' \
  -- erichough/kodi /usr/local/bin/init -- /bin/sh - /x11docker/containerrc
DEBUGNOTE[11:51:56,279]: storepid(): Stored pid '3756' of 'containershell':    3756 pts/0    00:00:00 bash
DEBUGNOTE[11:51:56,294]: Running xtermrc: Ask for password if needed (no)
DEBUGNOTE[11:51:56,306]: waitforlogentry(): start_xserver(): Waiting for logentry "readyforX=ready" in store.info
DEBUGNOTE[11:51:56,322]: Running dockerrc: Setup as root or as user docker on host.
DEBUGNOTE[11:51:56,336]: dockerrc: Found default container Runtime: runc
DEBUGNOTE[11:51:56,364]: dockerrc: All  Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
DEBUGNOTE[11:51:56,401]: dockerrc: Container Runtime: UNDECLARED_RUNTIME
DEBUGNOTE[11:51:56,413]: storeinfo(): runtime=UNDECLARED_RUNTIME
DEBUGNOTE[11:51:56,426]: waitforlogentry(): start_docker(): Waiting for logentry "dockerrc=ready" in store.info
DEBUGNOTE[11:51:56,427]: storeinfo(): xtermrc=ready
DEBUGNOTE[11:51:56,443]: time to say goodbye (watchpidlist)
DEBUGNOTE[11:51:56,827]: waitforlogentry(): start_xserver(): Stopped waiting for readyforX=ready in store.info due to terminating signal.
DEBUGNOTE[11:51:56,832]: traperror: Command at Line 9257 returned with error code 1:
  return 1
  9271 - ::main::main
DEBUGNOTE[11:51:56,835]: storeinfo(): error=64
DEBUGNOTE[11:51:56,848]: time to say goodbye (traperror)
DEBUGNOTE[11:51:56,857]: time to say goodbye (main)
DEBUGNOTE[11:51:56,868]: Terminating x11docker.
DEBUGNOTE[11:51:56,872]: time to say goodbye (finish)
DEBUGNOTE[11:51:56,888]: finish(): Checking pid 3756 (containershell):    3756 pts/0    00:00:00 bash
DEBUGNOTE[11:51:56,897]: termpid(): Terminating 3756 (containershell):    3756 pts/0    00:00:00 bash
/usr/bin/x11docker: line 920:  3756 Terminated              { trap '' SIGINT; case $X11dockermode in 
    run)
        start_docker
    ;;
    exe)
        start_hostexe
    ;;
esac; Pid1pid="$(storeinfo dump pid1pid)"; case $X11dockermode in 
    run)
        case "$Winsubsystem" in 
            "")
                setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
            ;;
            *)
                setonwatchpidlist "CONTAINER$Containername"
            ;;
        esac
    ;;
    exe)
        setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
    ;;
esac; case $Xserver in 
    --tty | --hostdisplay | --hostwayland | --weston | --kwin)

    ;;
    *)
        Xinitpid="$(pgrep -a xinit 2>/dev/null | grep "xinit $Xinitrc" | awk '{print $1}')"; checkpid "$Xinitpid" && setonwatchpidlist $Xinitpid xinit; echo $Xcommand | grep -q Xorgwrapper && Line="Xorg $Newdisplay" || Line="$(head -n1 <<< "$Xcommand" | tr -d '\\')"; Xserverpid=$(ps aux | rmcr | grep "$(echo "${Line:-nothingtolookfor}" | cut -d' ' -f1-2)" | grep -v grep | grep -v xinit | awk '{print $2}'); checkpid "$Xserverpid" && setonwatchpidlist "$Xserverpid" Xserver
    ;;
esac; [ "$Pulseaudiomode" = "tcp" ] && start_pulseaudiotcp; checkpid "$Pid1pid" && debugnote "Process tree of ${Hostexe:-container}: (maybe not complete yet)
$(pstree -cp $Pid1pid 2>&1 ||:)"; debugnote "Process tree of x11docker:
$(pstree -p $$ 2>&1 ||:)
  $(storepid test dockerstopshell && echo "Lost child of dockerrc (dockerstopshell):
    $(pstree -p $(storepid dump dockerstopshell) 2>&1 ||:)")"; debugnote "storeinfo(): Stored info:
$(cat $Storeinfofile)"; debugnote "storepid(): Stored pids:
$(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 "x11docker=ready"; } 0<&0
DEBUGNOTE[11:51:57,014]: finish(): Checking pid 2891 (watchmessagefifo):    2891 pts/0    00:00:00 bash
DEBUGNOTE[11:51:57,027]: finish(): Checking pid 2867 (watchpidlist): (already gone)
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
DEBUGNOTE[11:51:57,074]: Removing container x11docker_X120_erichough-kodi_21115028676
    Error: No such container: x11docker_X120_erichough-kodi_21115028676
DEBUGNOTE[11:51:57,106]: termpid(): Terminating 2891 (watchmessagefifo):    2891 pts/0    00:00:00 bash
/usr/bin/x11docker: line 920:  2891 Terminated              watchmessagefifo
DEBUGNOTE[11:51:57,219]: x11docker exit code: 64
root@KODI:~# 

or:

x11docker --gpu --pulseaudio --hostdisplay --debug erichough/kodi
root@KODI:~# **x11docker --gpu --pulseaudio --hostdisplay --debug erichough/kodi**
DEBUGNOTE[11:52:43,059]: check_host(): ps can watch root processes: yes
DEBUGNOTE[11:52:43,110]: 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[11:52:43,279]: storeinfo(): cache=/root/.cache/x11docker/erichough-kodi-21162997100
DEBUGNOTE[11:52:43,285]: storeinfo(): stdout=/root/.cache/x11docker/erichough-kodi-21162997100/share/stdout
DEBUGNOTE[11:52:43,292]: storeinfo(): stderr=/root/.cache/x11docker/erichough-kodi-21162997100/share/stderr
DEBUGNOTE[11:52:43,317]: storeinfo(): x11dockerpid=4274
DEBUGNOTE[11:52:43,359]: 
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' '--gpu' '--pulseaudio' '--hostdisplay' '--debug' 'erichough/kodi' 
Parsed options:     --gpu --pulseaudio '' --hostdisplay --debug -- 'erichough/kodi'
x11docker note: --hostdisplay needs a running X server. DISPLAY is empty.

DEBUGNOTE[11:52:43,364]: Dependency check for --hostdisplay: 1
DEBUGNOTE[11:52:44,585]: --xpra needs a running X server. DISPLAY is empty. Wayland support is experimental option.
DEBUGNOTE[11:52:44,590]: --xpra does not support hardware acceleration (option --gpu).
DEBUGNOTE[11:52:44,593]: Dependency check for --xpra: 1
DEBUGNOTE[11:52:44,598]: Dependency check for --weston-xwayland: 0
DEBUGNOTE[11:52:44,602]: Dependencies of --weston-xwayland already checked: 0 
DEBUGNOTE[11:52:44,606]: Dependencies of --weston-xwayland already checked: 0 
x11docker note: Using X server option --weston-xwayland

DEBUGNOTE[11:52:44,609]: storeinfo(): xserver=--weston-xwayland
x11docker WARNING: Option --gpu degrades container isolation.
  Container gains access to GPU hardware.
  This allows reading host window content (palinopsia leak)
  and GPU rootkits (compare proof of concept: jellyfish).

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

DEBUGNOTE[11:52:44,630]: container user: root 0:0 /root
DEBUGNOTE[11:52:44,655]: waitforlogentry(): tailstderr: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:52:44,655]: waitforlogentry(): tailstdout: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:52:44,671]: storepid(): Stored pid '4845' of 'watchpidlist':    4845 pts/0    00:00:00 bash
DEBUGNOTE[11:52:44,691]: storepid(): Stored pid '4865' of 'watchmessagefifo':    4865 pts/0    00:00:00 bash
x11docker WARNING: Option --pulseaudio allows container applications
  to catch your audio output and microphone input.

Connection failure: Connection refused
pa_context_connect() failed: Connection refused
DEBUGNOTE[11:52:44,748]: traperror: Command at Line 9033 returned with error code 1:
  pactl load-module module-native-protocol-unix socket=/root/.cache/x11docker/erichough-kodi-21162997100/share/pulseaudio.socket 2>&1
  1951 - ::unpriv::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:52:44,753]: storeinfo(): error=64
DEBUGNOTE[11:52:44,759]: time to say goodbye (traperror)
DEBUGNOTE[11:52:44,764]: traperror: Command at Line 9033 returned with error code 1:
  $Unpriv "${1:-}"
  1951 - ::unpriv::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:52:44,768]: storeinfo(): error=64
DEBUGNOTE[11:52:44,777]: time to say goodbye (traperror)
DEBUGNOTE[11:52:44,781]: traperror: Command at Line 1951 returned with error code 1:
  $Unpriv "${1:-}"
  9114 - ::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:52:44,786]: storeinfo(): error=64
DEBUGNOTE[11:52:44,797]: time to say goodbye (traperror)
DEBUGNOTE[11:52:44,802]: traperror: Command at Line 1951 returned with error code 1:
  Pulseaudiomoduleid="$(unpriv "pactl load-module module-native-protocol-unix socket=$Pulseaudiosocket 2>&1")"
  9114 - ::setup_sound_pulseaudio::main::main
DEBUGNOTE[11:52:44,805]: storeinfo(): error=64
DEBUGNOTE[11:52:44,814]: time to say goodbye (traperror)
DEBUGNOTE[11:52:44,818]: storeinfo(): pulseaudiomoduleid=Connection failure: Connection refused
pa_context_connect() failed: Connection refused
DEBUGNOTE[11:52:44,887]: storeinfo(): DISPLAY=:121
DEBUGNOTE[11:52:44,898]: storeinfo(): XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21162997100/share/Xauthority.client
DEBUGNOTE[11:52:44,904]: storeinfo(): XSOCKET=/tmp/.X11-unix/X121
DEBUGNOTE[11:52:44,910]: storeinfo(): WAYLAND_DISPLAY=wayland-121
DEBUGNOTE[11:52:44,917]: storeinfo(): XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:52:44,925]: storeinfo(): Xenv= DISPLAY=:121 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21162997100/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X121 WAYLAND_DISPLAY=wayland-121 XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:52:44,947]: X server command:
  /usr/bin/Xwayland :121  \
  -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-21162997100/Xauthority.server \
  -nolisten tcp \
  
DEBUGNOTE[11:52:44,951]: Compositor command:
  weston \
  --socket=wayland-121 \
  --backend=drm-backend.so \
  --config='/root/.cache/x11docker/erichough-kodi-21162997100/weston.ini'
DEBUGNOTE[11:52:44,998]: storeinfo(): tini=/usr/bin/docker-init
DEBUGNOTE[11:52:45,008]: 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:                          yes
  Running on console:                             yes
  Running over SSH:                               no
  Running sourced:                                no
  bash $-:                                        huBE
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[11:52:45,017]: storeinfo(): containername=x11docker_X121_erichough-kodi_21162997100
DEBUGNOTE[11:52:45,169]: waitforlogentry(): tailstderr: Stopped waiting for x11docker=ready in store.info due to terminating signal.
x11docker WARNING: Sharing device file: /dev/dri

DEBUGNOTE[11:52:45,177]: waitforlogentry(): tailstdout: Stopped waiting for x11docker=ready in store.info due to terminating signal.
DEBUGNOTE[11:52:45,242]: docker command:
  docker run --detach --tty \
  --name x11docker_X121_erichough-kodi_21162997100 \
  --user 0:0 \
  --userns=host \
  --group-add 44 \
  --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-21162997100/share':'/x11docker':rw \
  --device '/dev/dri':'/dev/dri':rw \
  --volume '/tmp/.X11-unix/X121':'/X121':rw \
  --volume /root/.cache/x11docker/erichough-kodi-21162997100/pulseaudio.client.conf:/etc/pulse/client.conf:ro \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xauthority.client' \
  --env 'DISPLAY=:121' \
  --env 'PULSE_COOKIE=/x11docker/pulseaudio.cookie' \
  --env 'PULSE_SERVER=unix:/x11docker/pulseaudio.socket' \
  --env 'USER=root' \
  -- erichough/kodi /usr/local/bin/init -- /bin/sh - /x11docker/containerrc
DEBUGNOTE[11:52:45,486]: storepid(): Stored pid '5725' of 'containershell':    5725 pts/0    00:00:00 bash
DEBUGNOTE[11:52:45,496]: Running xtermrc: Ask for password if needed (no)
DEBUGNOTE[11:52:45,507]: waitforlogentry(): start_xserver(): Waiting for logentry "readyforX=ready" in store.info
DEBUGNOTE[11:52:45,519]: Running dockerrc: Setup as root or as user docker on host.
DEBUGNOTE[11:52:45,550]: dockerrc: Found default container Runtime: runc
DEBUGNOTE[11:52:45,564]: dockerrc: All  Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
DEBUGNOTE[11:52:45,587]: dockerrc: Container Runtime: UNDECLARED_RUNTIME
DEBUGNOTE[11:52:45,601]: storeinfo(): runtime=UNDECLARED_RUNTIME
DEBUGNOTE[11:52:45,609]: waitforlogentry(): start_docker(): Waiting for logentry "dockerrc=ready" in store.info
DEBUGNOTE[11:52:45,614]: storeinfo(): xtermrc=ready
DEBUGNOTE[11:52:45,661]: time to say goodbye (watchpidlist)
DEBUGNOTE[11:52:46,033]: waitforlogentry(): start_xserver(): Stopped waiting for readyforX=ready in store.info due to terminating signal.
DEBUGNOTE[11:52:46,038]: traperror: Command at Line 9257 returned with error code 1:
  return 1
  9271 - ::main::main
DEBUGNOTE[11:52:46,041]: storeinfo(): error=64
DEBUGNOTE[11:52:46,052]: time to say goodbye (traperror)
DEBUGNOTE[11:52:46,057]: time to say goodbye (main)
DEBUGNOTE[11:52:46,064]: Terminating x11docker.
DEBUGNOTE[11:52:46,069]: time to say goodbye (finish)
DEBUGNOTE[11:52:46,095]: finish(): Checking pid 5725 (containershell):    5725 pts/0    00:00:00 bash
DEBUGNOTE[11:52:46,105]: termpid(): Terminating 5725 (containershell):    5725 pts/0    00:00:00 bash
/usr/bin/x11docker: line 920:  5725 Terminated              { trap '' SIGINT; case $X11dockermode in 
    run)
        start_docker
    ;;
    exe)
        start_hostexe
    ;;
esac; Pid1pid="$(storeinfo dump pid1pid)"; case $X11dockermode in 
    run)
        case "$Winsubsystem" in 
            "")
                setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
            ;;
            *)
                setonwatchpidlist "CONTAINER$Containername"
            ;;
        esac
    ;;
    exe)
        setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
    ;;
esac; case $Xserver in 
    --tty | --hostdisplay | --hostwayland | --weston | --kwin)

    ;;
    *)
        Xinitpid="$(pgrep -a xinit 2>/dev/null | grep "xinit $Xinitrc" | awk '{print $1}')"; checkpid "$Xinitpid" && setonwatchpidlist $Xinitpid xinit; echo $Xcommand | grep -q Xorgwrapper && Line="Xorg $Newdisplay" || Line="$(head -n1 <<< "$Xcommand" | tr -d '\\')"; Xserverpid=$(ps aux | rmcr | grep "$(echo "${Line:-nothingtolookfor}" | cut -d' ' -f1-2)" | grep -v grep | grep -v xinit | awk '{print $2}'); checkpid "$Xserverpid" && setonwatchpidlist "$Xserverpid" Xserver
    ;;
esac; [ "$Pulseaudiomode" = "tcp" ] && start_pulseaudiotcp; checkpid "$Pid1pid" && debugnote "Process tree of ${Hostexe:-container}: (maybe not complete yet)
$(pstree -cp $Pid1pid 2>&1 ||:)"; debugnote "Process tree of x11docker:
$(pstree -p $$ 2>&1 ||:)
  $(storepid test dockerstopshell && echo "Lost child of dockerrc (dockerstopshell):
    $(pstree -p $(storepid dump dockerstopshell) 2>&1 ||:)")"; debugnote "storeinfo(): Stored info:
$(cat $Storeinfofile)"; debugnote "storepid(): Stored pids:
$(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 "x11docker=ready"; } 0<&0
DEBUGNOTE[11:52:46,219]: finish(): Checking pid 4865 (watchmessagefifo):    4865 pts/0    00:00:00 bash
DEBUGNOTE[11:52:46,234]: finish(): Checking pid 4845 (watchpidlist): (already gone)
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
DEBUGNOTE[11:52:46,284]: Removing container x11docker_X121_erichough-kodi_21162997100
    Error: No such container: x11docker_X121_erichough-kodi_21162997100
DEBUGNOTE[11:52:46,306]: termpid(): Terminating 4865 (watchmessagefifo):    4865 pts/0    00:00:00 bash
/usr/bin/x11docker: line 920:  4865 Terminated              watchmessagefifo
DEBUGNOTE[11:52:46,419]: x11docker exit code: 64
root@KODI:~# 

@mviereck
Copy link
Owner

mviereck commented Oct 6, 2021

It seems there is a pulseaudio issue that causes x11docker to fail in debug mode.
Please try without --pulseaudio:

x11docker --gpu --weston-xwayland --debug erichough/kodi
x11docker --gpu --hostdisplay --debug erichough/kodi

@RobertusIT
Copy link
Author

It seems there is a pulseaudio issue that causes x11docker to fail in debug mode. Please try without --pulseaudio:

x11docker --gpu --weston-xwayland --debug erichough/kodi
KODI login: root
Password: 
Last login: Wed Oct  6 11:51:50 UTC 2021 on lxc/tty1
run-parts: /etc/update-motd.d/98-fsck-at-reboot exited with return code 1
root@KODI:~# **x11docker --gpu --weston-xwayland --debug erichough/kodi**
DEBUGNOTE[11:58:38,477]: check_host(): ps can watch root processes: yes
DEBUGNOTE[11:58:38,505]: 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[11:58:38,672]: storeinfo(): cache=/root/.cache/x11docker/erichough-kodi-21518384349
DEBUGNOTE[11:58:38,679]: storeinfo(): stdout=/root/.cache/x11docker/erichough-kodi-21518384349/share/stdout
DEBUGNOTE[11:58:38,685]: storeinfo(): stderr=/root/.cache/x11docker/erichough-kodi-21518384349/share/stderr
DEBUGNOTE[11:58:38,705]: storeinfo(): x11dockerpid=3161
DEBUGNOTE[11:58:38,746]: 
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' '--gpu' '--weston-xwayland' '--debug' 'erichough/kodi' 
Parsed options:     --gpu --weston-xwayland --debug -- 'erichough/kodi'
DEBUGNOTE[11:58:38,753]: Dependency check for --weston-xwayland: 0
DEBUGNOTE[11:58:38,758]: Dependencies of --weston-xwayland already checked: 0 
DEBUGNOTE[11:58:38,762]: Dependencies of --weston-xwayland already checked: 0 
DEBUGNOTE[11:58:38,768]: storeinfo(): xserver=--weston-xwayland
x11docker WARNING: Option --gpu degrades container isolation.
  Container gains access to GPU hardware.
  This allows reading host window content (palinopsia leak)
  and GPU rootkits (compare proof of concept: jellyfish).

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

DEBUGNOTE[11:58:38,795]: container user: root 0:0 /root
DEBUGNOTE[11:58:38,819]: waitforlogentry(): tailstdout: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:58:38,822]: waitforlogentry(): tailstderr: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:58:38,833]: storepid(): Stored pid '3663' of 'watchpidlist':    3663 pts/0    00:00:00 bash
DEBUGNOTE[11:58:38,844]: storepid(): Stored pid '3684' of 'watchmessagefifo':    3684 pts/0    00:00:00 bash
DEBUGNOTE[11:58:38,915]: storeinfo(): DISPLAY=:123
DEBUGNOTE[11:58:38,922]: storeinfo(): XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21518384349/share/Xauthority.client
DEBUGNOTE[11:58:38,928]: storeinfo(): XSOCKET=/tmp/.X11-unix/X123
DEBUGNOTE[11:58:38,934]: storeinfo(): WAYLAND_DISPLAY=wayland-123
DEBUGNOTE[11:58:38,942]: storeinfo(): XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:58:38,948]: storeinfo(): Xenv= DISPLAY=:123 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21518384349/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X123 WAYLAND_DISPLAY=wayland-123 XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:58:39,135]: X server command:
  /usr/bin/Xwayland :123  \
  -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-21518384349/Xauthority.server \
  -nolisten tcp \
  
DEBUGNOTE[11:58:39,140]: Compositor command:
  weston \
  --socket=wayland-123 \
  --backend=drm-backend.so \
  --config='/root/.cache/x11docker/erichough-kodi-21518384349/weston.ini'
DEBUGNOTE[11:58:39,188]: storeinfo(): tini=/usr/bin/docker-init
DEBUGNOTE[11:58:39,195]: 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:                          yes
  Running on console:                             yes
  Running over SSH:                               no
  Running sourced:                                no
  bash $-:                                        huBE
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[11:58:39,201]: storeinfo(): containername=x11docker_X123_erichough-kodi_21518384349
x11docker WARNING: Sharing device file: /dev/dri

DEBUGNOTE[11:58:39,415]: docker command:
  docker run --detach --tty \
  --name x11docker_X123_erichough-kodi_21518384349 \
  --user 0:0 \
  --userns=host \
  --group-add 44 \
  --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-21518384349/share':'/x11docker':rw \
  --device '/dev/dri':'/dev/dri':rw \
  --volume '/tmp/.X11-unix/X123':'/X123':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xauthority.client' \
  --env 'DISPLAY=:123' \
  --env 'USER=root' \
  -- erichough/kodi /usr/local/bin/init -- /bin/sh - /x11docker/containerrc
DEBUGNOTE[11:58:39,656]: storepid(): Stored pid '4380' of 'containershell':    4380 pts/0    00:00:00 bash
DEBUGNOTE[11:58:39,663]: Running xtermrc: Ask for password if needed (no)
DEBUGNOTE[11:58:39,682]: waitforlogentry(): start_xserver(): Waiting for logentry "readyforX=ready" in store.info
DEBUGNOTE[11:58:39,696]: Running dockerrc: Setup as root or as user docker on host.
DEBUGNOTE[11:58:39,727]: dockerrc: Found default container Runtime: runc
DEBUGNOTE[11:58:39,744]: dockerrc: All  Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
DEBUGNOTE[11:58:39,763]: dockerrc: Container Runtime: UNDECLARED_RUNTIME
DEBUGNOTE[11:58:39,779]: storeinfo(): runtime=UNDECLARED_RUNTIME
DEBUGNOTE[11:58:39,839]: dockerrc: Image architecture: amd64
DEBUGNOTE[11:58:39,864]: dockerrc: Image CMD: 
DEBUGNOTE[11:58:39,879]: dockerrc: Image USER: 
DEBUGNOTE[11:58:39,906]: storeinfo(): containeruser=root
DEBUGNOTE[11:58:39,924]: dockerrc: Image ENTRYPOINT: /usr/local/bin/entrypoint.sh
DEBUGNOTE[11:58:39,936]: dockerrc: Image WORKDIR: 
DEBUGNOTE[11:58:39,949]: storeinfo(): readyforX=ready
DEBUGNOTE[11:58:39,959]: waitforlogentry(): dockerrc: Waiting for logentry "xinitrc is ready" in xinit.log
DEBUGNOTE[11:58:40,218]: waitforlogentry(): start_xserver(): Found log entry "readyforX=ready" in store.info.
DEBUGNOTE[11:58:40,228]: storeinfo(): compositorpid=4746
DEBUGNOTE[11:58:40,243]: waitforlogentry(): start_compositor(): Waiting for logentry "weston-desktop-shell" in compositor.log

x11docker ERROR: waitforlogentry(): start_compositor(): Found error message in logfile.
  Last lines of logfile compositor.log:
[11:58:40.233] Using config file '/root/.cache/x11docker/erichough-kodi-21518384349/weston.ini'
[11:58:40.233] Output repaint window is 7 ms maximum.
[11:58:40.233] Loading module '/usr/lib/x86_64-linux-gnu/libweston-3/drm-backend.so'
[11:58:40.234] initializing drm backend
[11:58:40.234] logind: failed to get session seat
[11:58:40.234] logind: cannot setup systemd-logind helper (-61), using legacy fallback
[11:58:40.234] <stdin> not a vt
[11:58:40.234] if running weston from ssh, use --tty to specify a tty
[11:58:40.234] fatal: drm backend should be run using weston-launch binary or as root
[11:58:40.234] fatal: failed to create compositor backend

  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[11:58:40,761]: time to say goodbye (error)
DEBUGNOTE[11:58:40,766]: storeinfo(): error=64
DEBUGNOTE[11:58:40,774]: Terminating x11docker.
DEBUGNOTE[11:58:40,778]: time to say goodbye (finish)
DEBUGNOTE[11:58:40,793]: finish(): Checking pid 4380 (containershell):    4380 pts/0    00:00:00 bash
DEBUGNOTE[11:58:40,802]: termpid(): Terminating 4380 (containershell):    4380 pts/0    00:00:00 bash
DEBUGNOTE[11:58:40,827]: time to say goodbye (watchpidlist)
DEBUGNOTE[11:58:40,861]: waitforlogentry(): tailstderr: Stopped waiting for x11docker=ready in store.info due to terminating signal.
DEBUGNOTE[11:58:40,863]: waitforlogentry(): tailstdout: Stopped waiting for x11docker=ready in store.info due to terminating signal.
/usr/bin/x11docker: line 920:  4380 Terminated              { trap '' SIGINT; case $X11dockermode in 
    run)
        start_docker
    ;;
    exe)
        start_hostexe
    ;;
esac; Pid1pid="$(storeinfo dump pid1pid)"; case $X11dockermode in 
    run)
        case "$Winsubsystem" in 
            "")
                setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
            ;;
            *)
                setonwatchpidlist "CONTAINER$Containername"
            ;;
        esac
    ;;
    exe)
        setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
    ;;
esac; case $Xserver in 
    --tty | --hostdisplay | --hostwayland | --weston | --kwin)

    ;;
    *)
        Xinitpid="$(pgrep -a xinit 2>/dev/null | grep "xinit $Xinitrc" | awk '{print $1}')"; checkpid "$Xinitpid" && setonwatchpidlist $Xinitpid xinit; echo $Xcommand | grep -q Xorgwrapper && Line="Xorg $Newdisplay" || Line="$(head -n1 <<< "$Xcommand" | tr -d '\\')"; Xserverpid=$(ps aux | rmcr | grep "$(echo "${Line:-nothingtolookfor}" | cut -d' ' -f1-2)" | grep -v grep | grep -v xinit | awk '{print $2}'); checkpid "$Xserverpid" && setonwatchpidlist "$Xserverpid" Xserver
    ;;
esac; [ "$Pulseaudiomode" = "tcp" ] && start_pulseaudiotcp; checkpid "$Pid1pid" && debugnote "Process tree of ${Hostexe:-container}: (maybe not complete yet)
$(pstree -cp $Pid1pid 2>&1 ||:)"; debugnote "Process tree of x11docker:
$(pstree -p $$ 2>&1 ||:)
  $(storepid test dockerstopshell && echo "Lost child of dockerrc (dockerstopshell):
    $(pstree -p $(storepid dump dockerstopshell) 2>&1 ||:)")"; debugnote "storeinfo(): Stored info:
$(cat $Storeinfofile)"; debugnote "storepid(): Stored pids:
$(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 "x11docker=ready"; } 0<&0
DEBUGNOTE[11:58:40,919]: finish(): Checking pid 3684 (watchmessagefifo):    3684 pts/0    00:00:00 bash
DEBUGNOTE[11:58:40,935]: finish(): Checking pid 3663 (watchpidlist): (already gone)
DEBUGNOTE[11:58:40,961]: waitforlogentry(): dockerrc: Stopped waiting for xinitrc is ready in xinit.log due to terminating signal.
DEBUGNOTE[11:58:40,988]: dockerrc: Command at Line 545 returned with error code 1: 
  return 1 
  0 - ::main
DEBUGNOTE[11:58:40,990]: Removing container x11docker_X123_erichough-kodi_21518384349
    Error: No such container: x11docker_X123_erichough-kodi_21518384349
DEBUGNOTE[11:58:41,007]: time to say goodbye (dockerrc-traperror)
DEBUGNOTE[11:58:41,023]: storeinfo(): xtermrc=ready
DEBUGNOTE[11:58:41,027]: termpid(): Terminating 3684 (watchmessagefifo):    3684 pts/0    00:00:00 bash
/usr/bin/x11docker: line 920:  3684 Terminated              watchmessagefifo
DEBUGNOTE[11:58:41,144]: x11docker exit code: 64
root@KODI:~# 
x11docker --gpu --hostdisplay --debug erichough/kodi
root@KODI:~# x11docker --gpu --hostdisplay --debug erichough/kodi
DEBUGNOTE[11:59:21,786]: check_host(): ps can watch root processes: yes
DEBUGNOTE[11:59:21,815]: 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[11:59:21,997]: storeinfo(): cache=/root/.cache/x11docker/erichough-kodi-21561714189
DEBUGNOTE[11:59:22,004]: storeinfo(): stdout=/root/.cache/x11docker/erichough-kodi-21561714189/share/stdout
DEBUGNOTE[11:59:22,014]: storeinfo(): stderr=/root/.cache/x11docker/erichough-kodi-21561714189/share/stderr
DEBUGNOTE[11:59:22,035]: storeinfo(): x11dockerpid=5059
DEBUGNOTE[11:59:22,082]: 
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' '--gpu' '--hostdisplay' '--debug' 'erichough/kodi' 
Parsed options:     --gpu --hostdisplay --debug -- 'erichough/kodi'
x11docker note: --hostdisplay needs a running X server. DISPLAY is empty.

DEBUGNOTE[11:59:22,088]: Dependency check for --hostdisplay: 1
DEBUGNOTE[11:59:23,294]: --xpra needs a running X server. DISPLAY is empty. Wayland support is experimental option.
DEBUGNOTE[11:59:23,298]: --xpra does not support hardware acceleration (option --gpu).
DEBUGNOTE[11:59:23,302]: Dependency check for --xpra: 1
DEBUGNOTE[11:59:23,306]: Dependency check for --weston-xwayland: 0
DEBUGNOTE[11:59:23,311]: Dependencies of --weston-xwayland already checked: 0 
DEBUGNOTE[11:59:23,318]: Dependencies of --weston-xwayland already checked: 0 
x11docker note: Using X server option --weston-xwayland

DEBUGNOTE[11:59:23,325]: storeinfo(): xserver=--weston-xwayland
x11docker WARNING: Option --gpu degrades container isolation.
  Container gains access to GPU hardware.
  This allows reading host window content (palinopsia leak)
  and GPU rootkits (compare proof of concept: jellyfish).

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

DEBUGNOTE[11:59:23,360]: container user: root 0:0 /root
DEBUGNOTE[11:59:23,389]: waitforlogentry(): tailstderr: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:59:23,396]: waitforlogentry(): tailstdout: Waiting for logentry "x11docker=ready" in store.info
DEBUGNOTE[11:59:23,411]: storepid(): Stored pid '5629' of 'watchpidlist':    5629 pts/0    00:00:00 bash
DEBUGNOTE[11:59:23,424]: storepid(): Stored pid '5650' of 'watchmessagefifo':    5650 pts/0    00:00:00 bash
DEBUGNOTE[11:59:23,546]: storeinfo(): DISPLAY=:124
DEBUGNOTE[11:59:23,555]: storeinfo(): XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21561714189/share/Xauthority.client
DEBUGNOTE[11:59:23,565]: storeinfo(): XSOCKET=/tmp/.X11-unix/X124
DEBUGNOTE[11:59:23,576]: storeinfo(): WAYLAND_DISPLAY=wayland-124
DEBUGNOTE[11:59:23,588]: storeinfo(): XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:59:23,602]: storeinfo(): Xenv= DISPLAY=:124 XAUTHORITY=/root/.cache/x11docker/erichough-kodi-21561714189/share/Xauthority.client XSOCKET=/tmp/.X11-unix/X124 WAYLAND_DISPLAY=wayland-124 XDG_RUNTIME_DIR=/run/user/0
DEBUGNOTE[11:59:23,641]: X server command:
  /usr/bin/Xwayland :124  \
  -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-21561714189/Xauthority.server \
  -nolisten tcp \
  
DEBUGNOTE[11:59:23,647]: Compositor command:
  weston \
  --socket=wayland-124 \
  --backend=drm-backend.so \
  --config='/root/.cache/x11docker/erichough-kodi-21561714189/weston.ini'
DEBUGNOTE[11:59:23,723]: storeinfo(): tini=/usr/bin/docker-init
DEBUGNOTE[11:59:23,735]: 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:                          yes
  Running on console:                             yes
  Running over SSH:                               no
  Running sourced:                                no
  bash $-:                                        huBE
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[11:59:23,743]: storeinfo(): containername=x11docker_X124_erichough-kodi_21561714189
x11docker WARNING: Sharing device file: /dev/dri

DEBUGNOTE[11:59:23,995]: docker command:
  docker run --detach --tty \
  --name x11docker_X124_erichough-kodi_21561714189 \
  --user 0:0 \
  --userns=host \
  --group-add 44 \
  --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-21561714189/share':'/x11docker':rw \
  --device '/dev/dri':'/dev/dri':rw \
  --volume '/tmp/.X11-unix/X124':'/X124':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xauthority.client' \
  --env 'DISPLAY=:124' \
  --env 'USER=root' \
  -- erichough/kodi /usr/local/bin/init -- /bin/sh - /x11docker/containerrc
DEBUGNOTE[11:59:24,383]: storepid(): Stored pid '6352' of 'containershell':    6352 pts/0    00:00:00 bash
DEBUGNOTE[11:59:24,414]: Running xtermrc: Ask for password if needed (no)
DEBUGNOTE[11:59:24,403]: waitforlogentry(): start_xserver(): Waiting for logentry "readyforX=ready" in store.info
DEBUGNOTE[11:59:24,441]: Running dockerrc: Setup as root or as user docker on host.
DEBUGNOTE[11:59:24,471]: dockerrc: Found default container Runtime: runc
DEBUGNOTE[11:59:24,529]: dockerrc: All  Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
DEBUGNOTE[11:59:24,549]: dockerrc: Container Runtime: UNDECLARED_RUNTIME
DEBUGNOTE[11:59:24,576]: storeinfo(): runtime=UNDECLARED_RUNTIME
DEBUGNOTE[11:59:24,612]: dockerrc: Image architecture: amd64
DEBUGNOTE[11:59:24,685]: dockerrc: Image CMD: 
DEBUGNOTE[11:59:24,716]: dockerrc: Image USER: 
DEBUGNOTE[11:59:24,733]: storeinfo(): containeruser=root
DEBUGNOTE[11:59:24,745]: dockerrc: Image ENTRYPOINT: /usr/local/bin/entrypoint.sh
DEBUGNOTE[11:59:24,755]: dockerrc: Image WORKDIR: 
DEBUGNOTE[11:59:24,766]: storeinfo(): readyforX=ready
DEBUGNOTE[11:59:24,778]: waitforlogentry(): dockerrc: Waiting for logentry "xinitrc is ready" in xinit.log
DEBUGNOTE[11:59:24,943]: waitforlogentry(): start_xserver(): Found log entry "readyforX=ready" in store.info.
DEBUGNOTE[11:59:24,951]: storeinfo(): compositorpid=6726
DEBUGNOTE[11:59:24,969]: waitforlogentry(): start_compositor(): Waiting for logentry "weston-desktop-shell" in compositor.log

x11docker ERROR: waitforlogentry(): start_compositor(): Found error message in logfile.
  Last lines of logfile compositor.log:
[11:59:24.955] Using config file '/root/.cache/x11docker/erichough-kodi-21561714189/weston.ini'
[11:59:24.955] Output repaint window is 7 ms maximum.
[11:59:24.955] Loading module '/usr/lib/x86_64-linux-gnu/libweston-3/drm-backend.so'
[11:59:24.956] initializing drm backend
[11:59:24.956] logind: failed to get session seat
[11:59:24.956] logind: cannot setup systemd-logind helper (-61), using legacy fallback
[11:59:24.956] <stdin> not a vt
[11:59:24.956] if running weston from ssh, use --tty to specify a tty
[11:59:24.956] fatal: drm backend should be run using weston-launch binary or as root
[11:59:24.956] fatal: failed to create compositor backend

  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[11:59:25,486]: time to say goodbye (error)
DEBUGNOTE[11:59:25,490]: storeinfo(): error=64
DEBUGNOTE[11:59:25,498]: Terminating x11docker.
DEBUGNOTE[11:59:25,502]: time to say goodbye (finish)
DEBUGNOTE[11:59:25,520]: finish(): Checking pid 6352 (containershell):    6352 pts/0    00:00:00 bash
DEBUGNOTE[11:59:25,532]: termpid(): Terminating 6352 (containershell):    6352 pts/0    00:00:00 bash
/usr/bin/x11docker: line 920:  6352 Terminated              { trap '' SIGINT; case $X11dockermode in 
    run)
        start_docker
    ;;
    exe)
        start_hostexe
    ;;
esac; Pid1pid="$(storeinfo dump pid1pid)"; case $X11dockermode in 
    run)
        case "$Winsubsystem" in 
            "")
                setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
            ;;
            *)
                setonwatchpidlist "CONTAINER$Containername"
            ;;
        esac
    ;;
    exe)
        setonwatchpidlist "${Pid1pid:-NOPID}" pid1pid
    ;;
esac; case $Xserver in 
    --tty | --hostdisplay | --hostwayland | --weston | --kwin)

    ;;
    *)
        Xinitpid="$(pgrep -a xinit 2>/dev/null | grep "xinit $Xinitrc" | awk '{print $1}')"; checkpid "$Xinitpid" && setonwatchpidlist $Xinitpid xinit; echo $Xcommand | grep -q Xorgwrapper && Line="Xorg $Newdisplay" || Line="$(head -n1 <<< "$Xcommand" | tr -d '\\')"; Xserverpid=$(ps aux | rmcr | grep "$(echo "${Line:-nothingtolookfor}" | cut -d' ' -f1-2)" | grep -v grep | grep -v xinit | awk '{print $2}'); checkpid "$Xserverpid" && setonwatchpidlist "$Xserverpid" Xserver
    ;;
esac; [ "$Pulseaudiomode" = "tcp" ] && start_pulseaudiotcp; checkpid "$Pid1pid" && debugnote "Process tree of ${Hostexe:-container}: (maybe not complete yet)
$(pstree -cp $Pid1pid 2>&1 ||:)"; debugnote "Process tree of x11docker:
$(pstree -p $$ 2>&1 ||:)
  $(storepid test dockerstopshell && echo "Lost child of dockerrc (dockerstopshell):
    $(pstree -p $(storepid dump dockerstopshell) 2>&1 ||:)")"; debugnote "storeinfo(): Stored info:
$(cat $Storeinfofile)"; debugnote "storepid(): Stored pids:
$(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 "x11docker=ready"; } 0<&0
DEBUGNOTE[11:59:25,652]: finish(): Checking pid 5650 (watchmessagefifo):    5650 pts/0    00:00:00 bash
DEBUGNOTE[11:59:25,671]: finish(): Checking pid 5629 (watchpidlist):    5629 pts/0    00:00:00 bash
DEBUGNOTE[11:59:25,692]: termpid(): Terminating 5629 (watchpidlist):    5629 pts/0    00:00:00 bash
DEBUGNOTE[11:59:25,757]: waitforlogentry(): dockerrc: Stopped waiting for xinitrc is ready in xinit.log due to terminating signal.
DEBUGNOTE[11:59:25,770]: dockerrc: Command at Line 545 returned with error code 1: 
  return 1 
  0 - ::main
DEBUGNOTE[11:59:25,780]: time to say goodbye (dockerrc-traperror)
DEBUGNOTE[11:59:25,789]: storeinfo(): xtermrc=ready
/usr/bin/x11docker: line 920:  5629 Terminated              watchpidlist
DEBUGNOTE[11:59:25,835]: Removing container x11docker_X124_erichough-kodi_21561714189
    Error: No such container: x11docker_X124_erichough-kodi_21561714189
DEBUGNOTE[11:59:25,874]: termpid(): Terminating 5650 (watchmessagefifo):    5650 pts/0    00:00:00 bash
DEBUGNOTE[11:59:25,944]: waitforlogentry(): tailstderr: Stopped waiting for x11docker=ready in store.info due to terminating signal.
DEBUGNOTE[11:59:25,949]: waitforlogentry(): tailstdout: Stopped waiting for x11docker=ready in store.info due to terminating signal.
/usr/bin/x11docker: line 920:  5650 Terminated              watchmessagefifo
DEBUGNOTE[11:59:25,987]: x11docker exit code: 64
root@KODI:~# 

@mviereck
Copy link
Owner

mviereck commented Oct 6, 2021

I can't help much here. Those are LXC related issues, and I have no experience at all with LXC.
You could rather ask in a proxmox/LXC community.

@RobertusIT
Copy link
Author

I can't help much here. Those are LXC related issues, and I have no experience at all with LXC. You could rather ask in a proxmox/LXC community.

I have installed in the host, so outside lxc container, Intel GPU top to see GPU usage.

And with kodi in docker, every video started, works, smooth and GPU is busy for that, then after 10 secs, gpu stop to use and cpu come up a lot, so video stuttering, frame drops...

So i have tried to install kodi not in docker in this xubuntu:

apt install software-properties-common
add-apt-repository -y ppa:team-xbmc/ppa
apt install kodi

But same story, GPU accelleration, works for some seconds, then is cutted by someone, and cpu come up, video freeze.

There isn't a debug for that ?

Because before to install docker and kodi in the host ( outside lxc ), i wish to try to have kodi into lxc, not in docker like i try now, but same story, so if there is a debug or log, maybe is possible to fix it ?

Seems that the actual config:

LXC > xubuntu> docker > kodi = gpu works only for 10 seconds, then video freeze and gpu 0%, CPU +90% and video stuttering, frame drops...

So I have tried:

LXC > xubuntu > kodi = same story

So the without a debug, i can say that if the result is the same, to try without others variable:

How can I install kodi into LXC and have output audio video?

LXC can't handle it by yourself, so need to use weston or x11docker ? so kodi need to install anyway in docker ?

I wish to try an installation as clean as possible without xubuntu, to try for the last time, and if doesn't works, I asked you how to follow your suggest, about to install docker into the host ( outside lxc ), and try in this way, like your post

@mviereck
Copy link
Owner

mviereck commented Oct 7, 2021

But same story, GPU accelleration, works for some seconds, then is cutted by someone, and cpu come up, video freeze.
There isn't a debug for that ?

kodi normally prints a lot of messages in terminal. Maybe there is some hint what is going wrong.

How can I install kodi into LXC and have output audio video?

As I said, I can't help you how to set up LXC. I have no experience with it. You should rather ask in a LXC community.

@RobertusIT
Copy link
Author

But same story, GPU accelleration, works for some seconds, then is cutted by someone, and cpu come up, video freeze.
There isn't a debug for that ?

kodi normally prints a lot of messages in terminal. Maybe there is some hint what is going wrong.

How can I install kodi into LXC and have output audio video?

As I said, I can't help you how to set up LXC. I have no experience with it. You should rather ask in a LXC community.

In xubuntu, if i try vainfo, i can see that

root@KODI:~# vainfo    
error: XDG_RUNTIME_DIR not set in the environment.
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns -1
libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
vaInitialize failed with error code -1 (unknown libva error),exit

Maybe can help?

@mviereck
Copy link
Owner

mviereck commented Oct 8, 2021

There has been a ticket that points to an issue regarding VAAPI versions, maybe that helps: ehough/docker-kodi#17

@RobertusIT
Copy link
Author

Just to point out: You try to run a container (docker) within another container (lxc). This causes all the trouble. IMHO it would make more sense to run docker and x11docker outside of LXC. kodi would run in a container anyway.

After a lot of days, weeks, night, waste time without success, i wish to try the last chance, and follow your suggest to install kodi into host directly with docker.

Please can you help me in this way and give exact which command ?

Because if also in this way, i have drop frame and gpu doesn't used, i use kodi into firestick and I'll use my nuc only for proxmox.

@mviereck
Copy link
Owner

mviereck commented Oct 20, 2021

This should work:
Install docker (or podman), x11docker weston xwayland xinit xauth x11-xserver-utils x11-utils (compare https://github.com/mviereck/x11docker/wiki/dependencies).
Get the image: docker pull erichough/kodi
Run: x11docker --gpu --pulseaudio --desktop erichough/kodi
Add if desired e.g.: --fullscreen --home --share ~/Videos.

podman might be a better choice than docker because you can run it rootless and without a system daemon. In that case add --backend=podman and use podman pull erichough/kodi.

@RobertusIT
Copy link
Author

RobertusIT commented Oct 21, 2021

This should work: Install docker (or podman), x11docker weston xwayland xinit xauth x11-xserver-utils x11-utils (compare https://github.com/mviereck/x11docker/wiki/dependencies). Get the image: docker pull erichough/kodi Run: x11docker --gpu --pulseaudio --desktop erichough/kodi Add if desired e.g.: --fullscreen --home --share ~/Videos.

I have installed docker and portainer in the proxmox host, so now if doesn't works here, i leave this project.

Anyway, i can start kodi with:

root@NUC-i3:~# x11docker --gpu --pulseaudio --desktop erichough/kodi

I can see output in hdmi, but i can't move with keyboard and mouse.

I didn't find how to.

This is my output:

root@NUC-i3:~# x11docker --gpu --pulseaudio --desktop erichough/kodi
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: Environment variables DISPLAY and WAYLAND_DISPLAY are empty,
  but it seems x11docker was started within X, not from console.
  Please set DISPLAY and XAUTHORITY.
  If you have started x11docker with su or sudo, su/sudo may be configured to
  unset X environment variables. It may work if you run x11docker with
    sudo -E x11docker [...]
  If your system does not support 'sudo -E', you can try
    sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY x11docker [...]
  Otherwise, you can use tools like gksu/gksudo/kdesu/kdesudo/lxsu/lxsudo.

x11docker note: Using X server option --xorg

x11docker WARNING: Option --gpu degrades container isolation.
  Container gains access to GPU hardware.
  This allows reading host window content (palinopsia leak)
  and GPU rootkits (compare proof of concept: jellyfish).

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.

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 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.

x11docker WARNING: Option --sudouser severely 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.

x11docker WARNING: Sharing device file: /dev/dri

x11docker WARNING: Sharing device file: /dev/vga_arbiter

x11docker WARNING: Sharing device file: /dev/snd

---> starting Kodi with command: kodi-standalone
Connection failure: Connection refused
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
sh: 1: nmblookup: not found
sh: 1: nmblookup: not found
sh: 1: nmblookup: not found
sh: 1: nmblookup: not found
sh: 1: nmblookup: not found
sh: 1: nmblookup: not found
sh: 1: nmblookup: not found
sh: 1: nmblookup: not found
sh: 1: nmblookup: not found

EDIT:

I have installed:

 apt install xserver-xorg-input-evdev
 apt install evtest

And doens't works always mouse and keyboards, but also kodi doesn't start anymore

`root@NUC-i3:~# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      Sleep Button
/dev/input/event1:      Power Button
/dev/input/event2:      Power Button
**/dev/input/event3:        USB Keyboard**
/dev/input/event4:        USB Keyboard System Control
/dev/input/event5:        USB Keyboard Consumer Control
**/dev/input/event6:       USB OPTICAL MOUSE**
/dev/input/event7:      PC Speaker
/dev/input/event8:      Video Bus
/dev/input/event9:      HDA Intel PCH Mic
/dev/input/event10:     HDA Intel PCH Front Headphone
/dev/input/event11:     HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event12:     HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event13:     HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event14:     HDA Intel PCH HDMI/DP,pcm=9
/dev/input/event15:     HDA Intel PCH HDMI/DP,pcm=10`

nano 90-xpra-virtual.conf

Section "InputDevice"
    Identifier "event3"
    Option "Device" "/dev/input/event3"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection

Section "InputDevice"
    Identifier "event6"
    Option "Device" "/dev/input/event6"
    Option "AutoServerLayout" "true"
    Driver "evdev"
EndSection
root@NUC-i3:~# x11docker --gpu --pulseaudio --desktop  erichough/kodi
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: Environment variables DISPLAY and WAYLAND_DISPLAY are empty,
  but it seems x11docker was started within X, not from console.
  Please set DISPLAY and XAUTHORITY.
  If you have started x11docker with su or sudo, su/sudo may be configured to
  unset X environment variables. It may work if you run x11docker with
    sudo -E x11docker [...]
  If your system does not support 'sudo -E', you can try
    sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY x11docker [...]
  Otherwise, you can use tools like gksu/gksudo/kdesu/kdesudo/lxsu/lxsudo.

x11docker note: Using X server option --xorg

x11docker WARNING: Option --gpu degrades container isolation.
  Container gains access to GPU hardware.
  This allows reading host window content (palinopsia leak)
  and GPU rootkits (compare proof of concept: jellyfish).

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.

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 note: To access X on tty13, use command 'chvt 13'

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.

x11docker WARNING: Option --sudouser severely 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.

x11docker WARNING: Sharing device file: /dev/dri

x11docker WARNING: Sharing device file: /dev/vga_arbiter

x11docker WARNING: Sharing device file: /dev/snd


x11docker ERROR: waitforlogentry(): dockerrc: Found error message in logfile. 
  Last lines of logfile xinit.log: 
(EE)  
Fatal server error: 
(EE) no screens found(EE)  
(EE)  
Please consult the The X.Org Foundation support  
         at http://wiki.x.org 
 for help.  
(EE) Please also check the log file at "/var/log/Xorg.127.log" for additional information. 
(EE)  
(EE) Server terminated with error (1). Closing log file.

  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@NUC-i3:~# cat /var/log/Xorg.134.log
[ 20683.002] 
X.Org X Server 1.20.11
X Protocol Version 11, Revision 0
[ 20683.002] Build Operating System: linux Debian
[ 20683.002] Current Operating System: Linux NUC-i3 5.11.22-4-pve #1 SMP PVE 5.11.22-8 (Fri, 27 Aug 2021 11:51:34 +0200) x86_64
[ 20683.002] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.11.22-4-pve root=/dev/mapper/pve-root ro quiet
[ 20683.002] Build Date: 13 April 2021  04:07:31PM
[ 20683.002] xorg-server 2:1.20.11-1 (https://www.debian.org/support) 
[ 20683.002] Current version of pixman: 0.40.0
[ 20683.002]    Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
[ 20683.002] Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 20683.002] (==) Log file: "/var/log/Xorg.134.log", Time: Thu Oct 21 17:17:15 2021
[ 20683.002] (==) Using config directory: "/etc/X11/xorg.conf.d"
[ 20683.002] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[ 20683.003] (==) No Layout section.  Using the first Screen section.
[ 20683.003] (==) No screen section available. Using defaults.
[ 20683.003] (**) |-->Screen "Default Screen Section" (0)
[ 20683.003] (**) |   |-->Monitor "<default monitor>"
[ 20683.003] (==) No device specified for screen "Default Screen Section".
        Using the first device section listed.
[ 20683.003] (**) |   |-->Device "Intel Graphics"
[ 20683.003] (==) No monitor specified for screen "Default Screen Section".
        Using a default monitor configuration.
[ 20683.003] (**) |-->Input Device "event3"
[ 20683.003] (**) |-->Input Device "event6"
[ 20683.003] (==) Automatically adding devices
[ 20683.003] (==) Automatically enabling devices
[ 20683.003] (==) Automatically adding GPU devices
[ 20683.003] (==) Max clients allowed: 256, resource mask: 0x1fffff
[ 20683.003] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[ 20683.003]    Entry deleted from font path.
[ 20683.003] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[ 20683.003]    Entry deleted from font path.
[ 20683.003] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[ 20683.003]    Entry deleted from font path.
[ 20683.003] (WW) The directory "/usr/share/fonts/X11/Type1" does not exist.
[ 20683.003]    Entry deleted from font path.
[ 20683.003] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[ 20683.003]    Entry deleted from font path.
[ 20683.003] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[ 20683.003]    Entry deleted from font path.
[ 20683.003] (==) FontPath set to:
        /usr/share/fonts/X11/misc,
        built-ins
[ 20683.003] (==) ModulePath set to "/usr/lib/xorg/modules"
[ 20683.003] (II) The server relies on udev to provide the list of input devices.
        If no devices become available, reconfigure udev or disable AutoAddDevices.
[ 20683.003] (II) Loader magic: 0x55b28778ee40
[ 20683.003] (II) Module ABI versions:
[ 20683.003]    X.Org ANSI C Emulation: 0.4
[ 20683.003]    X.Org Video Driver: 24.1
[ 20683.003]    X.Org XInput driver : 24.1
[ 20683.003]    X.Org Server Extension : 10.0
[ 20683.003] (++) using VT number 13

[ 20683.003] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[ 20683.004] (II) xfree86: Adding drm device (/dev/dri/card0)
[ 20683.010] (--) PCI:*(0@0:2:0) 8086:3ea5:8086:2074 rev 1, Mem @ 0xbf000000/16777216, 0x80000000/268435456, I/O @ 0x00004000/64, BIOS @ 0x????????/131072
[ 20683.010] (II) LoadModule: "glx"
[ 20683.010] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[ 20683.010] (II) Module glx: vendor="X.Org Foundation"
[ 20683.010]    compiled for 1.20.11, module version = 1.0.0
[ 20683.010]    ABI class: X.Org Server Extension, version 10.0
[ 20683.010] (II) LoadModule: "intel"
[ 20683.010] (WW) Warning, couldn't open module intel
[ 20683.010] (EE) Failed to load module "intel" (module does not exist, 0)
[ 20683.010] (II) LoadModule: "evdev"
[ 20683.011] (WW) Warning, couldn't open module evdev
[ 20683.011] (EE) Failed to load module "evdev" (module does not exist, 0)
[ 20683.011] (EE) No drivers available.
[ 20683.011] (EE) 
Fatal server error:
[ 20683.011] (EE) no screens found(EE) 
[ 20683.011] (EE) 
Please consult the The X.Org Foundation support 
         at http://wiki.x.org
 for help. 
[ 20683.011] (EE) Please also check the log file at "/var/log/Xorg.134.log" for additional information.
[ 20683.011] (EE) 
[ 20683.011] (EE) Server terminated with error (1). Closing log file.`

@mviereck
Copy link
Owner

mviereck commented Oct 23, 2021

Let's have a look at the first messages:

root@NUC-i3:~# x11docker --gpu --pulseaudio --desktop erichough/kodi
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: Environment variables DISPLAY and WAYLAND_DISPLAY are empty,
  but it seems x11docker was started within X, not from console.
  Please set DISPLAY and XAUTHORITY.
  If you have started x11docker with su or sudo, su/sudo may be configured to
  unset X environment variables. It may work if you run x11docker with
    sudo -E x11docker [...]
  If your system does not support 'sudo -E', you can try
    sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY x11docker [...]
  Otherwise, you can use tools like gksu/gksudo/kdesu/kdesudo/lxsu/lxsudo.

x11docker note: Using X server option --xorg

You are running x11docker as root.
But root does not get environment variable DISPLAY although it seems you are running on a graphical desktop. So x11docker tries to use --xorg instead of intended --weston-xwayland.

Are you running on a graphical desktop?
Do you log in first as an unprivileged user and switch to root later?
Could you please run x11docker as unprivileged user, not as root?
Please also check the output of echo $DISPLAY if running on a graphical desktop.

@RobertusIT
Copy link
Author

Let's have a look at the first messages:

root@NUC-i3:~# x11docker --gpu --pulseaudio --desktop erichough/kodi
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: Environment variables DISPLAY and WAYLAND_DISPLAY are empty,
  but it seems x11docker was started within X, not from console.
  Please set DISPLAY and XAUTHORITY.
  If you have started x11docker with su or sudo, su/sudo may be configured to
  unset X environment variables. It may work if you run x11docker with
    sudo -E x11docker [...]
  If your system does not support 'sudo -E', you can try
    sudo env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY x11docker [...]
  Otherwise, you can use tools like gksu/gksudo/kdesu/kdesudo/lxsu/lxsudo.

x11docker note: Using X server option --xorg

You are running x11docker as root. But root does not get environment variable DISPLAY although it seems you are running on a graphical desktop. So x11docker tries to use --xorg instead of intended --weston-xwayland.

Are you running on a graphical desktop? Do you log in first as an unprivileged user and switch to root later? Could you please run x11docker as unprivileged user, not as root? Please also check the output of echo $DISPLAY if running on a graphical desktop.

I didn't use a graphic desktop, infact I'm on ssh into my nuc where is installed proxmox, (host is debian based).

NUC with proxmox, and keyboard and mouse usb, NUC connected via HDMI to a monitor.

With another pc, I use SSH to launch kodi for now.

NUC with proxmox, have by default a proxmox shell, so i can login by root and use shell via HDMI, or by ssh.

Anyway i have tried to launch kodi, also not only via ssh but also via proxmox shell, same issue, i can't move mouse and keyboard.

PXL_20211023_225839764
PXL_20211023_225918129

As you can see from these screenshot, that are proxmox shell via HDMI:

echo $DISPLAY return a blank reply.

Also in ssh same story:

`root@NUC-i3:~# echo $DISPLAY

root@NUC-i3:~# 
`

I guess that there is only root user, maybe i can try to create another user ? ( how can i do that ? )
I make useradd kodi
Then su kodi

root@NUC-i3:~# su kodi
$ x11docker --gpu --pulseaudio --desktop erichough/kodi
mkdir: cannot create directory ‘/home/kodi’: Permission denied

x11docker ERROR: Could not create cache folder
  /home/kodi/.cache/x11docker

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

Maybe because I have installed docker under root.

@mviereck
Copy link
Owner

mviereck commented Oct 24, 2021

Please run further tests directly, not over ssh. ssh can cause issues on its own.

Please show me the output of tty.
Please try to avoid --xorg with:

x11docker --weston-xwayland --gpu --alsa --desktop erichough/kodi

mkdir: cannot create directory ‘/home/kodi’: Permission denied

It seems adduser does not create a home directory for the created user. To fix this, you can run as root: mkdir -p /home/kodi

However, the user (root or unprivileged) wasn't the problem here, I was misleaded by the message x11docker WARNING: Environment variables DISPLAY and WAYLAND_DISPLAY are empty, but it seems x11docker was started within X, not from console.. This was likely caused by the ssh environment.

@RobertusIT
Copy link
Author

RobertusIT commented Oct 25, 2021

Please run further tests directly, not over ssh. ssh can cause issues on its own.

Please show me the output of tty. Please try to avoid --xorg with:

x11docker --weston-xwayland --gpu --alsa --desktop erichough/kodi

mkdir: cannot create directory ‘/home/kodi’: Permission denied

It seems adduser does not create a home directory for the created user. To fix this, you can run as root: mkdir -p /home/kodi

However, the user (root or unprivileged) wasn't the problem here, I was misleaded by the message x11docker WARNING: Environment variables DISPLAY and WAYLAND_DISPLAY are empty, but it seems x11docker was started within X, not from console.. This was likely caused by the ssh environment.
PXL_20211025_221947629

with
x11docker --weston-xwayland --gpu --alsa --desktop erichough/kodi

EDIT:

sorry, please reopen issue.

PXL_20211025_222556140
PXL_20211025_225453547

As you can see from that screen, with --weston-xwayland we have control by mouse and keyboard
But we can't have gpu ( cpu is 100% ) and there are glitch.

@mviereck mviereck reopened this Oct 26, 2021
@RobertusIT
Copy link
Author

Maybe when i launch:
x11docker --weston-xwayland --gpu --alsa --desktop erichough/kodi

Isn't privileged ? So i have glitch and no gpu ?
But from logs seems that it is already. (so maybe isn't the problem)
Maybe is a kernel or driver issue and need to install some package ?

I have va-driver-all installed on host. Need to install it in other place ?

@mviereck
Copy link
Owner

Isn't privileged ? So i have glitch and no gpu ?

x11docker gives enough privileges in the docker command to access the GPU.
The issue must be somewhere else.
Maybe it is an issue of different VAAPI versions on host and in container.

To run some tests, please pull image x11docker/check.
Try:

x11docker --gpu --weston-xwayland -- x11docker/check glxgears

glxgears should show a framerate at about 60 fps.

Try also:

x11docker --gpu --weston-xwayland -- x11docker/check glxspheres64

Please show me the output of:

x11docker --gpu --weston-xwayland -- x11docker/check glxinfo | grep OpenGL

@RobertusIT
Copy link
Author

RobertusIT commented Oct 28, 2021

Isn't privileged ? So i have glitch and no gpu ?

x11docker gives enough privileges in the docker command to access the GPU. The issue must be somewhere else. Maybe it is an issue of different VAAPI versions on host and in container.

To run some tests, please pull image x11docker/check. Try:

x11docker --gpu --weston-xwayland -- x11docker/check glxgears

glxgears should show a framerate at about 60 fps.

Try also:

x11docker --gpu --weston-xwayland -- x11docker/check glxspheres64

Please show me the output of:

x11docker --gpu --weston-xwayland -- x11docker/check glxinfo | grep OpenGL

Works but glitch:

PXL_20211028_103858344
PXL_20211028_103913772

Only in local, if i try to launch in ssh i have an error:

Local:

PXL_20211028_104022939

In ssh:

root@NUC-i3:~# x11docker --gpu --weston-xwayland -- x11docker/check glxinfo | grep OpenGL
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: Option --gpu degrades container isolation.
  Container gains access to GPU hardware.
  This allows reading host window content (palinopsia leak)
  and GPU rootkits (compare proof of concept: jellyfish).

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

x11docker note: Could not determine size of your primary display to
  create a roughly maximized window for --weston-xwayland.
  Please install xrandr or use option --size=XxY.
  Fallback: setting virtual screen size 800x600
  You can look for the package name of this command at:
 https://github.com/mviereck/x11docker/wiki/dependencies#table-of-all-packages

x11docker note: Option --wm: No host window manager found.
    Please install a supported one. Recommended:
  xfwm4 metacity marco openbox sawfish
  Fallback: Setting --wm=none

x11docker WARNING: Option --sudouser severely 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.

x11docker WARNING: Sharing device file: /dev/dri

x11docker WARNING: Sharing device file: /dev/vga_arbiter


x11docker ERROR: waitforlogentry(): start_compositor(): Found error message in logfile.
  Last lines of logfile compositor.log:
[10:42:13.993] weston 5.0.0
               https://wayland.freedesktop.org
               Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
               Build: unknown (not built from git or tarball)
[10:42:13.993] Command line: weston --socket=wayland-106 --backend=x11-backend.so --config=/root/.cache/x11docker/x11docker-check-glxinfo-10532617693/weston.ini
[10:42:13.993] OS: Linux, 5.4.106-1-pve, #1 SMP PVE 5.4.106-1 (Fri, 19 Mar 2021 11:08:47 +0100), x86_64
[10:42:13.993] Using config file '/root/.cache/x11docker/x11docker-check-glxinfo-10532617693/weston.ini'
[10:42:13.993] Output repaint window is 7 ms maximum.
[10:42:13.993] Loading module '/usr/lib/x86_64-linux-gnu/libweston-5/x11-backend.so'
[10:42:13.996] fatal: failed to create compositor backend

  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@NUC-i3:~#

I suspect that there is a problem about GPU HW in the host.

I mean kernel or gpu driver.

I tried to install Libreelec that is a Kodi with under an OS, linux, but you can't have access on it, only in kodi, and works GPU HW.

So you think that I can try to install kodi in the host, outside docker, and see if GPU HW works?

Because maybe if doesn't works, it is the issue , need to be solve. ( I guess )

@mviereck
Copy link
Owner

I suspect that there is a problem about GPU HW in the host.

That is possible. Do you also get the glitches with glxgears?
You could run glxgears on host and compare.
Maybe the hardware is damaged, or maybe the driver has an issue.

@RobertusIT
Copy link
Author

RobertusIT commented Oct 28, 2021

I suspect that there is a problem about GPU HW in the host.

That is possible. Do you also get the glitches with glxgears? You could run glxgears on host and compare. Maybe the hardware is damaged, or maybe the driver has an issue.

dsfdfs.mp4

Seems no trouble with this.

vainfo say that:

`root@NUC-i3:~# vainfo
error: can't connect to X server!
libva info: VA-API version 1.4.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_4
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.4 (libva 2.4.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Coffee Lake - 2.3.0
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
root@NUC-i3:~#
`

EDIT:

HW fault isn't possible, because as I said, I have tried to install Libreelec that is kodi under an OS linux, maked for kodi.

And works. But of course, use the entire system for that, so useless use a nuc only for that.

@mviereck
Copy link
Owner

Maybe comparing with vainfo in container helps:

x11docker --gpu --weston-xwayland erichough/kodi vainfo

@RobertusIT
Copy link
Author

RobertusIT commented Oct 28, 2021

Maybe comparing with vainfo in container helps:

x11docker --gpu --weston-xwayland erichough/kodi vainfo

inside lxc

root@XUBUNTU:~# vainfo
error: can't connect to X server!
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.7 (libva 2.6.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 20.1.1 ()
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD

This is on terminal in xubuntu, always inside lxc container:

PXL_20211028_130356744

This one is the command that you suggest, launched inside lxc xubuntu terminal:

PXL_20211028_130915422

@mviereck
Copy link
Owner

This one is the command that you suggest, launched inside lxc xubuntu terminal:

I thought you would run and debug on proxmox host?
We need a clear debug environment without sudden changes. Please run without ssh and on proxmox host.

@RobertusIT
Copy link
Author

This one is the command that you suggest, launched inside lxc xubuntu terminal:

I thought you would run and debug on proxmox host? We need a clear debug environment without sudden changes. Please run without ssh and on proxmox host.
PXL_20211028_142359511

Sorry my bad.

Is inside host proxmox.

Kodi started, but glitchy

@mviereck
Copy link
Owner

Please run this on proxmox host and compare with the output of vainfo on host:

x11docker --gpu --weston-xwayland erichough/kodi vainfo

@RobertusIT
Copy link
Author

Please run this on proxmox host and compare with the output of vainfo on host:

x11docker --gpu --weston-xwayland erichough/kodi vainfo

This is in the host proxmox:

PXL_20211028_143906025

And this one is when i launch this command, that start kodi, so i can't see any logs, and when i exit from kodi, i can see it:

PXL_20211028_144129414

Maybe i'm wrong and i need to launch this command in another way ?

@mviereck
Copy link
Owner

Maybe i'm wrong and i need to launch this command in another way ?

Ok, right. Please add --no-entrypoint:

x11docker --gpu --weston-xwayland --no-entrypoint erichough/kodi vainfo

@RobertusIT
Copy link
Author

Maybe i'm wrong and i need to launch this command in another way ?

Ok, right. Please add --no-entrypoint:

x11docker --gpu --weston-xwayland --no-entrypoint erichough/kodi vainfo

PXL_20211028_151209009

@RobertusIT
Copy link
Author

RobertusIT commented Oct 29, 2021

I really wish to win from machine abou this project, and i reinstall proxmox 7.

Then i install in the host, without docker, kodi, this version of kodi is for debian, anyway works, GPU HW works like a charm.

Here there are some screen that maybe can help us:
PXL_20211029_175550834
PXL_20211029_175557074
PXL_20211029_175600610

And also vainfo
PXL_20211029_175637803

Now i start kodi inside docker in the host:

x11docker --gpu --weston-xwayland --home erichough/kodi

And as we can see, same issue: so no GPU HW.

We can see that from these screen:

Pixel Format isn't vaapi, so no GPU HW
PXL_20211029_180240200

And also Windowing system is different between kodi debian from host, and kodi from docker.
From docker use x11 and we can't have GPU HW, from debian host without docker, so outside docker, we have GPU HW with gbm.

So in the host we can have GPU HW, but not into the docker, in the host of course, for now lxc isn't consider.

EDIT:

I see also that root user haven't groups about GPU

So i add root user for that groups, but no success.

root@NUC-i3:~# groups root
root : root video render
root@NUC-i3:~# ls -la /dev/dri/
total 0
drwxr-xr-x  3 root root        100 Oct 29 14:00 .
drwxr-xr-x 22 root root       4760 Oct 29 17:07 ..
drwxr-xr-x  2 root root         80 Oct 29 14:00 by-path
crw-rw----  1 root video  226,   0 Oct 29 14:00 card0
crw-rw----  1 root render 226, 128 Oct 29 14:00 renderD128
root@NUC-i3:~# 

@mviereck
Copy link
Owner

mviereck commented Dec 2, 2021

The issue might still be a different VAAPI version.

I recommend to build a custom kodi image based on the same debian version that your proxmox system is based on. That might fix the remaining issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants