Local LXD X11 Container, How to overcome errors?

I have lxd containers running locally successfully but can not start X11 applications back to the host. I have tried following @simos great blog post Running X11 software in LXD containers – Mi blog lah! but it generates errors during container creation. Any help or guidance is appreciated.

Base error before following blog

$ lxc launch images:mint/vanessa mint-container -s pool1
$ lxc shell mint-container
lxd$ firefox
	X11 connection rejected because of wrong authentication.
	mkdir: cannot create directory '/run/user/1001': Permission denied
	Error: cannot open display: localhost:10.0

Following Blog Error 1
The error occurs during creation due to NVIDO container tools. Initial brief search didn’t find much context.

$ lxc launch images:mint/vanessa --profile default --profile x11 mbrowse -s pool1
	Error: Load go-lxc struct: The NVIDIA container tools couldn't be found
	Try `lxc info --show-log local:mbrowse` for more info
$ lxc launch ubuntu:18.04 --profile default --profile x11 mycontainer -s pool1

Comment Nvidia in Profile Config: Error 2
Under the argument that I don’t need GPU acceleration I thought why not try without the GPU labelled explicitly in the config. This second error returns more results in forum but I haven’t figured out yet how they might help. For instance I already have nvidia-smi installed.

$ lxc profile edit x11
       commented lines starting nvidia.* and mygpu config tree
$ lxc launch images:mint/vanessa --profile default --profile x11 mbrowse -s pool1
	Creating mbrowse
	Starting mbrowse                          
	Error: Error occurred when starting proxy device: Error: Failed to receive fd from listener process: Failed to receive file descriptor via abstract unix socket
	Try `lxc info --show-log local:mbrowse` for more info

$ lxc info --show-log local:mbrowse
	Name: mbrowse
	Status: STOPPED
	Type: container
	Architecture: x86_64
	Created: 2022/10/20 08:25 CDT
	Last Used: 2022/10/20 08:25 CDT
Log:
	lxc mbrowse 20221020132530.205 WARN     cgfsng - cgroups/cgfsng.c:fchowmodat:1251 - No such file or directory - Failed to fchownat(40, memory.oom.group, 1000000000, 0, AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW )

context

  • I have previously gotten lxc privileged container to run X11 applications.
  • nvidia-smi is installed

@Crumbs350

Sorry to derail the thread a bit.

Does your “use case” require that the X11 has to run on the Host?

I install desktops (ubuntu, Lubuntu, Lubuntu, Mate, Cinnamon, etc) and XRDP in LXD containers along with xRDP but not the xRDP in the repositories but I use c-energy’s great XRDP install script which can build from latest source both xRDP & Pulseaudio & xRDP & install them.

c-energy custom xrdp/pulseaudio install script for linux

On host I install freerdp2 and create a 1 line bash script to access the Desktops in the container

when using LXD Desktops I have audio, printing, shared Folder w the host,
Cut & Paste w the Host etc

Performance is immediate and you can run as many LXD Desktops as want

If you want to try this it’s easy & only takes about 15 min to install everything

Using LXD proxy on remote LXD Host’s
You can use the same setup and run remote LXD Desktops w great performance also

Contact me & I can share a doc & some scripts I made.

@bmullan interesting proposal. I think I’d be interested in the scripts but I’d still like to solve the X11 problem from a 1) curiosity, 2) this should work, and 3) simplicity perspective.

if xRDP with full desktop in a container then…

  • more packages to regularly update
  • container image is bigger which raises the question of why you’d still use a container vs just use virtualbox images that you group launch and xRDP to
  • the Ubuntu environment focus makes me wonder if xRDP has snap dependencies
  • does alt+tab work or get confused as it sometimes does with windows RDP? i.e. am I alt+tabbing in the host or the guest?

Please correct or extend my naive perspective.

  • more packages to regularly update
    yup but that can be automated for many cases

  • container image is bigger which raises the question of why you’d still use a container vs just use virtualbox images that you group launch and xRDP to

w/virtual box images you are not sharing the linux kernel the virtual box VMs will each have to include their own kernel

  • why use a container?

because I can “install” or “try” applications or configurations in the LXD container desktop that I rather not “install” or “try” on my real Desktop.

because I can clone very quickly, copy easily to remote lxd hosts

If you have more questions lets take it offline
thanks
brian

Curious if anyone know if nvidia container tools is necessary to get X11 to work. Also curious if anyone can comment on the following error for X11 access.

Error: Error occurred when starting proxy device: Error: Failed to receive fd from listener process: Failed to receive file descriptor via abstract unix socket
	Try `lxc info --show-log local:mbrowse` for more info