Files
bobbie-pkm/_Inbox/2026-04-27 2233 setting up gpu with proxmox lxc.md
T

60 lines
1.7 KiB
Markdown

---
category:
- "[[Note]]"
type:
- "[[Log]]"
title: setting up gpu with proxmox lxc
created: 2026-04-27T22:33:37
date: 2026-04-27
tags:
---
passing thought gpu to [[Proxmox]] lxc container
- install nvidia drivers on the host
- install partial drivers in the lxc
- blacklist novel (something like that) drvier
- black list files are in ``
- edit `/etc/modprobe.d/pve-blacklist.conf` or create own .conf if it doesn't exist
- add following lines
- `blacklist nouveau`
- `options nouveau modeset=0`
- exec `update-grub`
- exec `update-initramfs -u`
- reboot
- enable power management on the host
- exec `nvidia-smi -pm 1`
- you will need to create a system service that starts this a boot
- `nano /etc/systemd/system/nvidia-monitor.service`
```
[Unit]
Description=Enable NVIDIA Persistence Mode
After=nvidia-kernel-common.service
Wants=nvidia-kernel-common.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/nvidia-smi -pm 1
[Install]
WantedBy=multi-user.target
```
- systemctl daemon-reload
- systemctl enable --now nvidia-monitor.service
- to pass the gpu to the container
- exec `ls -l /dev/nvidia*`
- edit `/etc/pve/lxc/ID.conf`
- add following line, adjust using values from above
```
# Allow the container to access the GPU devices
lxc.cgroup2.devices.allow: c 195:* rwm
lxc.cgroup2.devices.allow: c 511:* rwm
# Pass through the device files
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry: /dev/nvidia1 dev/nvidia1 none bind,optional,create=file
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file
```