在虛擬機器上安裝 RedHat Linux AS4.0 後,由於視頻配置時選擇色彩深度太高,把 16 位色配置為 24 位色,導致開啟圖形介面時出現花屏,螢幕寬度非常大,嚴重變形,不能操作。
既然是顯卡配置部分出現問題,就必須修改該部分的配置資訊。在這種情況下,這些應該進入單一使用者模式下完成:
首先重新啟動機器,在出現 grub 後,按字母“e”,然後會出現 grub 的設定檔,再按鍵盤移動游標到第二行“Kernal……”,再按“e”,然後在編輯介面輸入 single,斷行符號。然後按“b”重啟,就進入了“單一使用者模式”。
進入後在提示符 # 後敲入:vi /etc/X11/xorg.conf,然後會開啟這個視頻設定檔,再輸入“/Screen”(注意S是大寫)檢索到 Screen 部分,會顯示相關的配置的地方。
然後您按“i”鍵進入Vi編輯器的插入模式,把游標移動到“24”的位置,把這裡的 24 改為 16,然後按 ESC 鍵返回命令模式,按冒號“:”,輸入 wq,斷行符號,儲存、退出。鍵入 reboot 命令,斷行符號,重新啟動,圖形介面就出來了!
以下是一個正確的 xorg.conf 檔案的內容:
# XFree86 4 configuration created by pyxf86config
Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
# RgbPath is the location of the RGB database. Note, this is the name of the
# file minus the extension (like ".txt" or ".db"). There is normally
# no need to change the default.
# Multiple FontPath entries are allowed (they are concatenated together)
# By default, Red Hat 6.0 and later now use a font server independent of
# the X server to render fonts.
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "unix/:7100"
EndSection
Section "Module"
Load "dbe"
Load "extmod"
Load "fbdevhw"
Load "glx"
Load "record"
Load "freetype"
Load "type1"
Load "dri"
EndSection
Section "InputDevice"
# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))
# Option "Xleds" "1 2 3"
# To disable the XKEYBOARD extension, uncomment XkbDisable.
# Option "XkbDisable"
# To customise the XKB settings to suit your keyboard, modify the
# lines below (which are the defaults). For example, for a non-U.S.
# keyboard, you will probably want to use:
# Option "XkbModel" "pc102"
# If you have a US Microsoft Natural keyboard, you can use:
# Option "XkbModel" "microsoft"
#
# Then to change the language, change the Layout setting.
# For example, a german layout can be obtained with:
# Option "XkbLayout" "de"
# or:
# Option "XkbLayout" "de"
# Option "XkbVariant" "nodeadkeys"
#
# If you'd like to switch the positions of your capslock and
# control keys, use:
# Option "XkbOptions" "ctrl:swapcaps"
# Or if you just want both to be control, use:
# Option "XkbOptions" "ctrl:nocaps"
#
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "IMPS/2"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "yes"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Unknown monitor"
HorizSync 31.5 - 37.9
VertRefresh 50.0 - 70.0
Option "dpms"
EndSection
Section "Device"
Identifier "Videocard0"
Driver "s3"
VendorName "Videocard vendor"
BoardName "S3 Trio64 (generic)"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 16
SubSection "Display"
Viewport 0 0
Depth 16
Modes "800x600" "640x480"
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
Modes "800x600" "640x480"
EndSubSection
EndSection
Section "DRI"
Group 0
Mode 0666
EndSection
注意以上的 Section "Screen"……EndSection 部分,正是我們需要關心的地方。在實際中筆者發現,DefaultDepth 16 莫名其妙的變為了 DefaultDepth 16161616161616161616。SubSection "Display" 部分的兩個 16 都變為了 24,需要全部變回來。這裡表明是有 2 個顯示器的情況。
筆者對照 Redhat Linux 9.0 的情況,發現視頻設定檔不是 /etc/X11/xorg.conf,而是 /etc/X11/XF86Config(注意檔案名稱的大小寫),這個大家必須注意。XF86Config 的 Section "Screen"……EndSection部分也不同,如下所示,應該和機器的硬體設定有關係:
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 16
SubSection "Display"
Depth 16
Modes "800x600" "640x480"
EndSubSection
EndSection
*RedHat Linux AS4.0 即:RedHat Linux Enterprise Advanced Server 4.0 版。
本文來自“十萬個為什麼”電腦學習網 http://www.why100000.com
作者:張慶(網眼)2008-1-23