Truenas been a fun learning experience, especially when messing my hardware choices lol
I been able to get through most issues with with searching the web, but I just hit a wall with this one.
Would any kind soul be able to point me on the right direction?
I have a 6900XT that I been able to isolate and pass-through to a debian VM successfully, it is just…
If i shut it down, it doesnt release the HDMI audio PCIE device
0000:0f:00.1 ‘Audio device’: Navi 21/23 HDMI/DP Audio Controller by ‘Advanced Micro Devices, Inc. [AMD/ATI]’
As I explorer solutions, I was able to to fix it with a bash script that I can run from the Truenas shell after the VM is shutdown
__
#!/bin/bash
echo 1 > /sys/bus/pci/devices/0000:0f:00.1/remove
echo 1 > /sys/bus/pci/devices/0000:0f:00.0/reset
sleep 1
echo 1 > /sys/bus/pci/rescan
__
sudo /root/gpu-reset.sh
Would there some way to call the script at the VM shutdown ?
Side note:
In all my testing I learned that the reset bug does not happen with CSM enabled, but the drawback is that I lose Rebar. I know i could give up rebar, but… the improvement in games is just too good
A cron job scheduled to call that script is one way of doing it, but you should be shutting down that VM on a predictable basis in order to implement. I don’t know why you’re gaming on a NAS but if you shut down the game vm every Friday at 7pm you can definitely trigger the job at that time.
But, being more serious, I have a several services running, but I made the dumb choice of picking a Ryzen 9 5900XT for cheap. It is surprisingly efficient at idle, but now I have a bunch of compute power doing nothing, and been looking for something to do with it.
Then I got my hand on brand new Asus TUF 6900XT for 380$ USD converted from Mexican pesos
I was like why it is so cheap…? Later learned that AMD was dropping active driver support to RDNA2 in Windows like literally next week. Good for me. Bad for ppl stuck on Windows
@geri91 An infinite loop in bash That could do the trick. Been so long since I programmed for real that it never cross my mind. Then I could set schedule to turn off/on the VM at night
#!/usr/bin/env bash
VM_NAME="win10" # Change to your VM name
POLL_INTERVAL=2
prev_state=""
while true; do
# Query VM info via TrueNAS middleware and extract state
current_state=$(
midclt call vm.query '[["name","=","'"$VM_NAME"'"]]' 2>/dev/null \
| jq -r '.[0].status.state // empty'
)
# If VM not found / middleware not ready, skip quietly
[[ -z "$current_state" ]] && sleep "$POLL_INTERVAL" && continue
# Trigger only on state change
if [[ "$current_state" != "$prev_state" ]]; then
case "$current_state" in
RUNNING)
echo "VM started"
;;
STOPPED)
echo "VM stopped"
;;
*)
# ignore other states, or handle them if you want (PAUSED, etc.)
;;
esac
prev_state="$current_state"
fi
sleep "$POLL_INTERVAL"
done