如何使用 Singularity 创建 x 服务器

问题描述

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

集群没有X服务器;我没有 sudo 权限,也可以启动 Docker 容器,但可以启动 Singularity 容器。

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

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) @R_730_4045@ional,(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 @R_730_4045@ion.
(EE)
(EE) Server terminated with error (1). Closing log file.

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

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

解决方法

如单独讨论中所述,Xvfb 不应通过 startx/usr/bin/X 开始,而是应使用提供的运行脚本。