UnityRenderStreaming使用记录(四)

测试把UnityRenderStreaming部署在docker,剧透一下,嘎了……

在这里插入图片描述

当然webserver运行的妥妥的

在这里插入图片描述

那么打包出的程序运行log

在这里插入图片描述

Mono path[0] = '/home/unity/Broadcast/Broadcast_Data/Managed'
Mono config path = '/home/unity/Broadcast/Broadcast_Data/MonoBleedingEdge/etc'
Found 1 interfaces on host : 0) 172.17.0.2
Multi-casting "[IP] 172.17.0.2 [Port] 55000 [Flags] 2 [Guid] 1613740712 [EditorId] 4137315725 [Version] 1048832 [Id] L>
Starting managed debugger on port 56712
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=0.0.0.0:56712
Preloaded 'libwebrtc.so'
AS: AutoStreaming module initializing.
Unable to load player prefs
Desktop is 0 x 0 @ 0 Hz

dockerfile和start.sh

FROM ubuntu:24.04

USER root
LABEL maintainer="xuefei"

RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:123456' | chpasswd
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]

# 创建用户和组
RUN groupadd -r xuefei && useradd -r -g xuefei -m -u 2000 xuefei

# 复制文件
COPY --chown=2000:xuefei ./unity /home/unity

# 设置权限
RUN chmod -R 755 /home/unity
EXPOSE 8080 80

# 切换到非root用户
USER 2000

# 设置工作目录
WORKDIR /home/unity

ENTRYPOINT ["/home/unity/start.sh"]

#!/bin/bash
export XDG_RUNTIME_DIR=/unity
./webserver -p 80 &
./Broadcast/Broadcast.x86_64 &
wait

一些参考链接

https://discussions.unity.com/t/render-streaming-app-crash-in-linux-container-headless/897617/9

https://askubuntu.com/questions/1072918/running-unity3d-game-on-linux-minimal

https://discussions.unity.com/t/webrtc-is-disconnected-in-the-linux-container/902496

https://wiki.archlinux.org/title/Unity3D

25.1.2这个很专业,但看不懂,明天继续……

https://zhuanlan.zhihu.com/p/521023922

25.1.3 测试上面的方案

https://zhuanlan.zhihu.com/p/521022054 这里我测试了方案2,嘎了

嘎在了这步 Xorg -dpi 96 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER +extension DOUBLE-BUFFER -logfile xorg-10.log -config xorg.conf -verbose :10 &
具体日志如下

root@456fabd3120b:~/unity# Xorg -dpi 96 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER +extension DOUBLE-BUFFER -logfile xorg-10.log -config xorg.conf -verbose :10 &
[5] 196
root@456fabd3120b:~/unity# 
X.Org X Server 1.21.1.11
X Protocol Version 11, Revision 0
Current Operating System: Linux 456fabd3120b 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec  5 13:09:44 UTC 2024 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-6.8.0-51-generic root=UUID=a1816ac1-e510-4971-8646-13cc6580d5a4 ro quiet splash vt.handoff=7
xorg-server 2:21.1.12-1ubuntu1.1 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.42.2
	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: "xorg-10.log", Time: Fri Jan  3 09:47:37 2025
(++) Using config file: "xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(==) ServerLayout "Layout0"
(**) |-->Screen "Screen0" (0)
(**) |   |-->Monitor "Monitor0"
(**) |   |-->Device "Device0"
(**) |-->Input Device "Keyboard0"
(**) |-->Input Device "Mouse0"
(**) Allowing byte-swapped clients
(==) Automatically adding devices
(==) Automatically enabling devices
(==) Automatically adding GPU devices
(==) Automatically binding GPU devices
(==) Max clients allowed: 256, resource mask: 0x1fffff
(WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
	Entry deleted from font path.
(WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
	Entry deleted from font path.
(WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
	Entry deleted from font path.
(WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
	Entry deleted from font path.
(WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
	Entry deleted from font path.
(==) FontPath set to:
	/usr/share/fonts/X11/misc,
	/usr/share/fonts/X11/Type1,
	built-ins
(==) ModulePath set to "/usr/lib/xorg/modules"
(WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
(WW) Disabling Keyboard0
(WW) Disabling Mouse0
(EE) systemd-logind: failed to get session: Launch helper exited with unknown return code 1
(II) xfree86: Adding drm device (/dev/dri/card1)
(II) Platform probe for /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1
(II) xfree86: Adding drm device (/dev/dri/card0)
(II) Platform probe for /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/simple-framebuffer.0/drm/card0
(--) PCI:*(1@0:0:0) 10de:1b81:1043:859d rev 161, Mem @ 0xa2000000/16777216, 0x90000000/268435456, 0xa0000000/33554432, I/O @ 0x00003000/128, BIOS @ 0x????????/131072
(II) Loading /usr/lib/xorg/modules/extensions/libglx.so
(II) Module glx: vendor="X.Org Foundation"
	compiled for 1.21.1.11, module version = 1.0.0
(WW) Warning, couldn't open module nvidia
(EE) Failed to load module "nvidia" (module does not exist, 0)
(==) Matched nouveau as autoconfigured driver 0
(==) Matched modesetting as autoconfigured driver 1
(==) Matched fbdev as autoconfigured driver 2
(==) Matched vesa as autoconfigured driver 3
(==) Assigned the driver to the xf86ConfigLayout
(II) Loading /usr/lib/xorg/modules/drivers/nouveau_drv.so
(II) Module nouveau: vendor="X.Org Foundation"
	compiled for 1.21.1.3, module version = 1.0.17
(II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
(II) Module modesetting: vendor="X.Org Foundation"
	compiled for 1.21.1.11, module version = 1.21.1
(II) Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
(II) Module fbdev: vendor="X.Org Foundation"
	compiled for 1.21.1.11, module version = 0.5.0
(II) Loading /usr/lib/xorg/modules/drivers/vesa_drv.so
(II) Module vesa: vendor="X.Org Foundation"
	compiled for 1.21.1.7, module version = 2.6.0
(II) NOUVEAU driver Date:   Sat Jan 23 12:24:42 2021 -0500
(II) NOUVEAU driver for NVIDIA chipset families :
	RIVA TNT            (NV04)
	RIVA TNT2           (NV05)
	GeForce 256         (NV10)
	GeForce 2           (NV11, NV15)
	GeForce 4MX         (NV17, NV18)
	GeForce 3           (NV20)
	GeForce 4Ti         (NV25, NV28)
	GeForce FX          (NV3x)
	GeForce 6           (NV4x)
	GeForce 7           (G7x)
	GeForce 8           (G8x)
	GeForce 9           (G9x)
	GeForce GTX 2xx/3xx (GT2xx)
	GeForce GTX 4xx/5xx (GFxxx)
	GeForce GTX 6xx/7xx (GKxxx)
	GeForce GTX 9xx     (GMxxx)
	GeForce GTX 10xx    (GPxxx)
(II) modesetting: Driver for Modesetting Kernel Drivers: kms
(II) FBDEV: driver for framebuffer: fbdev
(II) VESA: driver for VESA chipsets: vesa
xf86EnableIO: failed to enable I/O ports 0000-03ff (Operation not permitted)
(WW) Falling back to old probe method for modesetting
(EE) open /dev/dri/card0: No such file or directory
(WW) Falling back to old probe method for fbdev
(II) Loading /usr/lib/xorg/modules/libfbdevhw.so
(II) Module fbdevhw: vendor="X.Org Foundation"
	compiled for 1.21.1.11, module version = 0.0.2
(EE) open /dev/fb0: No such file or directory
(WW) Falling back to old probe method for modesetting
(EE) open /dev/dri/card0: No such file or directory
(WW) Falling back to old probe method for fbdev
(II) Loading /usr/lib/xorg/modules/libfbdevhw.so
(II) Module fbdevhw: vendor="X.Org Foundation"
	compiled for 1.21.1.11, module version = 0.0.2
(EE) open /dev/fb0: No such file or directory
(EE) No devices detected.
(EE) 
Fatal server error:
(EE) no screens found(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 "xorg-10.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.

[5]   Exit 1                  Xorg -dpi 96 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER +extension DOUBLE-BUFFER -logfile xorg-10.log -config xorg.conf -verbose :10
root@456fabd3120b:~/unity# 

dockerfile如下

FROM nvidia/cuda:12.6.3-runtime-ubuntu24.04
RUN apt-get update && apt-get install -y openssh-server xorg 
RUN mkdir /var/run/sshd
RUN echo 'root:123456' | chpasswd
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
EXPOSE 22
EXPOSE 80
CMD ["/usr/sbin/sshd", "-D"]
#COPY ./unity /unity
#RUN chmod -R 755 /unity
#WORKDIR /unity
#ENTRYPOINT ["/unity/start.sh"]

驱动安装

root@109e0d195852:~/unity# apt install kmod
root@109e0d195852:~/unity# ./NVIDIA-Linux-x86_64-560.35.03.run -a -q --ui=none --no-kernel-module

nvidia-smi

root@456fabd3120b:~/unity# nvidia-smi
Fri Jan  3 09:53:34 2025       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.120                Driver Version: 560.35.05      CUDA Version: 12.6     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1070        Off |   00000000:01:00.0  On |                  N/A |
| 29%   42C    P8              9W /  151W |      81MiB /   8192MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+
root@456fabd3120b:~/unity#

docker相关操作

docker pull nvidia/cuda:12.6.3-runtime-ubuntu24.04
docker stop unity
docker remove unity
docker build -t unity:v25.1.3.1 .
docker run -d -p 2222:22 -p 8080:80 --name unity --gpus all unity:v25.1.3.1

未完待续……

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

地狱为王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值