AlexandreDey / ContainerBox

Tool on top of LXD to easily create and use graphical containers
GNU General Public License v3.0
41 stars 7 forks source link

Tins: How to start a Desktop Environment from a Container? #16

Open marbetschar opened 4 years ago

marbetschar commented 4 years ago

Hi @AlexandreDey 👋

Just came across your graphical container project while working on mine - seems like we had the same idea ;)

I put together a graphical frontend for LXD (named "Tins"), but I'm stuck trying to figure out how to forward a full desktop environment to Xephyr (or similar). Any chance you can point me towards the right direction?

Using LXD v3.0.3 on elementary OS 5.1 Hera (Ubuntu 18.04 LTS) with the following profile: https://github.com/marbetschar/tins/blob/master/data/lxd/profile-x11.json

As mentioned there, if I start a regular X11 application it appears in the Xephyr window (for example firefox) - but sudo systemctl restart gdm or sudo systemctl stop gdm && sudo gdm seems to do nothing.

Would highly appreciate it, if you can put together a rought concept of the minimal steps need to be taken to get this working - I already glimpsed at your code, but its quite a lot :)

AlexandreDey commented 4 years ago

Hi, when using a passed through Xorg server in the container, you have to instruct the display manager to use it instead of trying to spawn a new one (it doesn't have the necesary permissions to do so). AFAIK gdm does not propose such a feature, but lightdm does (example https://github.com/AlexandreDey/ContainerBox/blob/master/etc/creator/resources/10_container_box.conf).

Another possibility would be to make the display rendering manager compatible with user namespaces or create a virtual GPU and screen abstraction for the container

marbetschar commented 4 years ago

@AlexandreDey thank you so much for this insight regarding lightdm. And your work helps tremendously!! I achieved a very rough, first working solution using Xephyr - thanks to the code in your repo 🎉️

I'm wondering: In your experience, which pass through solution works best? Is it Xephyr, xpra, ...?

The only reason I used Xephyr is because it was already preinstalled on my Ubuntu 18.04 LTS. Since I'm primarily targeting Tins to elementary OS users as first step, I'm bound to Ubuntu 18.04 and in a few months Ubuntu 20.04.

Thanks again!!