Created
July 8, 2025 21:17
-
-
Save iTrauco/0b5670b572b6a17bbf7a21f871433432 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # NVIDIA/Display Comprehensive Diagnostic Script | |
| # Output file | |
| OUTPUT="nvidia_diagnostic_$(date +%Y%m%d_%H%M%S).log" | |
| echo "NVIDIA/Display Diagnostic Report - $(date)" | tee $OUTPUT | |
| echo "============================================" | tee -a $OUTPUT | |
| # System info | |
| echo -e "\n[SYSTEM INFO]" | tee -a $OUTPUT | |
| uname -a | tee -a $OUTPUT | |
| lsb_release -a 2>/dev/null | tee -a $OUTPUT | |
| # Graphics hardware | |
| echo -e "\n[GRAPHICS HARDWARE]" | tee -a $OUTPUT | |
| lspci -k | grep -A 3 -E "(VGA|3D|Display)" | tee -a $OUTPUT | |
| # NVIDIA driver status | |
| echo -e "\n[NVIDIA-SMI OUTPUT]" | tee -a $OUTPUT | |
| nvidia-smi 2>&1 | tee -a $OUTPUT | |
| echo -e "\n[NVIDIA-SMI DETAILED]" | tee -a $OUTPUT | |
| nvidia-smi -q 2>&1 | head -50 | tee -a $OUTPUT | |
| # Kernel modules | |
| echo -e "\n[LOADED NVIDIA MODULES]" | tee -a $OUTPUT | |
| lsmod | grep -E "(nvidia|nouveau)" | tee -a $OUTPUT | |
| echo -e "\n[MODULE INFO]" | tee -a $OUTPUT | |
| modinfo nvidia 2>&1 | grep -E "(version|filename|depends)" | tee -a $OUTPUT | |
| # Installed packages | |
| echo -e "\n[NVIDIA PACKAGES]" | tee -a $OUTPUT | |
| dpkg -l | grep -i nvidia | awk '{print $2 "\t" $3}' | tee -a $OUTPUT | |
| echo -e "\n[CUDA PACKAGES]" | tee -a $OUTPUT | |
| dpkg -l | grep -i cuda | awk '{print $2 "\t" $3}' | tee -a $OUTPUT | |
| # Driver conflicts | |
| echo -e "\n[POTENTIAL CONFLICTS]" | tee -a $OUTPUT | |
| echo "Blacklisted modules:" | tee -a $OUTPUT | |
| cat /etc/modprobe.d/* 2>/dev/null | grep -E "(blacklist|nouveau)" | tee -a $OUTPUT | |
| echo -e "\nMultiple driver versions:" | tee -a $OUTPUT | |
| dpkg -l | grep -E "nvidia-[0-9]+" | awk '{print $2}' | sort -u | tee -a $OUTPUT | |
| # X.org configuration | |
| echo -e "\n[XORG CONFIGURATION]" | tee -a $OUTPUT | |
| echo "Active display manager:" | tee -a $OUTPUT | |
| systemctl status display-manager --no-pager | head -3 | tee -a $OUTPUT | |
| echo -e "\nXorg config files:" | tee -a $OUTPUT | |
| ls -la /etc/X11/xorg.conf* 2>/dev/null | tee -a $OUTPUT | |
| ls -la /usr/share/X11/xorg.conf.d/*.conf 2>/dev/null | tee -a $OUTPUT | |
| # Current display setup | |
| echo -e "\n[DISPLAY STATUS]" | tee -a $OUTPUT | |
| xrandr --current 2>&1 | tee -a $OUTPUT | |
| # Recent errors | |
| echo -e "\n[XORG ERRORS (last 50 lines)]" | tee -a $OUTPUT | |
| sudo journalctl -b -u display-manager --no-pager | grep -E "(EE|WW)" | tail -50 | tee -a $OUTPUT | |
| echo -e "\n[KERNEL ERRORS (nvidia related)]" | tee -a $OUTPUT | |
| sudo dmesg | grep -iE "(nvidia|gpu|vga|display)" | grep -iE "(error|fail|warn)" | tail -30 | tee -a $OUTPUT | |
| # System logs | |
| echo -e "\n[RECENT NVIDIA EVENTS]" | tee -a $OUTPUT | |
| sudo journalctl -b --no-pager | grep -i nvidia | tail -30 | tee -a $OUTPUT | |
| # CUDA/Driver version matrix | |
| echo -e "\n[VERSION COMPATIBILITY]" | tee -a $OUTPUT | |
| echo "Driver version: $(nvidia-smi --query-gpu=driver_version --format=csv,noheader 2>/dev/null)" | tee -a $OUTPUT | |
| echo "CUDA versions installed:" | tee -a $OUTPUT | |
| ls /usr/local/cuda*/version.txt 2>/dev/null | xargs -I {} sh -c 'echo -n "{}: "; cat {}' | tee -a $OUTPUT | |
| # Recent package changes | |
| echo -e "\n[RECENT PACKAGE CHANGES]" | tee -a $OUTPUT | |
| grep -E "(nvidia|cuda)" /var/log/dpkg.log 2>/dev/null | tail -20 | tee -a $OUTPUT | |
| # Memory/Process info | |
| echo -e "\n[GPU MEMORY USAGE]" | tee -a $OUTPUT | |
| nvidia-smi --query-compute-apps=pid,process_name,used_memory --format=csv 2>&1 | tee -a $OUTPUT | |
| # Environment | |
| echo -e "\n[RELEVANT ENVIRONMENT]" | tee -a $OUTPUT | |
| env | grep -E "(CUDA|LD_LIBRARY|PATH)" | sort | tee -a $OUTPUT | |
| # Library conflicts | |
| echo -e "\n[LIBRARY CHECK]" | tee -a $OUTPUT | |
| echo "libcuda.so locations:" | tee -a $OUTPUT | |
| ldconfig -p | grep libcuda.so | tee -a $OUTPUT | |
| echo -e "\nlibGL errors:" | tee -a $OUTPUT | |
| ldd /usr/lib/x86_64-linux-gnu/libGL.so.1 2>&1 | grep -E "(not found|nvidia)" | tee -a $OUTPUT | |
| # Summary | |
| echo -e "\n[DIAGNOSTIC SUMMARY]" | tee -a $OUTPUT | |
| echo "Output saved to: $OUTPUT" | tee -a $OUTPUT | |
| echo -e "\nKey issues to check:" | tee -a $OUTPUT | |
| echo "1. Mixed open/closed source drivers" | tee -a $OUTPUT | |
| echo "2. Multiple CUDA versions" | tee -a $OUTPUT | |
| echo "3. Xorg configuration conflicts" | tee -a $OUTPUT | |
| echo "4. Recent package updates" | tee -a $OUTPUT | |
| echo -e "\nDiagnostic complete." | tee -a $OUTPUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment