Update CHECK-IOMMU.sh feat(script): add IOMMU enablement check with kernel log analysis

- Introduced check-iommu-enabled.sh to verify if IOMMU is enabled in the current system
- Parses 'dmesg' output for common Intel (VT-d), AMD (SVM), and DMAR/IOMMU entries
- Displays diagnostic result with a helpful recommendation if IOMMU is not active
- Includes root privilege warning and user-friendly output with ANSI color codes
- Useful for verifying virtualization passthrough readiness (e.g., PCIe, GPU)
This commit is contained in:
Oritorius(Denis Rykov) 2025-07-10 00:00:48 +05:00 committed by GitHub
parent ce79223f49
commit 99b66bddd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 35 additions and 8 deletions

View File

@ -1,16 +1,43 @@
#!/bin/bash
#
# Script: check-iommu-enabled.sh
# Goal: Check if IOMMU are Enabled in your system
# Goal: Check if IOMMU is enabled in the system
#
# Author: Gabriel Luchina
# https://luchina.com.br
# https://luchina.com.br
# 20220128T1112
# Updated: 2025-04-06
#
if [ `dmesg | grep -e DMAR -e IOMMU | wc -l` -gt 0 ]
then
echo "IOMMU Enabled"
else
echo "IOMMU NOT Enabled"
echo "Check file /etc/default/grub contains 'intel_iommu=on' in 'GRUB_CMDLINE_LINUX_DEFAULT' line"
# ANSI Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
# Check for root
if [ "$EUID" -ne 0 ]; then
echo -e "${YELLOW}Предупреждение: Рекомендуется запускать от root для полного доступа.${NC}"
fi
echo "Checking if IOMMU is enabled..."
# Check dmesg output for IOMMU-related messages
iommu_check=$(dmesg | grep -i -E 'iommu|DMAR|amd-vi')
if [[ -n "$iommu_check" ]]; then
echo -e "${GREEN}✅ IOMMU активирован в ядре!${NC}"
echo
echo "Найденные записи:"
echo "$iommu_check"
else
echo -e "${RED}❌ IOMMU не обнаружен или выключен.${NC}"
echo
echo -e "${YELLOW}Возможные причины:${NC}"
echo "1. В BIOS/UEFI отключена поддержка IOMMU (SVM Mode для AMD / VT-d для Intel)"
echo "2. Не добавлен параметр загрузки ядра:"
echo " Для Intel: intel_iommu=on"
echo " Для AMD: amd_iommu=on"
echo " Добавьте их в GRUB_CMDLINE_LINUX_DEFAULT в /etc/default/grub"
echo " Затем выполните: update-grub"
fi