如何使用 Singularity 创建 x 服务器

How to create an x server with Singularity

总的来说,我正在尝试在远程集群上使用 Unity 渲染图像。

集群没有X服务器;我没有 sudo 权限,或者可以启动一个 Docker 容器,但是我可以启动一个 Singularity 容器。

我的计划是创建一个可以模拟 X 服务器的容器。我创建了以下奇点定义文件:

Bootstrap: docker
From: nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04

%post
    # xvfb for rendering in headless mode
    apt-get update
    apt-get install -y xvfb mesa-utils xorg
    echo "allowed_users = anybody" > /etc/X11/Xwrapper.config

我使用 --containall 选项启动了容器。从容器中,我启动了命令 /usr/bin/X :0,但失败并出现以下错误:

Singularity xvfb.sif:~> /usr/bin/X :0
_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root

X.Org X Server 1.19.6
Release Date: 2017-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.15.0-140-generic x86_64 Ubuntu
Current Operating System: Linux cooper 5.8.0-50-generic #56~20.04.1-Ubuntu SMP Mon Apr 12 21:46:35 UTC 2021 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.8.0-50-generic root=/dev/mapper/vgubuntu-root ro quiet splash vt.handoff=7
Build Date: 08 April 2021  01:57:21PM
xorg-server 2:1.19.6-1ubuntu4.9 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.34.0
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/home/pierre-louis/.local/share/xorg/Xorg.0.log", Time: Wed May 26 09:17:05 2021
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory)
(EE)
(EE)
Please consult the The X.Org Foundation support
         at http://wiki.x.org
 for help.
(EE) Please also check the log file at "/home/pierre-louis/.local/share/xorg/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.

不存在 /dev/tty*。然后我尝试启动 startx,但只是得到相同的消息错误。

如何使用 Singularity 映像启动 X 服务器?

正如在单独的讨论中提到的,Xvfb 不应该通过 startx/usr/bin/X 开始,而是通过提供的 运行 脚本开始。