A Safe Script That Collects the Clues When a GPU Disappears, and Why Cloud GPUs Can't Teach You This (Xid 79 Check Script)
A Safe Script That Collects the Clues When a GPU Disappears, and Why Cloud GPUs Can't Teach You This (Xid 79 Check Script)
The problem
When a GPU falls off the PCIe bus (the slot and wiring that connect the graphics card to the rest of the computer), the evidence is spread across four places: the kernel log, the PCIe link state, the NVIDIA tools, and on servers the BMC event log (the BMC is a small separate computer on a server's motherboard that watches power and temperature). Under pressure, people check one, miss the others, and reboot. The reboot wipes the state they needed.
New to these terms? Every word is explained in the series glossary.
A small script fixes that. It should do three things: read everything in one pass, change nothing, and tell you which story the logs point to. This article walks through one I wrote for this series, tests it against real public logs, and then covers a question that comes up a lot: can you practise this on a rented cloud GPU? Mostly, no. Here is why.
The script
Save it as xid79-check.sh. It is a bash script, a text file of terminal commands that run in order. Every command in it only reads (read-only). It never resets, reloads or writes anything.
bash#!/usr/bin/env bash # xid79-check.sh: read-only triage for "GPU has fallen off the bus". # Changes nothing. Run with sudo for full logs and lspci detail. # Usage: sudo ./xid79-check.sh (check this machine) # ./xid79-check.sh saved-kernel.log (check a saved log only) set -u LOG="${1:-}" WORST=0 note() { echo "[$1] $2"; case $1 in HIGH) WORST=2;; MED) [ $WORST -lt 1 ] && WORST=1;; esac; } # 1. Kernel log: from a file, or this boot if [ -n "$LOG" ]; then K=$(cat "$LOG"); else K=$(journalctl -k -b --no-pager 2>/dev/null || dmesg); fi echo "== Xid lines ==" grep -E 'NVRM: Xid' <<<"$K" | tail -n 10 grep -qE 'Xid \([^)]*\): 79' <<<"$K" && note HIGH "Xid 79: a GPU fell off the bus" grep -qiE 'NVRM: GPU at .* has fallen off the bus' <<<"$K" && note HIGH "Old format off-the-bus message (no Xid number)" R=$(grep -oE '154, GPU recovery action changed .*' <<<"$K" | tail -n1) [ -n "$R" ] && note MED "Driver recovery hint: ${R#154, }" grep -qE 'heartbeat timed out|_kgspBootGspRm|GSP_INIT failed|GSP RPC timeout' <<<"$K" && note MED "GSP firmware errors near the event" echo "== PCIe errors (AER and firmware-first) ==" A=$(grep -E 'PCIe Bus Error|AER:|RxErr|BadTLP|BadDLLP|Surprise Down|CmpltTO|\[Hardware Error\].*(PcieError|device_id|secondary_bus)' <<<"$K") echo "${A:-none}" | tail -n 12 grep -qiE 'severity=Corrected|RxErr|BadTLP' <<<"$A" && note MED "Corrected link errors: marginal signal, check riser, slot, link speed" grep -qiE 'Uncorrect|Fatal|Surprise Down|CmpltTO' <<<"$A" && note HIGH "Uncorrectable or link-down errors on the path" grep -qiE 'PME: Spurious native interrupt' <<<"$K" && note MED "Spurious PME on the root port: power state changes around the drop" if [ -z "$LOG" ]; then echo "== Link state per NVIDIA device ==" for d in $(lspci -D -d 10de: 2>/dev/null | awk '/VGA|3D|Display/{print $1}'); do lspci -s "$d" | grep -q 'rev ff' && note HIGH "$d config space reads all ff: not answering" lspci -vvv -s "$d" 2>/dev/null | grep -E 'LnkCap:|LnkSta:' | sed "s/^/$d /" done echo "== nvidia-smi ==" if command -v nvidia-smi >/dev/null; then O=$(nvidia-smi --query-gpu=index,pci.bus_id,temperature.gpu,power.draw,power.limit --format=csv 2>&1) echo "$O" grep -qiE 'Unknown Error|Unable to determine' <<<"$O" && note HIGH "nvidia-smi cannot reach a GPU" fi command -v ipmitool >/dev/null && sudo ipmitool sel elist 2>/dev/null | grep -Ei 'psu|power|volt|temp' | tail -n 8 fi echo "== Exit: 0 clean, 1 warnings, 2 serious ==" exit $WORST
What each part does
1. One source for the log. With no argument it reads this boot's kernel log through journalctl -k -b, falling back to dmesg. Both commands print the messages the core of Linux and its drivers have written. With a file argument it only reads that file, so you can check a log copied off a dead machine.
2. Xid lines. It prints the last ten NVRM: Xid lines and flags Xid 79. (An Xid is NVIDIA's numbered error report, and 79 means the GPU fell off the bus.) It also catches the old driver format with no number, like this real 2018 line:
NVRM: GPU at 00000000:01:00.0 has fallen off the bus.
If the driver printed an Xid 154, it pulls out the recovery hint. NVIDIA's Xid catalog says to follow an accompanying 154 for recovery guidance, so this is the line that tells you whether a GPU reset is enough or the node (the machine) needs a reboot.
3. GSP firmware lines. Newer drivers run part of the driver on the GPU's own processor, the GSP. Lines like GSP RM heartbeat timed out right before the Xid point toward firmware, not cables. (See GSP heartbeat.) Public reports with this pattern are in Part 4 of this series.
4. PCIe errors. It looks for both kinds of PCIe error reporting. Kernel native AER (Advanced Error Reporting) prints lines like PCIe Bus Error: severity=Corrected. On servers where the BIOS handles errors first (firmware-first), the kernel prints [Hardware Error] records with a device_id and secondary_bus you can use to find the slot. The kernel AER guide explains the split: corrected errors are fixed by hardware with no data loss, uncorrectable fatal errors mean the link itself is unreliable. The script also searches for RxErr, BadTLP, BadDLLP, Surprise Down, CmpltTO and spurious PME messages.
5. Live checks. Only when run on the machine itself: is the device answering (a revision of ff means config space reads back as all ones), what speed and width the link trained at (LnkCap against LnkSta), whether nvidia-smi can reach each GPU, and any power or voltage events in the BMC log (read with ipmitool sel). The device list comes from lspci filtered by NVIDIA's vendor ID 10de.
6. An exit code. 0 clean, 1 warnings, 2 serious. That exit code makes it easy to call from a cron job (a scheduled command) or a node health check.
flowchart TD A[Run xid79-check.sh] --> B{Log file given?} B -- yes --> C[Read that saved file] B -- no --> D[Read this boot: journalctl, or dmesg] C --> E[Xid lines: 79, old format, 154 hint] D --> E E --> F[GSP firmware lines] F --> G[PCIe errors: AER and Hardware Error] G --> H{Live machine?} H -- yes --> I[lspci rev ff, LnkCap vs LnkSta, nvidia-smi, BMC log] H -- no --> J I --> J[Exit code: 0 clean, 1 warnings, 2 serious]
Diagram: What xid79-check.sh does, in order, and how it ends with a 0, 1 or 2 exit code.
Testing it on real public logs
A triage script is only as good as the logs you test it on. I ran it in file mode on lines copied from public NVIDIA forum reports. Here is the result for the dual RTX 4090 report, where the firmware logged a bad packet:
== Xid lines ==
[154565.721845] NVRM: Xid (PCI:0000:41:00): 79, pid='<unknown>', name=<unknown>, GPU has fallen off the bus.
[HIGH] Xid 79: a GPU fell off the bus
== PCIe errors (AER and firmware-first) ==
[154568.708320] {1}[Hardware Error]: device_id: 0000:40:01.1
[154568.708326] {1}[Hardware Error]: secondary_bus: 0x41
[154568.709987] pcieport 0000:40:01.1: [ 6] BadTLP
[MED] Corrected link errors: marginal signal, check riser, slot, link speed
== Exit: 0 clean, 1 warnings, 2 serious ==
And for the RTX 5090 report with GSP heartbeat timeouts:
== Xid lines ==
NVRM: Xid (PCI:0000:01:00): 79, GPU has fallen off the bus.
NVRM: Xid (PCI:0000:01:00): 154, GPU recovery action changed to Node Reboot Required
[HIGH] Xid 79: a GPU fell off the bus
[MED] Driver recovery hint: GPU recovery action changed to Node Reboot Required
[MED] GSP firmware errors near the event
== PCIe errors (AER and firmware-first) ==
none
Same top line, very different next step. That difference is the whole point of reading what came before the Xid.
| Public log tested | Flags raised | Exit code |
|---|---|---|
| RTX 4090, firmware-first BadTLP | Xid 79, corrected link errors | 2 |
| RTX 3060, RxErr on root port | Xid 79, corrected link errors | 2 |
| Spurious PME at idle, screens asleep | Xid 79, spurious PME | 2 |
| GTX 1080 Ti, 2018 driver format | Old format off the bus | 2 |
| RTX 5090, GSP heartbeat | Xid 79, recovery hint, GSP errors | 2 |
| A log with no GPU errors | none | 0 |
Why you can't practise this on a rented cloud GPU
It is natural to want to rent a GPU VM, break something, and practise. Here is the problem: in a cloud VM (a simulated computer running on the provider's real machine), almost everything this script reads on the PCIe side belongs to the host, the physical machine underneath, not to you.

On your own machine you see the whole PCIe path. In a cloud VM, the root port, slot, power and BMC belong to the provider.
- The physical link is not yours. The root port that logs AER errors, the slot, the riser, the power supply and the BMC all sit on the host. The provider sees those logs. Your VM usually does not.
- Recovery is the provider's job. Google Cloud says it detects Xid errors and proactively sends machines to repair when codes indicate a high probability of hardware failure, naming Xid 74, 79 and 140 (Xid 74, Xid 140). Crusoe's support article tells customers to stop and start the VM for Xid 79, which moves it to another host, and to send an NVIDIA bug report. Amazon EKS's default repair action for Xid 79 is Replace.
- Some tools behave differently in a VM. NVIDIA's node triage guide notes that GPU reset is not supported inside VMs on Ampere (an NVIDIA GPU generation), and that you restart the VM instead.
- You should not try to cause a real fault. Yanking power or corrupting a link on hardware you rent is not a lab exercise. It is breaking someone else's machine.
What you can safely practise on a VM is the software side:
bash# Is this a VM or a container? A container hides even more. systemd-detect-virt # Read-only: what does this guest see of the GPU's link? sudo lspci -vvv -d 10de: | grep -E "LnkCap:|LnkSta:" # Run the script on a saved public log, no GPU needed ./xid79-check.sh saved-kernel.log
(systemd-detect-virt prints whether you are in a VM or a container, a lighter kind of isolated environment. sudo runs a command as administrator, lspci -vvv shows full device detail, and grep keeps matching lines.)
The kernel also has a sysfs interface to hot remove a device and rescan the bus, documented in its ABI files as /sys/bus/pci/devices/.../remove and /sys/bus/pci/rescan. On a test machine you own, removing and rescanning a healthy device is a safe way to see what the driver logs when a device disappears and returns. It is not the same as a real Xid 79, where public reports show the GPU often stays unusable until a power cycle.
My opinion: to learn real PCIe failure behaviour, you need hardware you own. An old desktop and a cheap GPU on a riser will teach you more about RxErr than any cloud VM.
Quick answers
Is it safe to run this on a production node?
Yes. It only reads logs and device state. The lspci -vvv detail and the BMC log need root.
Why check the root port and not just the GPU? The kernel AER driver attaches to root ports, so that is where most PCIe errors are reported. The GPU's own address may never appear in the AER lines.
Can the script tell me the root cause? No. It narrows the story: link, power, or firmware. You still have to test one change at a time, as covered in Part 3.
Sources
- NVIDIA Xid catalog: analyzing Xid messages
- NVIDIA Xid Errors documentation (archive)
- NVIDIA GPU Debug Guidelines: node triage
- Linux kernel: PCI Express AER driver guide
- Linux kernel ABI: sysfs-bus-pci remove and rescan
- Google Cloud: troubleshoot GPU VMs
- Crusoe support: XID errors observed in dmesg
- Amazon EKS: node monitoring agent and XID repair actions
- NVIDIA forum: GPU (4090) falls off the bus
- NVIDIA forum: RTX 5090 GSP heartbeat timeout and Xid 79
- NVIDIA forum: GTX 1080 Ti falling off bus
