-
I am trying to build a Singularity container which has a Ubuntu 22.04 OS, a GNOME GUI desktop, and TigerVNC for connection from MobaXterm. But it is too hard for me and I have devoted too much time to it. Can you please share one with me if you have? A Docker container is also OK if it can be converted to Singularity. Due to the configuration of target server that runs the container, OCI, non-SUID, and cgroups v2 mode are not supported. The version of Singularity in the server is most up-to-date, however. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hi @Heng-Zhou I just wanted to mention that running recent GNOME desktop environments, with VNC, in a container is extremely complex. This is because of:
While some people (myself included in a previous job) have succeeded in setting up containers running a recent GNOME desktop, they often need to be quite specific to the exact OS on the host, and how the host is configured. Hopefully this thread will be seen by someone who has a generic solution, or a solution for an environment that is similar to yours. It may be worthwhile loooking into running an alternative, lighter weight, desktop environment. I know that people have had more success with e.g. Xfce and MATE running inside containers. Finally, GNOME is moving away from supporting X for displays in future versions (https://www.phoronix.com/news/GNOME-MR-Drop-X11-Session). This would completely remove the ability to run a full GNOME desktop under existing VNC servers, and may be another reason to look into alternatives if your project is long-term and may wish to move to e.g. Ubuntu 26.04 when that is released in a couple of years. I am not aware of a good solution for running a desktop in a container with wayland (which is what GNOME is moving to from X). |
Beta Was this translation helpful? Give feedback.
-
I'm afraid not. I don't have access to the solution because I left that job some time ago, and it was specific to my previous employers RHEL7 system. It also used NICE DCV for graphics acceleration (which is a commercial product).
It's quite likely that this will be useful knowledge, yes.
It's not an issue of Host <-> Container compatibility as with TigerVNC server inside the container, all of the X stack runs inside of the container. The issue is that GNOME will be dropping support for X in future. This means that inside a container that provides a future version of GNOME, GNOME will not be able to draw to TigerVNC server. This doesn't depend on the host at all, only what's in the container. TightVNC provides the X display that the GNOME desktop draws itself too. In future, GNOME will only support wayland. It will not draw to an X display, so you won't be able to use it via TigerVNC. This change is currently being discussed and happening in e.g. Fedora, and is likely to come to a future Ubuntu release. It might not concern you if you anticipate only using Ubuntu 22.04. I just wanted to raise it as a consideration prior to investing a lot of time in an approach that might need to continue working for several years / with newer Linux distributions in the container. |
Beta Was this translation helpful? Give feedback.
-
I made it, finally. I was mislead by my past (correct and working) experience on creating Ubuntu 22.04.3 Server LTS + GNOME GUI desktop + TigerVNC in WSL. I had thought Singularity is simpler than WSL (e.g, Singularity does not boot while WSL boots), so the guest OS should be more incomplete than that in WSL, so the creation of the container would be harder than that of WSL, as dtrudg commented, "extremely complex". In WSL, since the guest OS is incomplete, the solution is creating a new namespace with systemd being the first process (so init process) in which systemd will do the complete configuration, and then entering this new namespace to start GNOME and VNC server. Because I expected at first that the creation of Singularity container is harder, I was following this solution. This solution needs to run sudo command, so I resorted to fakeroot. The problem of fakeroot settings in the Singularity document is that the root user of the host is not mapped, consequently files and directories owned by real root is changed to nobody. However, many system settings like D-Bus system put configurations in these directories, and they check whether the owner of the directory is "root", perhaps for security consideration. This causes a lot of errors since the owner is now changed to "nobody". Because D-Bus is not working, X Window system is not working, then GNOME, then VNC server, because they are working on top of the previous one. Realizing these problems, I decided to give up fakeroot mode, and the WSL solution which creates and enters a new namespace in which systemd does the job of booting and initializing. The key here is that although Singularity is simpler and not booting, it can make use of the outside fully fledged and fully initialized and configured host OS, which provides D-Bus system and other system components that are already up and running; we don't have to create our own. In WSL, on the contrary, we have to because WSL is isolated from the host OS, but Singularity is tightly tied to the host OS! It works at last. I promised that I will publish the definition file. I tested it on both Ubuntu 22.04 Server LTS and Red Hat 8.8. There are no doubt rooms to improve the code, like embedding the xstartup file in the definition and creating a runscript, but the major part of the container is completed. Here it is (named
To run the container, be sure to bind
Then inside the container, you can run
|
Beta Was this translation helpful? Give feedback.
-
In order to support
To use it after generating the .sif file:
Set the file to be executable:
Some notes:
|
Beta Was this translation helpful? Give feedback.
I made it, finally.
I was mislead by my past (correct and working) experience on creating Ubuntu 22.04.3 Server LTS + GNOME GUI desktop + TigerVNC in WSL. I had thought Singularity is simpler than WSL (e.g, Singularity does not boot while WSL boots), so the guest OS should be more incomplete than that in WSL, so the creation of the container would be harder than that of WSL, as dtrudg commented, "extremely complex". In WSL, since the guest OS is incomplete, the solution is creating a new namespace with systemd being the first process (so init process) in which systemd will do the complete configuration, and then entering this new namespace to start GNOME and VNC server. Because I expected…