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

VMware 虛擬機 Ubuntu 鼠標滾輪失效修復:xorg.conf 配置與 vmmouse 驅動適配

編輯:Linux 教學

現象:Windows 宿主機 VMware Workstation 運行 Ubuntu 客體,鼠標滾輪無響應

經典問題:VMware Tools 安裝後仍無滾輪,或滾輪方向反轉、跳動。

根因:輸入設備協議與驅動不匹配

  • VMware 虛擬鼠標設備標識為 vmmouse 驅動,而非通用 mouse。
  • 舊配置常用 Protocol "PS/2" 或 "ImPS/2",但 vmmouse 需特定協議與選項組合。
  • 缺少 ZAxisMapping (滾輪軸映射) 與 Emulate3Buttons (模擬中鍵)。

修復步驟:編輯 /etc/X11/xorg.conf

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
sudo vim /etc/X11/xorg.conf

完整 InputDevice 區段 (經驗證可用)

Section "InputDevice"
    Identifier  "Configured Mouse"
    Driver      "vmmouse"              # 關鍵:VMware 專用驅動
    Option      "Protocol" "ImPS/2"    # 協議:ImPS/2 支援滾輪 (Z 軸)
    Option      "CorePointer"
    Option      "Device" "/dev/input/mice"
    Option      "ZAxisMapping" "4 5"   # 滾輪上/下映射為按鈕 4/5
    Option      "Emulate3Buttons" "yes" # 模擬中鍵 (雙鍵同時按下)
EndSection

關鍵點解析

選項作用常見錯誤值
Driver必須為 vmmouse (VMware Tools 提供)mouse (通用驅動,無法識別虛擬設備特性)
ProtocolImPS/2 (IntelliMouse PS/2,支援 Z 軸)PS/2 (無滾輪)、ExplorerPS/2 (舊)
ZAxisMapping將滾輪事件映射為按鈕 4/5 (X11 標準)缺失或寫錯 (如 "5 4" 導致反向)
Emulate3Buttons雙鍵同時按下模擬中鍵 (粘貼/滾動)缺失導致中鍵無效

生效驗證

# 重啟 X Server (任選一)
sudo systemctl restart display-manager  # systemd 系統
# 或
sudo init 3 && sudo init 5              # SysVinit 系統
# 或 (最暴力)
Ctrl+Alt+Backspace  (需啟用 DontZap 選項)

測試:瀏覽器/終端/文件管理器滾輪滾動、中鍵粘貼。

現代替代:libinput + Wayland (Ubuntu 18.04+ 默認)

  • 新版 Ubuntu 使用 Wayland 顯示協議 + libinput 輸入堆棧,**無需 xorg.conf**。
  • VMware Tools 現代版 (open-vm-tools) 內建 libinput 支援,**開箱即用滾輪**。
  • 若仍用 Xorg 會話 (登入選單選「Ubuntu on Xorg」),上述配置依然有效。

避坑提示

  • 修改前備份:cp /etc/X11/xorg.conf{,.bak} — 配置錯誤會導致圖形界面無法啟動,需進單用戶模式恢復。
  • 多輸入設備衝突:若同時有 USB 鼠標,可能需額外 InputClass 區分配置。
  • VMware Tools 版本:建議安裝開源 open-vm-tools + open-vm-tools-desktop (發布版倉庫) 而非 VMware 官方安裝腳本 — 內核升級自動重編譯模塊、無內核模塊簽名問題。

總結

Driver "vmmouse" + Protocol "ImPS/2" + ZAxisMapping "4 5" + Emulate3Buttons "yes" — 這四項是 VMware 虛擬機 Xorg 會話下鼠標滾輪正常工作的鐵律。現代系統優先用 Wayland+libinput 免配置;必須用 Xorg 時,按此配置一勞永逸。

Copyright © Windows教程網 All Rights Reserved