2011年8月30日 星期二

VirtualBox 與Guest Additions 安裝


由於工作上需要使用舊版本的Sun VirtualBox,但是由於顯示效果無法放到最大,所以改用下列方式解決
Step 1:  下載 VirtualBox Guest Additions ISO
你使用 VirtualBox 選單的「安裝 Guest Additions ...」之後,VirtualBox 通常會自動下載客端額外功能軟體的 CD ISO 影像檔,並且自動掛載。
若你使用的Ubuntu 太新,需要自行到官方網站下載 http://download.virtualbox.org/virtualbox/ , 選擇越新版的越好。
Step 2: 掛載 VBoxGuestAdditions CD ISO檔後,開啟它,並以 root 的權限執行其中的 VBoxLinuxAdditions-x86.run (32bit) / VBoxLinuxAdditions-amd64.run (64bit)。
Step 3: 用putty連線進去,關閉 gdm。
root@wayne-NB:~#  sudo service gdm stop
Step 4: 設定螢幕解析度,並重新啟動 gdm。
root@wayne-NB:~# sudo bash
root@wayne-NB:~# Xorg -configure

X.Org X Server 1.10.1
Release Date: 2011-04-15
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.24-29-server i686 Ubuntu
Current Operating System: Linux wayne-NB 3.0.3 #1 SMP Mon Aug 29 17:15:22 CST 2011 i686
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.0.3 root=/dev/sda1 ro quiet splash vt.handoff=7
Build Date: 19 April 2011  03:33:17PM
xorg-server 2:1.10.1-1ubuntu1 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.20.2
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Tue Aug 30 14:13:14 2011
List of video drivers:
        mga
        savage
        r128
        ati
        nouveau
        radeon
        siliconmotion
        intel
        cirrus
        rendition
        vmwlegacy
        apm
        sis
        s3virge
        vmware
        voodoo
        ztv
        i740
        openchrome
        sisusb
        trident
        ark
        i128
        neomagic
        qxl
        s3
        geode
        tdfx
        chips
        tseng
        mach64
        vboxvideo
        fbdev
        vesa
(EE) Failed to load module "vmwgfx" (module does not exist, 0)
(EE) vmware: Please ignore the above warnings about not being able to to load module/driver vmwgfx
(EE) vmware: Unexpected failure while loading the "vmwlegacy" driver. Giving up.
(EE) Failed to load module "vmware" (a required submodule could not be loaded, -1074796280)
(++) Using config file: "/root/xorg.conf.new"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE) open /dev/fb0: No such file or directory
Number of created screens does not match number of detected devices.
  Configuration failed.
ddxSigGiveUp: Closing log
root@wayne-NB:~# cp xorg.conf.new /etc/X11/xorg.conf
root@wayne-NB:~# service gdm start
gdm start/running, process 5080

Step 4:那麼在「顯示」控制台中,選擇我們所想要的螢幕解析度。
當我安裝額外功能並重新啟動 guest 系統後的第一次晝面,我的螢幕解析度有 1280x768 (按預設 12MB 顯示記憶體)。我啟動 Ubuntu Desktop 的「顯示」控制台,一開始顯示我可以選擇從 1280x768 到 640x480 的5種解析度。接著我將螢幕解析度下調到 1024x768。調整完畢後,我很訝異地發現,在「顯示」控制台內,我可以選擇的解析度只剩下 1024x768 到 640x480 的3種解析度了。我沒有辦法再往上調整更高的解析度了。
如果你跟我一樣碰到這種情形,我們需要編輯 /etc/X11/xorg.conf ,手動在 Screen 段落中,加入 Display 的子段落,明確地列出我們希望能調整的解析度項目。如下所示:
Section "Screen"
   Identifier   "Default Screen"
   Monitor      "Configured Monitor"
   Device      "Configured Video Device"

   DefaultDepth    24
   SubSection      "Display"
      Depth           24
      Modes           "800x600" "1440x900" "1360x768" "1280x1024" "1280x960" "1152x864" "1024x768" 
   EndSubSection

EndSection

上例設定範例,列出7種解析度,那麼在「顯示」控制台中,就會至少出現這7種解析度供我們選擇。不再愈調愈少。
登入晝面(GDM)會取 Modes 中的第一個項目作為解析度。所以我把 800x600 放在第一個。

 Ubuntu has a mechanism, that is, the installed network card (NIC) will be renamed to another name when the system is booted. Although there...