Running GUI Applications on Manjaro Host

I’ve recently migrated from Linux Mint to Manjaro.
In Mint, all of my containers were working flawlessly.
Since my development workflow was established, I wanted to migrate to a
rolling release distro. Also because of Arch being so involved with it’s installation,
I decided to go with Manjaro.

LXD Version: 4.1
Installed with Snap

What works…
I’m able to launch containers, and share folders between host and container.
My permission seems to be correct, since I’m able to write files to the shared folders.

Giving my containers access to the host Xserver however has been a challenge…
After reading through the “GUI Apps in LXD (Archlinux Host)” thread I’ve learned two possible solutions, one to disable the access control on my XServer with the xhost command, or to include a correctly configured .Xauthority file in my container.

I’m able to successfully do either of them, however things are still not working quite right.

Example:

$ xclock
Warning: Unable to load any usable ISO8859 font
Warning: Missing charsets in String to FontSet conversion

AND

$ glxgears
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: Version 4 or later of flush extension not found
libGL error: failed to load driver: i915
libGL error: failed to open drm device: No such file or directory
libGL error: failed to load driver: iris
6212 frames in 5.0 seconds = 1242.326 FPS

I did not have these issues on Mint… I’m a little puzzled on why it’s so different with Manjaro…

Is there a better way to accomplish this?

This is the profile I’m using for trouble shooting.

config:
  nvidia.runtime: "true"
  nvidia.driver.capabilities: graphics, compute, display, utility, video
  environment.DISPLAY: :0
  raw.idmap: |
    uid 1000 1000
    gid 1000 1000
  security.idmap.isolated: "true"
  user.user-data: |
    #cloud-config
    package_upgrade: true
    packages:
      - x11-apps
      - mesa-utils
description: Enables X forwarding to host
devices:
  root:
    path: /
    pool: zfs-pool
    size: 20GB
    type: disk
  gpu:
    pci: "0000:01:00.0"
    type: gpu
  eth0:
    name: eth0
    nictype: bridged
    parent: lxdbr0
    type: nic
  X0:
    bind: container
    connect: unix:@/tmp/.X11-unix/X0
    listen: unix:@/tmp/.X11-unix/X0
    security.gid: "1000"
    security.uid: "1000"
    type: proxy
name: gui
used_by:

Thank you for your time.

First of all, you use manjaro on the host and inside the container, or different distros?

At first sight this seems to be missing software in the container.
Try to install the mesa-libraries etc.

Toby,

Thank you for the reply.

My host environment is: Manjaro Linux with Kernel: 5.615-1-MANJARO
Currently my container is running Ubuntu Bionic.

I’m not sure, it seems like that, but after running…

$ sudo apt install mesa-*

I’m still getting the errors.

Here is the output after executing glxinfo -B

ubuntu@gui:~$ glxinfo -B
name of display: :0
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: Version 4 or later of flush extension not found
libGL error: failed to load driver: i915
libGL error: failed to open drm device: No such file or directory
libGL error: failed to load driver: iris
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: VMware, Inc. (0xffffffff)
    Device: llvmpipe (LLVM 9.0, 256 bits) (0xffffffff)
    Version: 19.2.8
    Accelerated: no
    Video memory: 31904MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 3.3
    Max compat profile version: 3.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 9.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.2.8
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.1 Mesa 19.2.8
OpenGL shading language version string: 1.40
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.0 Mesa 19.2.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

I assume you need to install the package:
libgl1-mesa-glx

I would also suggest you switch to focal, this maybe provides a better compatibility with your manjaro host.

So yes, the container did not have libgl1-mesa-glx installed.
However, no change still getting the same output from glxinfo -B.

This is the output when I run ```nvidia-smi`` from within the container.

ubuntu@gui:~$ nvidia-smi 
Thu Jun  4 12:49:36 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.82       Driver Version: 440.82       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro M1000M       Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   32C    P8    N/A /  N/A |     33MiB /  2002MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

If I recall correctly, nvidia.runtime: "true" makes the necessary gl libraries available from host to container. Could it be a library mapping issue between host and container?

Okay, so this is what I found…

My laptop has a “Hybrid GPU Setup” running an Intel and Nvidia GPU configuration.

The container was running into problems with the “video-hybride-intel-nvidia-prime” graphics driver configuration on Manjaro.

After configuring my BIOS to only use the NVIDIA Card, and installing the proprietory Nvidia x440 driver. My glxgears demo started to work correctly in both Xenial and Bionic containers.

ubuntu@test-xenial:~$ glxgears 
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
301 frames in 5.0 seconds = 60.017 FPS

Even though I have a working config now.
I’m still wondering if it’s possible to get LXC to play nicely with the Hybrid GPU configuration.
Is this currently possible with current implementation of nvidia.runtime program???