Try   HackMD

虛擬機設定

tags: virtualization

自從前幾天 win7 不更新後,身為一個有資安意識的玩家來說一定要換到正在更新的 win10 ,而我的 vm workstation 也因為 win7 升級到 win10 不能用了 QQ

本來想重裝 vmware workstation 但一直報說有毒,我有點擔心 (是說之前用那麼久也沒在擔心的就是了),等哪天處理這方面的事情變強之後再研究看看有沒有問題好了

Anyway, 目前我先用 virtualbox 代替,反正筆電也是用 virtualbox ,跑其他 vm 還行,湊合著用,接下來這邊大概會記錄一些玩虛擬化技術的文章,怕自己忘記 -2020/1/20

virtualbox 開啟 Nested VT-x/AMD-V

這兩個技術好像是 intel 和 amd 兩家生產晶片的公司專門為自家晶片打造的技術,有了他們的支持,虛擬機內跑其他系統會更流暢

不過有點很奇怪,virtualbox 預設居然是不給你啟用的,所以我特地上網找了下要怎麼啟用
資料

  1. 先到VirtualBox 安裝資料夾
  2. 打開 cmd 或 powershell
  3. 輸入
.\VBoxManage.exe modifyvm <VM_NAME> --nested-hw-virt on

之後會發現剛剛不能勾選的框框現在可以打勾了

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Windows 家用版啟動 hyper-v

久聞 hyper-v 大名 ,想說都換到 win10 沒道理不開起來看一下,不過預設家用版好像沒有,要自己下載的樣子 (好像不用錢)

所以上網看到某篇農場文有教學,大概看過裡面的 code 應該沒啥問題
農場文

code 如下:

pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL

保存成批次檔,用 administrator 執行,就會發現 cmd 正在安裝,最後會要你重新啟動,大膽重新啟動即可

Win10 關閉/啟動 hyper-v

這篇其實是前兩篇總合的結果,我安裝完 hyper-v 後想打開 virtualbox 卻發現怎麼也開不了,後來找了下資料,好像是 hyper-v 是 type 1 的 vm 而 virtualbox 是 type 2 ,當 type 1 開啟的時候 type 2 就不能跑

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

解決方法有兩種:

  1. 把 hyper-v 關掉
  2. 開機時建立 hyper-v 選單

因為第二種看起來比較麻煩,所以我只看了第一種

方法很簡單:

  1. 打開管理員執行的 cmd
  2. 輸入 bcdedit
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

這邊的 {current} 猜測代表 current user ,拉到下面會看到 hypervisorlaunchtype

  1. 輸入 bcdedit /set {current} hypervisorlaunchtype off 後會把 hyper-v 關掉,不過需要重新開機

如果哪天要重開 hyper-v 的話:
bcdedit /set {current} hypervisorlaunchtype auto 即可

Virtualbox 拖曳失敗的重啟

Virtualbox 不知道是不是因為免錢的關係,某些功能真的跟 vmware 不能比,這個 host to guest drop 的功能時不時當掉搞得我很心煩,以前的我都是重啟 vm 不過太花時間,下面紀錄一下比較快速的方法:

  1. 從 task manager 找到 virtualbox tray.exe

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. end task

  2. 從 \windows\system32\VBoxTray.exe 並啟動即可

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

嫌麻煩可以設快捷到桌面上

附錄

vmware workstation 官方載點