Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Fedora 安裝 VirtualBox 核心模組編譯失敗:Kernel Headers 不符與 PAE 核心完整解決流程

編輯:Linux 教學

錯誤現象

Fedora 14 安裝 VirtualBox 後執行 /etc/init.d/vboxdrv setup 失敗:

Makefile:152: *** Error: unable to find the sources of your current Linux kernel.
Specify KERN_DIR= and run Make again.

安裝 kernel-devel 後重新編譯:

KERN_DIR=/usr/src/kernels/2.6.32.21-166.fc12.i686 /etc/init.d/vboxdrv setup
Recompiling VirtualBox kernel module [ OK ]
Starting VirtualBox kernel module [FAILED]
(modprobe vboxdrv failed. Please use 'dmesg' to find out why)

dmesg 顯示:

vboxdrv: version magic '2.6.32.21-166.fc12.i686 SMP mod_unload 686' should be '2.6.32.21-166.fc12.i686.PAE SMP mod_unload 686'

根因

系統運行的是 PAE 核心 (支援 4GB 以上記憶體),但安裝的 kernel-devel 為非 PAE 版本,導致編譯出的模組版本魔術碼不符,無法載入。

完整解決步驟

  1. 安裝對應 PAE 核心開發套件:
yum install kernel-PAE-devel.i686

安裝完成後,/usr/src/kernels/ 下會新增 2.6.32.21-166.fc12.i686.PAE 目錄。

  1. 指定正確 KERN_DIR 重新編譯:
KERN_DIR=/usr/src/kernels/2.6.32.21-166.fc12.i686.PAE /etc/init.d/vboxdrv setup

輸出應顯示:

Stopping VirtualBox kernel module [ OK ]
Removing old VirtualBox netadp kernel module [ OK ]
Removing old VirtualBox netflt kernel module [ OK ]
Removing old VirtualBox kernel module [ OK ]
Recompiling VirtualBox kernel module [ OK ]
Starting VirtualBox kernel module [ OK ]

補充:PAE 核心簡介

  • Physical Address Extension (PAE) 讓 32-bit CPU 透過 36-bit 實體位址支援高達 64GB 記憶體。
  • Intel Pentium Pro 及以上、AMD Athlon 及以上 CPU 均支援。
  • Fedora/i686 預設若偵測到 >4GB 記憶體或啟用 PAE 選項,會安裝 PAE 核心。

通用檢查指令

# 確認目前運行核心
uname -r
# 輸出範例:2.6.32.21-166.fc12.i686.PAE

# 確認已安裝 kernel-devel 版本
rpm -qa | grep kernel-devel
# 需包含對應 .PAE 版本

# 確認 KERN_DIR 位置
ls /usr/src/kernels/

適用範圍

所有基於 RPM 的發行版 (Fedora、RHEL、CentOS、openSUSE 等) 遇到 VirtualBox、VMware、NVIDIA 驅動等核心外掛模組編譯失敗,核心原則相同:運行核心版本、kernel-devel 版本、KERN_DIR 指向必須三者完全一致 (含 PAE/debug 等後綴)。

Copyright © Windows教程網 All Rights Reserved