2013年10月28日 星期一

[研究] CentOS 6.4 變更 X-Window 解析度

[研究] CentOS 6.4 變更 X-Window 解析度

2013-10-28

CentOS 5.5 x86 在 VMware VM 如何切換解析度到 1024x768 ?
http://forum.icst.org.tw/phpbb/viewtopic.php?f=16&t=18531

CentOS 6.x 和 5.x 在螢幕解析度的設定變化很大,/etc/X11/xorg.conf 預設不存在,system-config-display 命令不再提供,改成 xrandr,本篇討論如何把 X-Window 解析度變成 1024x768 (如果你在 VM中安裝 CentOS 6.x 後 X-Window 解析度就是您要的,您可以跳過這篇不用看了)。

方法一:變更虛擬機器 (VM) 螢幕解析度規格

如果 CentOS 6.x 是在 VMware Workstation 10.0 (舊版不保證有此設定) 的 VM 中

(下圖) 先把 VM 做 PowerOff,在 VM 上按下滑鼠右鍵,選「Settings...」

(二) 點上方「Hardware」頁籤,點左邊「Display」,勾選右邊「Specify monitor settings」,變更您想要的解析度,按下「OK」按鈕。

如果您不是在 VMware Workstation 的 VM 中安裝 CentOS,或 VMware Workstation 舊版不支援此設定,或在實體主機上安裝,請看下面其他方法。

方法二變更 X-Window 登入後的解析度

小弟 X-Window 解析度是 1280x768,打算改成 1024x768

(下圖) 在 X-Window 中點選 System 下拉選單,選 Preferences,選 Display


(下圖) Resolution 拉選來選您要的解析度,按下 Apply 按鈕

(下圖) 按下 Keep This Configuration 按鈕

(下圖) 按下 Close 按鈕 (別又按下 Apply 按鈕)

(下圖) 畫面解析度會立刻變成你要的解析度 (小弟選 1024x768)
           選 System 下拉選單,選 Log Out .. 看看

(下圖) 很不幸,登入畫面解析度變回 1280x768

 ,但登入後變成 1024x768,執行 reboot 後再測試,情況依舊,也就是這個辦法只能對登入後解析度設定有效。

 方法三:自己寫 xorg.conf (失敗,不想看可跳過)

X-Window 的 log 寫在 /var/log/Xorg.0.log 檔案中,可以看到載入內建的預設資訊


把這端資訊寫入 /etc/X11/xorg.conf

Section "Device"
        Identifier      "Builtin Default vmware Device 0"
        Driver  "vmware"
EndSection
Section "Screen"
        Identifier      "Builtin Default vmware Screen 0"
        Device  "Builtin Default vmware Device 0"
EndSection
Section "Device"
        Identifier      "Builtin Default vesa Device 0"
        Driver  "vesa"
EndSection
Section "Screen"
        Identifier      "Builtin Default vesa Screen 0"
        Device  "Builtin Default vesa Device 0"
EndSection
Section "Device"
        Identifier      "Builtin Default modesetting Device 0"
        Driver  "modesetting"
EndSection
Section "Screen"
        Identifier      "Builtin Default modesetting Screen 0"
        Device  "Builtin Default modesetting Device 0"
EndSection
Section "Device"
        Identifier      "Builtin Default fbdev Device 0"
        Driver  "fbdev"
EndSection
Section "Screen"
        Identifier      "Builtin Default fbdev Screen 0"
        Device  "Builtin Default fbdev Device 0"
EndSection
Section "ServerLayout"
        Identifier      "Builtin Default Layout"
        Screen  "Builtin Default vmware Screen 0"
        Screen  "Builtin Default vesa Screen 0"
        Screen  "Builtin Default modesetting Screen 0"
        Screen  "Builtin Default fbdev Screen 0"
EndSection

然後對 Section "Screen" 都增加

        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes   "1024x768" "800x600"
        EndSubSection

最後變成

Section "Device"
        Identifier      "Builtin Default vmware Device 0"
        Driver  "vmware"
EndSection
Section "Screen"
        Identifier      "Builtin Default vmware Screen 0"
        Device  "Builtin Default vmware Device 0"
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes   "1024x768" "800x600"
        EndSubSection
EndSection
Section "Device"
        Identifier      "Builtin Default vesa Device 0"
        Driver  "vesa"
EndSection
Section "Screen"
        Identifier      "Builtin Default vesa Screen 0"
        Device  "Builtin Default vesa Device 0"
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes   "1024x768" "800x600"
        EndSubSection
EndSection
Section "Device"
        Identifier      "Builtin Default modesetting Device 0"
        Driver  "modesetting"
EndSection
Section "Screen"
        Identifier      "Builtin Default modesetting Screen 0"
        Device  "Builtin Default modesetting Device 0"
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes   "1024x768" "800x600"
        EndSubSection
EndSection
Section "Device"
        Identifier      "Builtin Default fbdev Device 0"
        Driver  "fbdev"
EndSection
Section "Screen"
        Identifier      "Builtin Default fbdev Screen 0"
        Device  "Builtin Default fbdev Device 0"
        SubSection "Display"
                Viewport   0 0
                Depth     24
                Modes   "1024x768" "800x600"
        EndSubSection
EndSection
Section "ServerLayout"
        Identifier      "Builtin Default Layout"
        Screen  "Builtin Default vmware Screen 0"
        Screen  "Builtin Default vesa Screen 0"
        Screen  "Builtin Default modesetting Screen 0"
        Screen  "Builtin Default fbdev Screen 0"
EndSection

但是存檔、reboot 後,登入畫面依然不是 1024x768,再找其他辦法。

方法四:修改 grub.conf 檔案

(下圖) PowerOn 開機或 reboot  時候約有 3 秒時間,趕快按下 Enter 按鍵,可以進入開機選單

(下圖) 按下 e 進行編輯(edit)

(下圖) 用上下移動方向鍵,移到 kernel 那行,按下 e 進行編輯

(下圖) 最後增加 vga=ask,按下 Enter 按鍵

(下圖) 按下 b 進行開機

(下圖) 按下 Enter 會列出所有解析度選項

(下圖) 小弟選了 1024x768x32 這個,編號 341  (不保證大家的都相同)

(下圖) 每次開機都要這樣編輯和選擇太累了,編輯 /boot/grub/grub.conf

 (下圖) kernel 那行最後增加  vga=0x341  ( 不要寫 vga=341)

(下圖) 存檔開機後,感覺速度有點變慢,圖案也有點不同

(下圖) 登入畫面變成 1024x768 了

(下圖) 另外小弟的 X-Window 是 GNOME,不保證對其他種類 X-Window 可行。

現在登入畫面、登入後畫面都變成 1024x768 了,如果有再發現其他方法,會再增加到這篇。

(小弟用 xrandr 想要變更 登入畫面的解析度,但都失敗,就不提過程了)

(完)

沒有留言:

張貼留言