ROS and LXC and X11 server probelm

Hi there,
I am currently running into series problems and about to lose my mind xD
I am new to ros 1 and ubuntu systems, i am running dual boot of windows 11 and ubuntu 22.04 LTS.
inside the ubuntu 22.04 i have installed lxc container service, and setup a new container of ubuntu 20.04.
(If someone asked why do not you install 20.04 directly dual boot i will say i wish i could!, there were infinite problems with dual booting 20.04 on my asus laptop, the last problem were that the keyboard not working so I downloaded 22.04 to be compatible with my laptop, as I have searched and found that new laptops are not quite compatible with old ubuntu versions)^^^
Anyways, now I have installed lxc ubuntu 20.04 container and named it “ros1”, to install ros 1 on my container I followed the exact instructions from ros neotic installation, this link : “noetic/Installation/Ubuntu - ROS Wiki”
The ros 1 was successfully installed, and roscore is running ok, but the tutlesim is not working!!
when i try the command:
“rosrun turtlesim turtlesim_node”
it gives me the following error “qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
Aborted (core dumped)”
After a lot and a lot of search I figured out that the problem is in X11 server regarding GPU set.
I tried to set it and allow the permisions but I could not, every command I run about X11 said permision denied, for example “lxc exec ros1 – bash -c ‘export DISPLAY=:1’”
gives me error of “Error: Get “http://unix.socket/1.0”: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: permission denied”
and yes my export DISPLAY command is set to port :1 not :0, I am sure that I am :1 and tested it with running command xeyes on my host, it works well!
But inside the ros1 container of ubuntu 20.04 if i tried to run xeyes it says can not open
“Error: Can’t open display: :1”
So, i need to enableX11 server on my lxc container I think or things like that, I am not sure what to do I just want to run the “rosrun turtlesim turtlesim_node” command and open the turtle window, please anyone could help because I have been in this problem for four complete days and do not know what to do.

If you want your container to access the host’s X11 socket, try this profile.

I would ask further question at LXD discourse forum, because this is an Incus forum. Incus is a LXD fork created when Canonical took over the LXD project.

You can migrate towards Incus by following the steps at Migrating from LXD - Incus documentation

The process is quite easy. Then, you ask any questions here.

Why you want me to migrate to incus ?

We don’t necessarily want you to move to Incus, but if you want us to support you on this forum, you need to run Incus.

If you want to stick to LXD, you need to go on the LXD forum instead (Canonical’s).

1 Like