@@ -458,15 +458,7 @@ cmd_diagnose() {
458458 echo " "
459459
460460 echo " [Bootloader]"
461- local bootloader=" Unknown"
462- if [[ -f /etc/default/limine ]]; then
463- bootloader=" Limine"
464- elif [[ -d /boot/grub ]]; then
465- bootloader=" GRUB"
466- elif [[ -d /boot/loader ]]; then
467- bootloader=" systemd-boot"
468- fi
469- echo " $bootloader "
461+ echo " $( detect_bootloader) "
470462 echo " "
471463
472464 echo " [Motherboard]"
@@ -597,8 +589,9 @@ cmd_diagnose() {
597589 echo " "
598590
599591 echo " [Kernel Command Line]"
592+ echo ' ```'
600593 cat /proc/cmdline
601- echo " "
594+ echo ' ``` '
602595 echo " "
603596
604597 echo " [IOMMU Parameters]"
@@ -684,7 +677,9 @@ cmd_diagnose() {
684677
685678 if [[ -f " $GPU_PASSTHROUGH_CONF " ]]; then
686679 echo " [GPU Configuration: $GPU_PASSTHROUGH_CONF ]"
680+ echo ' ```'
687681 cat " $GPU_PASSTHROUGH_CONF "
682+ echo ' ```'
688683 echo " "
689684 else
690685 echo " GPU passthrough not configured (run: omarchy-gpu-passthrough setup)"
@@ -694,13 +689,17 @@ cmd_diagnose() {
694689 if [[ -f " $LIMINE_DEFAULT " ]]; then
695690 echo " [Limine Configuration: $LIMINE_DEFAULT ]"
696691 echo " (Showing KERNEL_CMDLINE entries only)"
697- grep " ^KERNEL_CMDLINE" " $LIMINE_DEFAULT " || echo " No KERNEL_CMDLINE entries found"
692+ echo ' ```'
693+ grep " ^KERNEL_CMDLINE" " $LIMINE_DEFAULT " || echo " No KERNEL_CMDLINE entries found"
694+ echo ' ```'
698695 echo " "
699696 fi
700697
701698 if [[ -f " $VFIO_CONF " ]]; then
702699 echo " [VFIO Configuration: $VFIO_CONF ]"
700+ echo ' ```'
703701 cat " $VFIO_CONF "
702+ echo ' ```'
704703 echo " "
705704 else
706705 echo " VFIO configuration not found"
@@ -709,23 +708,36 @@ cmd_diagnose() {
709708
710709 if [[ -f " $BLACKLIST_CONF " ]]; then
711710 echo " [Driver Blacklist: $BLACKLIST_CONF ]"
711+ echo ' ```'
712712 cat " $BLACKLIST_CONF "
713+ echo ' ```'
713714 echo " "
714715 else
715716 echo " No driver blacklist configured"
716717 echo " "
717718 fi
718719
720+ if [[ -f /etc/mkinitcpio.conf ]]; then
721+ echo " [Initramfs Configuration: /etc/mkinitcpio.conf]"
722+ echo " (MODULES and HOOKS lines only)"
723+ echo ' ```'
724+ grep -E " ^MODULES=|^HOOKS=" /etc/mkinitcpio.conf || echo " No MODULES/HOOKS found"
725+ echo ' ```'
726+ echo " "
727+ fi
728+
719729 echo " [USB CONTROLLER DIAGNOSTICS]"
720730 echo " "
721731
722732 # Check udev rule for USB controller override
723733 local usb_udev_rule=" /etc/udev/rules.d/99-vfio-usb-override.rules"
724734 echo " [USB Controller udev Rule: $usb_udev_rule ]"
725735 if [[ -f " $usb_udev_rule " ]]; then
736+ echo ' ```'
726737 cat " $usb_udev_rule "
738+ echo ' ```'
727739 else
728- echo " Not configured (may cause xhci_hcd rebind issues)"
740+ echo " Not configured (may cause xhci_hcd rebind issues)"
729741 fi
730742 echo " "
731743
@@ -812,7 +824,9 @@ cmd_diagnose() {
812824 if [[ -f /etc/environment ]]; then
813825 echo " [System Environment (/etc/environment)]"
814826 echo " (GPU-related variables only)"
815- grep -E " AQ_DRM_DEVICES|WLR_DRM_DEVICES|CUDA" /etc/environment 2> /dev/null || echo " No GPU-related variables found"
827+ echo ' ```'
828+ grep -E " AQ_DRM_DEVICES|WLR_DRM_DEVICES|CUDA" /etc/environment 2> /dev/null || echo " No GPU-related variables found"
829+ echo ' ```'
816830 echo " "
817831 fi
818832
@@ -847,14 +861,16 @@ cmd_diagnose() {
847861
848862 if [[ -f " $LOG_FILE " ]]; then
849863 echo " [Last 50 lines of $LOG_FILE ]"
864+ echo ' ```'
850865 tail -50 " $LOG_FILE "
866+ echo ' ```'
851867 echo " "
852868 else
853869 echo " No logs found at $LOG_FILE "
854870 echo " "
855871 fi
856872
857- echo " RELEVANT BOOT MESSAGES (dmesg)"
873+ echo " [ RELEVANT BOOT MESSAGES (dmesg)] "
858874 echo " "
859875
860876 echo " [IOMMU Messages]"
@@ -877,6 +893,39 @@ cmd_diagnose() {
877893 sudo dmesg | grep -iE " xhci|usb.*controller" | head -20 || echo " No xhci messages"
878894 echo " "
879895
896+ echo " [TROUBLESHOOTING HINTS]"
897+ echo " "
898+
899+ # Check IOMMU status once
900+ local iommu_cmdline=false iommu_firmware=false
901+ grep -qE " intel_iommu|amd_iommu" /proc/cmdline 2> /dev/null && iommu_cmdline=true
902+ sudo dmesg 2> /dev/null | grep -q " Intel-IOMMU force enabled" && iommu_firmware=true
903+
904+ if [[ " $iommu_firmware " == " true" ]]; then
905+ echo " ℹ️ IOMMU enabled by firmware (intel_iommu=on may not be needed)"
906+ fi
907+
908+ if ! grep -q " iommu=pt" /proc/cmdline 2> /dev/null; then
909+ echo " ⚠️ iommu=pt not set - recommended for better performance"
910+ fi
911+
912+ # Only warn about bootloader/config if IOMMU not active
913+ if [[ " $iommu_cmdline " == " false" && " $iommu_firmware " == " false" ]]; then
914+ local bootloader=$( detect_bootloader)
915+ [[ " $bootloader " != " limine" ]] && \
916+ echo " ⚠️ Bootloader '$bootloader ' requires manual kernel parameter configuration"
917+ [[ -f /etc/omarchy-gpu-passthrough.conf ]] && \
918+ echo " ⚠️ Setup may be incomplete - config saved but IOMMU not active"
919+ fi
920+
921+ # Laptop detection
922+ detect_hybrid_graphics_laptop
923+ if [[ " $IS_MUXLESS_LAPTOP " == " true" ]]; then
924+ echo " ℹ️ Laptop detected (MUX-less hybrid graphics)"
925+ echo " ℹ️ Internal display on iGPU - safe for dGPU passthrough"
926+ fi
927+ echo " "
928+
880929 echo " [END OF DIAGNOSTICS REPORT]"
881930 echo " "
882931 echo " Report saved to: $output_file "
@@ -889,8 +938,6 @@ cmd_diagnose() {
889938 msg_success " Report saved: $output_file "
890939}
891940
892- # Command Implementations
893-
894941cmd_detect () {
895942 msg_section " GPU Detection"
896943
@@ -919,16 +966,35 @@ cmd_detect() {
919966 echo " "
920967 done
921968
922- # IOMMU status
969+ echo " IOMMU Status:"
970+ local iommu_cmdline=false
971+ local iommu_firmware=false
972+
973+ if grep -qE " (intel_iommu|amd_iommu)=on" /proc/cmdline 2> /dev/null; then
974+ iommu_cmdline=true
975+ fi
976+
977+ if journalctl -k -b 2> /dev/null | grep -q " Intel-IOMMU force enabled" ; then
978+ iommu_firmware=true
979+ fi
980+
923981 if check_iommu_support; then
924982 msg_success " IOMMU: Enabled"
983+ if [[ " $iommu_firmware " == " true" ]]; then
984+ echo " Source: Firmware-enabled (Tiger Lake or similar)"
985+ elif [[ " $iommu_cmdline " == " true" ]]; then
986+ echo " Source: Kernel cmdline"
987+ fi
925988 else
926989 msg_warning " IOMMU: Not detected"
927990 echo " Possible causes:"
928991 echo " 1. IOMMU not enabled in BIOS (AMD-Vi or Intel VT-d)"
929992 echo " 2. Kernel parameters not set → run: omarchy-gpu-passthrough setup"
930993 echo " 3. Reboot needed after setup"
931994 fi
995+
996+ echo " "
997+ echo " Bootloader: $( detect_bootloader) "
932998}
933999
9341000cmd_status () {
0 commit comments