2008-08-14

在 Aspire One Linux 安裝 VirtualBox

即使 Linux 桌面已經很好用了,還是難免有需要用到 IE 、網路銀行、電子下單等等功能的時候,所以安裝一套 VirtualBox 再裝個 Windows XP 或 2000 應該是再好不過的選擇了。恰好,宏碁今天早上釋出了 Aspire One Linux 用的 2.6.23.9lw 的 kernel source ,我們正好拿來試試。
先說個題外話。他們剛釋出原始碼不久,我就接到宏碁請託本公司某部門的人來電關切,說大家可以認識認識,有什麼需求當面比較容易談清楚。不過既然原始碼都放出來,也就不用見面了,廠商客戶雙贏,挺好的。

安裝有一些要點: (1)需要 vboxdrv.ko (2)要把 user 加進 vboxusers 群組 (3)之前關掉 swap 的人記得先暫時加回去。以下分項說明。

先去下載VirtualBox,選擇 Fedora 8 (i386) 版,進 terminal 中 rpm -ivh VirtualBox-1.6.4_33808_fedora8-1.rpm 。這時候一定會看到無法編譯 kernel module 的訊息。沒關係,我們下一步就要處理。

編譯 vboxdrv.ko
先講正規的做法。首先,去 Aspire One 的FTP站下載核心原始碼。建議下載到裝在桌機的 Linux 再編譯...
由於他們使用 zip 壓縮,symbole link 被還原了,所以其中有一個目錄得先砍掉,否則不能編譯。假設你下載到另一台 Linux 上的 /usr/src ,解開來,然後輸入以下命令:

# unzip ~/Aspire_One_Linpus_Linux/Aspire_One_Source/linux-2.6.23.9lw.zip
# cd linux-2.6.23.9/
# cp ../config_080627 .config
# cd include
# rm -fr asm
# cd ..
# make oldconfig
# make bzImage modules

編譯完後,把整個目錄 tar 起來 copy 到 Aspire One 上面,或是 rsync 一下... 然後,為了編譯 vboxdrv 需要再安裝一些套件:
yum install make gcc

最後執行
/etc/init.d/vboxdrv setup
就解決了。
我知道這些步驟對一般 user 來說不容易,所以準備好編譯完的檔案,請下載後,輸入
tar zfx vboxdrv.tgz -C /
就裝好 vboxdrv.ko 了。

修改執行環境
打開編輯器,修改 /etc/group ,找到下面這行,然後加上 user:
vboxusers:x:502:user
需要重新開機。

安裝 Guest OS
安裝前,記得進 terminal ,掛進剛剛做好的 module 。如果你按照前幾篇關掉了 swap,這時候最好先加回來... 建議! 如果你在桌機上裝好再 copy vdi 檔過來,就不用加 swap 了。

su -
/etc/init.d/vboxdrv start
/etc/init.d/vboxnet start
# 要加 swap 的話請打下面 4 行. 這樣才不會傷害脆弱的 SSD? (誤)
cd /media/disk
dd if=/dev/zero of=swap.1 bs=1k count=1024k
mkswap swap.1
swapon swap.1

然後在桌面上按右鍵選「系統→Sun xVM VirtualBox」,用 user 的權限開進去。
建議先在桌機上安裝,安裝好後再把 .vdi copy 進來。安裝需要一點時間...

有圖有真相:


切 Virtual Disk 的時候記得指定 /media/disk/xp.vdi ,不然它還是會寫進 SSD 裡。


快照資料夾順便改一下:


要從網路芳鄰 share CD-ROM 再安裝雖然可以,但還是比較建議先在桌機裝好再說:


如果出現這個畫面,表示你忘了 /etc/init.d/vboxdrv start:


裝吧裝吧~~


繼續努力~~


開起來了! 耶~


補充說明
如果要外掛 USB 硬碟,或許你需要 ntfs 驅動程式... 試試
yum install ntfs-3g

如果你在桌機安裝,建議先把 Storage Expansion 裡的 SD 卡拿到桌機再 copy vdi 檔,不然你會覺得 Aspire One 好像當掉一樣,但事實上... 我也不確定當了沒。在桌機 copy 一整個 4GB 的 vdi 檔到 SD 卡,約需要 13 分鐘。

9 則留言:

John J. C. Lew 提到...

Dear LJMID,

Admire your knowledge on Linux issue. I haven't owned a Acer aspire one linux. The XP version is just out here in Malaysia for RM 1699. The linux version is RM 1299. I'm not very happy to pay for windows license because I don't really want to use it. But the 120G harddisk is really good for lots of storage.

Anyway, good job and keep it up!

John Lew
www.lews.info

miaoski 提到...

Dear John,
Thanks. Pity that you've to pay M$ tax. It's worthy to install any Linux distribution on Aspire One. Faster and smoother.
Cheers.

Unknown 提到...

請問...

"編譯完後,把整個目錄 tar 起來 copy 到 Aspire One 上面,或是 rsync 一下"

是指將 linux-2.6.23.9 copy 到 Aspire One 的哪一個目錄? "/"or"/usr/src/"?

謝謝!最近剛買下 Aspire One 的 Linux 新手...

miaoski 提到...

Hi Sunny,
到 /usr/src
事實上直接 download 包好的檔案,可能比較直觀一點... 那個目錄幾百 MB, copy 到 AspireOne 上要很久很久...
文中有附 download 的連結.

Unknown 提到...
作者已經移除這則留言。
Unknown 提到...

Dear LJMID:



I am Sunny. Many thanks for your last rapid response! But my Virtualbox is still not work in my Aspire ONE... I have already try 3 times recovery after fail virtualbox installation (my poor MLC SSD)...



I'm a new Linux user. My job is not related to computor. I had just only experienced ubuntu in this half a year. And I don't want to touch Microsoft because it cost me many money & lots of viruses. So I select Acer One (SSD with Linux edition) for mobile device (mobile business needed). But I still have the need for MS softwares sometimes (only Office, SPSS, Outlook... etc, no games or 3D-studio needed). The Virtualbox in Aspire one is important for my daily work.



I had successfully used my ubuntu desktop with virtualbox for several weeks. But I experienced really difficully installation in Linpus system. My problems are listed below. It may waste you some minutes, sorry!



1) I only got VirtualBox-2.0.2_36488_fedora8-1.i386.rpm via Sun website. The VirtualBox-1.6.4_33808_fedora8-1.rpm is out-of-date when I got your blogger via Google search. Is it the same setting between 2.0.2 & 1.6.4 edition like your presentation?



2) Last time I asked: "編譯完後,把整個目錄 tar 起來 copy 到 Aspire One 上面 to /usr/src". Then I figured out your download file "vboxdrv.zip" had only one file "/lib/modules/2.6.23.9lw/misc/vboxdrv.ko". Is it enough for VirtualBox-2.0.2_36488_fedora8-1.i386.rpm ?



3) What is the timing of "rpm -ivh VirtualBox-2.0.2_36488_fedora8-1.i386.rpm"? Is it right for my installation procedures:
--1. Shall I unzip "Linux-2.6.23.9lw.zip" to Aspire ONR /usr/src in step 1 ?
--2."yum install make gcc" in my Aspire ONE
--3. Download & "tar zfx vboxdrv.tgz -C /"
--4. "rpm -ivh VirtualBox-2.0.2_36488_fedora8-1.i386.rpm"
--5. "/etc/init.d/vboxdrv setup"
--6. Add "user:vboxusers:x:502:user"

Lot of questions need your professional expertise. Many thanks!

Unknown 提到...

Dear LJMID:

I made a wrong title in last message. Sorry! Sunny

miaoski 提到...

Hi Sunny,
沒問題,請別在意。
我後來把 AspireOne 轉手給同事了,我做的這個檔案妳用用看,如果不行的話大概就得去找有機器的人囉...
請到下載這個檔案,然後一樣用 tar zfx vboxdrv-2.0.2.tar.gz -C / 解開。
做一次 depmod -a (因為我們剛新加了一個 module)
再 /etc/rc.d/init.d/vboxdrv start 試試。

直接在機器上操作對它的 MLC SSD 真的很傷 *嘆*

希望能幫上妳的忙。

Unknown 提到...

您好!
本人最近入手一部aspire one,為了安裝virtual box傷透腦筋.所幸根據您大作中的指引,以及與sunny的問答中,摸索出來而成功安裝.在此向你致謝!