Ubuntu9.10betaにVMware Server 2をインストール

結果はモジュールのコンパイルでエラーがでたけど、適当に修正してみたらコンパイルは通ってくれて、インストールはできたよ☆ です。
実際のところ、まともに動くのかはわかりません。。

インストール

基本はここの通り
How To Install VMware Server 2 On Ubuntu 9.04

モジュールのコンパイルでエラー

今回問題だったのは、モジュールのコンパイルのところ。
エラー内容は これ とか 。以下のようなもの。

[text]In file included from /tmp/vmware-config2/vmnet-only/vm_basic_asm.h:46,
from /tmp/vmware-config2/vmnet-only/vm_oui.h:28,
from /tmp/vmware-config2/vmnet-only/vnetInt.h:25,
from /tmp/vmware-config2/vmnet-only/netif.c:46:
/tmp/vmware-config2/vmnet-only/vm_basic_asm_x86.h:62:7: warning: "_MSC_VER" is not defined
/tmp/vmware-config2/vmnet-only/vm_basic_asm_x86.h:177:7: warning: "_MSC_VER" is not defined
/tmp/vmware-config2/vmnet-only/vm_basic_asm_x86.h:346:7: warning: "_MSC_VER" is not defined
/tmp/vmware-config2/vmnet-only/vm_basic_asm_x86.h:453:7: warning: "_MSC_VER" is not defined
/tmp/vmware-config2/vmnet-only/netif.c: In function ‘VNetNetIfSetup’:
/tmp/vmware-config2/vmnet-only/netif.c:201: error: ‘struct net_device’ has no member named ‘init’
/tmp/vmware-config2/vmnet-only/netif.c:202: error: ‘struct net_device’ has no member named ‘open’
/tmp/vmware-config2/vmnet-only/netif.c:203: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/tmp/vmware-config2/vmnet-only/netif.c:204: error: ‘struct net_device’ has no member named ‘stop’
/tmp/vmware-config2/vmnet-only/netif.c:205: error: ‘struct net_device’ has no member named ‘get_stats’
/tmp/vmware-config2/vmnet-only/netif.c:206: error: ‘struct net_device’ has no member named ‘set_mac_address’
/tmp/vmware-config2/vmnet-only/netif.c:207: error: ‘struct net_device’ has no member named ‘set_multicast_list’
make[2]: *** [/tmp/vmware-config2/vmnet-only/netif.o] Error 1
make[1]: *** _module_/tmp/vmware-config2/vmnet-only Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-4-generic’
make: *** http://vmnet.ko Error 2
make: Leaving directory `/tmp/vmware-config2/vmnet-only’
Unable to build the vmnet module.[/text]

ぱっとみ、struct net_device が変更になって、メンバがないんだろうなー、という感じ。
調べてみると、ubuntu9.10になってカーネルのバージョンが2.6.31.14とかに上がったことで、struct net_deviceが変更になってりる?ぽい。
何か多少直せば動きそうだったので、試しにソースをいじってみたらコンパイルは通った(正常動作してるかは知らないw)

適当に修正してみた

直したところは他にもあるが、おそらく以下の部分でコンパイルは通る気がする。
net_deviceが変わったカーネルのバージョンやらそれぞれポインタ設定するところがあってるのか、全然確認していません。
[text]diff -Nurp vmnet-only/netif.c vmnet-only_mod/netif.c
— vmnet-only/netif.c 2009-03-27 15:10:04.000000000 +0900
+++ vmnet-only_mod/netif.c 2009-10-15 21:04:54.000000000 +0900
@@ -193,11 +193,28 @@ VNetNetifTxTimeout(struct net_device *de
*
*———————————————————————-
*/
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+static const struct net_device_ops vm_netdev_ops = {
+ .ndo_init = VNetNetifProbe,
+ .ndo_open = VNetNetifOpen,
+ .ndo_start_xmit = VNetNetifStartXmit,
+ .ndo_stop = VNetNetifClose,
+ .ndo_get_stats = VNetNetifGetStats,
+ .ndo_set_mac_address = VNetNetifSetMAC,
+ .ndo_set_multicast_list = VNetNetifSetMulticast
+};
+#endif
+
+

static void
VNetNetIfSetup(struct net_device *dev) // IN:
{
ether_setup(dev); // turns on IFF_BROADCAST, IFF_MULTICAST
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ dev->netdev_ops = &vm_netdev_ops;
+#else
dev->init = VNetNetifProbe;
dev->open = VNetNetifOpen;
dev->hard_start_xmit = VNetNetifStartXmit;
@@ -205,6 +222,7 @@ VNetNetIfSetup(struct net_device *dev)
dev->get_stats = VNetNetifGetStats;
dev->set_mac_address = VNetNetifSetMAC;
dev->set_multicast_list = VNetNetifSetMulticast;
+#endif[/text]

・編集するは以下の手順

  1. VMware-server-2.0.1-156745.i386.tar.gzを展開
  2. できあがったフォルダ「vmware-server-distrib」の中の「 lib/modules/source 」を開いて
  3. vmnet.tarを展開
  4. 展開された「vmnet-only」を開いて
  5. 「netif.c」を編集して上の修正を入れる。
  6. lib/modules/source に戻り、
  7. vmnet-onlyを右クリックして「Compress」
  8. ファイル名を「vmnet」、圧縮方法を「 .tar」にして、sourceに作成する。

その後、再度インストールをやり直せばいいかもしれません。

さてさて、次は9.04から治せないでいる以下の問題を確認してこよう。。。

Ubuntu9.04起動時、VM自動起動後、ネットワークをoff/onしないとVMがネットワークに繋がらない
電源Off時、VMが自動終了してくれない。
突然落ちた感じになり、次の起動時にVMWareServer2自体がうまく動作しない
これは、電源Off時にスクリプトで先にVMを終了命令投げて、30秒くらい待ってから電源Offるようにしてる。

これって、デスクトップ向けに起動と終了を早くしたがために、まともに起動&終了処理する時間がないからなのだろうか・・・

#追記
上の起動と終了時の問題は9.10だと発生しませんでした。わーい。