« RetroArch » : différence entre les versions

De Le Wiki de Lug
Aller à la navigation Aller à la recherche
Aucun résumé des modifications
 
(17 versions intermédiaires par le même utilisateur non affichées)
Ligne 4 : Ligne 4 :


[https://www.reddit.com/r/Proxmox/comments/oj6ai5/guide_lxc_gpu_accelerated_gaming_desktop_without/ Source]  
[https://www.reddit.com/r/Proxmox/comments/oj6ai5/guide_lxc_gpu_accelerated_gaming_desktop_without/ Source]  
= Réglage conteneur non privilégié =
= Réglage ProxMox =
Sur le serveur hôte il faut activer activer la fonction DRM KMS du module NVidia :
proxmox:~# vi /etc/default/grub
 
<font color = grey>...</font>
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt intel_pstate=active <font color = blue>nvidia-drm.modeset=1</font>"
<font color = grey>...</font>
 
proxmox:~# update-grub
On redémarre le serveur.
= Réglage LXC =
[https://bookstack.swigg.net/books/linux/page/lxc-gpu-access Source]
Depuis le serveur hôte, avec pour exemple le conteneur 101 :
proxmox:~# vi /etc/pve/lxc/101.conf
 
<font color = grey>...</font>
lxc.mount.entry: /dev/dri/card1 dev/dri/card0 none bind,optional,create=file,mode=0666
lxc.cgroup2.devices.allow: c 226:1 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.mount.entry: /dev/tty10 dev/tty8 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 4:10 rwm
lxc.mount.entry: /dev/tty19 dev/tty0 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 4:19 rwm
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 44
lxc.idmap: g 44 44 1
lxc.idmap: g 45 100045 57
lxc.idmap: g 107 103 1
lxc.idmap: g 108 100108 65428
 
proxmox:~# vi /etc/subgid
 
<font color = grey>...</font>
root:44:1
root:103:1
 
Il faut démarrer ou redémarrer le conteneur et ajouter "root" aux groupes mappés :
lxc101:~# usermod --append --groups video,render root
lxc101:~# exec su -l $USER
 
 
[https://pve.proxmox.com/wiki/Unprivileged_LXC_containers Source] [https://www.reddit.com/r/Proxmox/comments/mttwtf/gpu_passthrough_for_unpriviliged_containers/ source reddit..]
[https://pve.proxmox.com/wiki/Unprivileged_LXC_containers Source] [https://www.reddit.com/r/Proxmox/comments/mttwtf/gpu_passthrough_for_unpriviliged_containers/ source reddit..]
lxc.mount.entry: /dev/dri/card1 dev/dri/card0 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 226:1 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 226:128 rwm
#lxc.mount.entry: /dev/tty10 dev/tty8 none bind,optional,create=file
#lxc.cgroup2.devices.allow: c 4:10 rwm
#lxc.mount.entry: /dev/tty11 dev/tty0 none bind,optional,create=file
#lxc.cgroup2.devices.allow: c 4:11 rwm
== GPU NVidia ==
Voir [[GPU_Passthrough#NVidia_LXC|partage d'une carte graphique NVidia avec un conteneur LXC]]
=Installation=
=Installation=
  # apt update && apt upgrade
  # apt update && apt upgrade
== GPU NVidia ==
== Base ==
# apt install x11vnc plasma-desktop lightdm build-essential libglvnd-dev pkg-config konsole xterm lightdm-gtk-greeter


Voir [[GPU_Passthrough#NVidia_LXC|partage d'une carte graphique NVidia avec un conteneur LXC]]
https://virtualgl.org/Documentation/HeadlessNV
== Sunshine ==
# nvidia-xconfig -a --allow-empty-initial-configuration --use-display-device=None --virtual=1920x1080 --busid 47:00.0 --use-display-device="DFP-0" --connected-monitor="DFP-0"
[https://github.com/loki-47-6F-64/sunshine Source]
[https://github.com/loki-47-6F-64/sunshine Source]


==X11 & Lightdm==
# vi /etc/systemd/system/x11vnc.service
[Unit]
Description=VNC Server for X11
Requires=lightdm.service
After=syslog.target network-online.target ##optional for better performance
Wants=syslog.target network-online.target ##optional for better performance
[Service]
ExecStart=/usr/bin/x11vnc -auth guess -display :8 -rfbauth /etc/x11vnc.pwd -shared -forever -o /var/log/x11vnc.log
ExecStop=/usr/bin/x11vnc -R stop
Restart=on-failure
RestartSec=2
[Install]
WantedBy=multi-user.target
# vi /etc/lightdm/lightdm.conf.d/local_lightdm.conf
[LightDM]
minimum-display-number=8
minimum-vt=8
# vi /etc/X11/Xwrapper.config
<font color = grey>...</font>
allowed_users=anybody
# x11vnc -storepasswd /etc/x11vnc.pwd
# systemctl daemon-reload
# systemctl enable x11vnc.service
# systemctl enable lightdm
== SunShine==
  # apt install cmake gcc-10 g++-10 libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libevdev-dev
  # apt install cmake gcc-10 g++-10 libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libevdev-dev
  # apt install libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev
  # apt install libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev
  # apt install libdrm-dev libcap-dev
  # apt install libdrm-dev libcap-dev
# apt install git cmake g++ software-properties-common libopenblas-dev liblapack-dev libx11-dev php7.4-dev pkg-config
# wget <nowiki>https://</nowiki>developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
# mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
# apt-key adv --fetch-keys <nowiki>https://</nowiki>developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
# add-apt-repository "deb <nowiki>https://</nowiki>developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
# apt update
# apt search cuda-toolkit
# apt install cuda-toolkit<font color = blue>-11-4</font>
----
  # apt install libwayland-dev
  # apt install libwayland-dev
  # apt install nvidia-cuda-dev nvidia-cuda-toolkit
  # apt install nvidia-cuda-dev nvidia-cuda-toolkit
 
----
  # apt install libgbm1 git
  # apt install libgbm1 git
  # cd /usr/local/
  # cd /usr/local/
Ligne 27 : Ligne 129 :
  # cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 ..
  # cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 ..
  # make -j ${nproc}
  # make -j ${nproc}
# vi /etc/udev/rules.d/85-sunshine-input.rules
KERNEL=="uinput", GROUP="input", MODE="0660"
# setcap cap_sys_admin+p /usr/local/sunshine/build/sunshine
# usermod -a -G input $USER
startx -- :1
-----
-----
  lxc.mount.entry: /dev/dri/card1 dev/dri/card0 none bind,optional,create=file
  lxc.mount.entry: /dev/dri/card1 dev/dri/card0 none bind,optional,create=file

Version actuelle datée du 2 novembre 2021 à 18:05



Source

Réglage ProxMox

Sur le serveur hôte il faut activer activer la fonction DRM KMS du module NVidia :

proxmox:~# vi /etc/default/grub
...
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt intel_pstate=active nvidia-drm.modeset=1"
...
proxmox:~# update-grub

On redémarre le serveur.

Réglage LXC

Source Depuis le serveur hôte, avec pour exemple le conteneur 101 :

proxmox:~# vi /etc/pve/lxc/101.conf
...
lxc.mount.entry: /dev/dri/card1 dev/dri/card0 none bind,optional,create=file,mode=0666
lxc.cgroup2.devices.allow: c 226:1 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 226:128 rwm
lxc.mount.entry: /dev/tty10 dev/tty8 none bind,optional,create=file 
lxc.cgroup2.devices.allow: c 4:10 rwm
lxc.mount.entry: /dev/tty19 dev/tty0 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 4:19 rwm
lxc.idmap: u 0 100000 65536
lxc.idmap: g 0 100000 44
lxc.idmap: g 44 44 1
lxc.idmap: g 45 100045 57
lxc.idmap: g 107 103 1
lxc.idmap: g 108 100108 65428
proxmox:~# vi /etc/subgid
...
root:44:1
root:103:1

Il faut démarrer ou redémarrer le conteneur et ajouter "root" aux groupes mappés :

lxc101:~# usermod --append --groups video,render root
lxc101:~# exec su -l $USER


Source source reddit..

lxc.mount.entry: /dev/dri/card1 dev/dri/card0 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 226:1 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
lxc.cgroup2.devices.allow: c 226:128 rwm
#lxc.mount.entry: /dev/tty10 dev/tty8 none bind,optional,create=file
#lxc.cgroup2.devices.allow: c 4:10 rwm
#lxc.mount.entry: /dev/tty11 dev/tty0 none bind,optional,create=file
#lxc.cgroup2.devices.allow: c 4:11 rwm

GPU NVidia

Voir partage d'une carte graphique NVidia avec un conteneur LXC

Installation

# apt update && apt upgrade

Base

# apt install x11vnc plasma-desktop lightdm build-essential libglvnd-dev pkg-config konsole xterm lightdm-gtk-greeter

https://virtualgl.org/Documentation/HeadlessNV

# nvidia-xconfig -a --allow-empty-initial-configuration --use-display-device=None --virtual=1920x1080 --busid 47:00.0 --use-display-device="DFP-0" --connected-monitor="DFP-0"

Source

X11 & Lightdm

# vi /etc/systemd/system/x11vnc.service
[Unit]
Description=VNC Server for X11
Requires=lightdm.service
After=syslog.target network-online.target ##optional for better performance
Wants=syslog.target network-online.target ##optional for better performance

[Service]
ExecStart=/usr/bin/x11vnc -auth guess -display :8 -rfbauth /etc/x11vnc.pwd -shared -forever -o /var/log/x11vnc.log
ExecStop=/usr/bin/x11vnc -R stop
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target
# vi /etc/lightdm/lightdm.conf.d/local_lightdm.conf
[LightDM]
minimum-display-number=8
minimum-vt=8
# vi /etc/X11/Xwrapper.config
...
allowed_users=anybody
# x11vnc -storepasswd /etc/x11vnc.pwd
# systemctl daemon-reload 
# systemctl enable x11vnc.service 
# systemctl enable lightdm

SunShine

# apt install cmake gcc-10 g++-10 libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libevdev-dev
# apt install libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev
# apt install libdrm-dev libcap-dev
# apt install git cmake g++ software-properties-common libopenblas-dev liblapack-dev libx11-dev php7.4-dev pkg-config
# wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
# mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
# apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
# add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
# apt update
# apt search cuda-toolkit
# apt install cuda-toolkit-11-4

# apt install libwayland-dev
# apt install nvidia-cuda-dev nvidia-cuda-toolkit

# apt install libgbm1 git
# cd /usr/local/
# git clone https://github.com/loki-47-6F-64/sunshine.git --recurse-submodules
# cd sunshine && mkdir build && cd build
# cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 ..
# make -j ${nproc}
# vi /etc/udev/rules.d/85-sunshine-input.rules
KERNEL=="uinput", GROUP="input", MODE="0660"
# setcap cap_sys_admin+p /usr/local/sunshine/build/sunshine
# usermod -a -G input $USER
startx -- :1

lxc.mount.entry: /dev/dri/card1 dev/dri/card0 none bind,optional,create=file
lxc.cgroup.devices.allow: c 226:1 rwm
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file
lxc.cgroup.devices.allow: c 226:128 rwm
# tty8 will be the "display"
# EDIT: be sure to mount it onto a host tty >= 10 or the host's monitor will be unusable while running
lxc.mount.entry: /dev/tty10 dev/tty8 none bind,optional,create=file
lxc.cgroup.devices.allow: c 4:10 rwm
lxc.mount.entry: /dev/tty11 dev/tty0 none bind,optional,create=file
lxc.cgroup.devices.allow: c 4:11 rwm
lxc.mount.entry: /dev/uinput dev/uinput none bind,optional,create=file
lxc.cgroup.devices.allow: c 10:223 rwm
lxc.mount.entry: /dev/input       dev/input       none bind,create=dir 0 0
lxc.cgroup.devices.allow: c 13:* rwm