昨天編譯的Virtualbox有一個問題,虛擬機設置的共享文件夾不能使用,根本就找不到網絡地址,這可是個big problem!
沒有找到有效的解決方法,不知道是我的rpwt還是配置問題。不過我在主機配置了一個ftp服務器,好歹也能把虛擬機里下的東西傳到主機上了。另外發現一個問題,
虛擬機無法使用橋接方式上網,配置成橋接網絡的話,啟動時會報錯,是另外
兩個模塊沒有加載的原因,把昨天的腳本修改了一下,如下,將它復制粘貼保存為vbox,并chmod成可執行,覆蓋/etc/init.d下的同名文件即可。
#!/bin/bash
#by runsisi@163.com 2010-01-11
### BEGIN INIT INFO
# Provides: vbox
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The Virtual Box kernel module
# Description: The Virtual Box kernel module
### END INIT INFO
running()
{
lsmod | grep -q "$1[^_-]"
}
start()
{
echo $"Starting Virtual Box. "
if ! running vboxdrv; then
if ! modprobe vboxdrv; then
echo $"Failed."
return 1
else
chown root.vboxusers /dev/vboxdrv
fi
fi
if ! running vboxnetadp; then
if ! modprobe vboxnetadp ; then
echo $"Failed."
return 1
else
chown root.vboxusers /dev/vboxnetctl
fi
fi
if ! running vboxnetflt; then
if ! modprobe vboxnetflt; then
echo $"Failed."
return 1
fi
fi
return 0
}
stop()
{
if running vboxnetadp; then
if ! rmmod vboxnetadp; then
echo $"Cannot unload module vboxnetadp"
return 1
fi
fi
if running vboxdrv; then
if running vboxnetflt; then
if ! rmmod vboxnetflt; then
echo $"Cannot unload module vboxnetflt"
return 1
fi
fi
if ! rmmod vboxdrv; then
echo $"Cannot unload module vboxdrv"
return 1
fi
fi
return 0
}
status()
{
if running vboxdrv; then
if running vboxnetflt; then
if running vboxnetadp; then
echo $"VirtualBox kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are loaded."
else
echo $"VirtualBox kernel modules (vboxdrv and vboxnetflt) are loaded."
fi
else
echo $"VirtualBox kernel module is loaded."
fi
return 0
else
echo $"VirtualBox kernel module is not loaded."
return 3
fi
}
restart()
{
stop
start
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
*)
echo "Usage: vbox {start|stop|restart|status}"
exit 3
esac
exit 0
runsisi@HUST