当前位置: > Linux发行版 > FreeBSD >

在 FreeBSD bhyve 下运行 Windows (2)

时间:2015-12-23 12:46来源:linux.it.net.cn 作者:IT

Windows 安装过程

Windows 的安装过程分为三个主要的阶段:          

  • 第一个安装阶段(从 ISO 安装文件中复制文件)

     

  • 第二个安装阶段(Windows 实际解压并安装一些东西)

  • 第三个安装阶段(Windows 执行在 AutoUnattend.xml 中设置的“第一次登陆”命令)

在第一阶段开始之前,我喜欢打开另一个控制台并执行 iohyve console win2k8 命令。

 
1
2
3
4
$ sudo iohyve console win2k8
Password:
Starting console on win2k8...
~. to escape console [uses cu(1) for console]Connected

现在我们可以通过 iohyve uefi 命令开始安装 win2k8 客户机了。它应该会马上开始。

 
1
2
3
4
$ iohyve isolist
Listing ISO's...
null.iso
win2k8.iso$ sudo iohyve uefi win2k8 win2k8.iso

切换到你的其他控制台,过一会你应该会看到 Windows SAC

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Computer is booting, SAC started and initialized.                               
 
Use the "ch -?" command for information about using channels.                   
Use the "?" command for general help.                                           
 
 
SAC>                        
EVENT: The CMD command is now available.                                        
SAC>                                                                            
EVENT:   A new channel has been created.  Use "ch -?" for channel help.         
Channel: SACSetupAct                                                            
SAC>                                                                            
EVENT:   A new channel has been created.  Use "ch -?" for channel help.         
Channel: SACSetupErr                                                            
SAC>

你可以按 [Esc]+[Tab] 键然后回车来切换到显示了安装细节的 SACSetupAct 控制台。Calling WIMApplyImage 的部分会需要执行一段时间才会退出。

 


1
:\ProgramData\] doesn't exist; no need to move it before applying image.2015-12-08 10:51:09, Info                  IBS    MoveOldOSFiles:File/folder [E:\Recovery\] doesn't exist; no need to move it before applying image.2015-12-08 10:51:09, Info                  IBS    MoveOldOSFiles:File/folder [E:\Users\] doesn't exist; no need to move it before applying image.2015-12-08 10:51:09, Info                  IBS    MoveOldOSFiles:File/folder [E:\Windows\] doesn't exist; no need to move it before applying image.2015-12-08 10:51:09, Info       [0x06412c] IBSLIB SetCheckpoint: Checkpoint("WinPEArchiveOldWindowsFoldersStartCheckpoint") in progress...2015-12-08 10:51:09, Info       [0x06412e] IBSLIB SetCheckpoint: Checkpoint "WinPEArchiveOldWindowsFoldersStartCheckpoint" successfully set.2015-12-08 10:51:09, Info       [0x06412c] IBSLIB SetCheckpoint: Checkpoint("WinPEArchiveOldWindowsFoldersDoneCheckpoint") in progress...2015-12-08 10:51:09, Info       [0x06412e] IBSLIB SetCheckpoint: Checkpoint "WinPEArchiveOldWindowsFoldersDoneCheckpoint" successfully set.2015-12-08 10:51:09, Info       [0x06412c] IBSLIB SetCheckpoint: Checkpoint("WinPEImageApplyReadyCheckpoint") in progress...2015-12-08 10:51:09, Info       [0x06412e] IBSLIB SetCheckpoint: Checkpoint "WinPEImageApplyReadyCheckpoint" successfully set.2015-12-08 10:51:09, Info       [0x06009e] IBS    DeployWIMImage:Calling IDepWIMImageResolved::Apply...2015-12-08 10:51:10, Info       [0x0606cc] IBS    Calling WIMApplyImage (flags = 0x184)...

安装程序之后会继续将一些驱动程序文件复制到虚拟 HDD 中,之后你可以看到屏幕停在了下面的信息。需要注意的是,如果它似乎被冻结在了那里,那么客户机可能已经完成了它的第一个阶段安装并关机了。

Name:                  SACDescription:           Special AdminisType:                  VT-UTF8Channel GUID:          8472e3a1-9ddc-11e5-9c07-806e6f6e6963Application Type GUID: 63d02270-8aa4-11d5-bccf-806d6172696fPress <esc><tab> for next channel.Press <esc><tab>0 to return to the SAC channel.Use any other key to view this channel.

在第一个控制台上面,检查并确保客户机关机了。

 
1
2
3
$ iohyve list
Guest   VMM?  Running?  rcboot?  Description
win2k8  YES   NO        NO       Tue_Dec__8_10:30:51_MST_2015

从上面的信息我们可以看到 Running? 标志被设置为了 NO,这意味着客户机已经被关闭了。我们还需要运行 iohyve destroy win2k8 来从 VMM? 中移除它,不然客户机将在第二个安装阶段失败。

 
1
2
$ sudo iohyve destroy win2k8
Destroying win2k8...errno = 37

现在我们可以运行第二个阶段了:

 
1
$ sudo iohyve uefi win2k8 null.iso

如果你切换到了 SAC 控制台你可以改变 SACSetupAct 引导以及查看屏幕上滚过的东西。这个步骤是非常迅速的,而且有时候你并不能捕捉到 SACSetupAct 引导,所以当客户机关闭的时候你只能留下一个看起来如下的屏幕。

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Setup is updating registry settings...
EVENT:   A new channel has been created.  Use "ch -?" for channel help.
Channel: SACSetupAct
SAC>
EVENT:   A new channel has been created.  Use "ch -?" for channel help.
Channel: SACSetupErr
SAC>
EVENT: The CMD command is now available.
SAC>
EVENT:   A channel has been closed.
Channel: SACSetupAct
SAC>
EVENT:   A channel has been closed.
Channel: SACSetupErr
SAC>
The SAC will become unavailable soon.  The computer is shutting down.
 
SAC>

切换到你的第一个控制,检查以确保其再次关闭,并再次移除它。然后,你可以开始第三个阶段的安装,并最终第一次启动 Windows。

 
1
2
3
4
$ iohyve list
Guest   VMM?  Running?  rcboot?  Description
win2k8  YES   NO        NO       Tue_Dec__8_10:30:51_MST_2015$ sudo iohyve destroy win2k8
Destroying win2k8...errno = 37$ sudo iohyve uefi win2k8 null.iso


 

第一次登陆安装阶段确实需要相当多的时间来完成,但最终,你的屏幕上会显示如下信息:

 
1
2
3
4
5
6
7
8
9
Computer is booting, SAC started and initialized.                               
 
Use the "ch -?" command for information about using channels.                   
Use the "?" command for general help.                                           
 
 
SAC>                                                                            
EVENT: The CMD command is now available.                                        
SAC>

 如果我运行 SAC 命令 i,我可以看到在之前的 AutoUnattend.xml 文件中设置的客户机的 IP 地址。默认情况下,Windows 客户机无法 ping 通网络,但执行 nmap 192.168.0.111 将会显示 Windows 远程桌面可用。

 
1
2
SAC>i                                                                           
Net: 12, Ip=192.168.0.111  Subnet=255.255.255.0  Gateway=192.168.0.1

就是这样!你现在可以用你惯用的远程桌面客户端使用你在 AutoUnattend.xml 中设置的默认密码 R3dm0nd! 去连接客户机的 Administrator 帐户了。



 

安装后你可以做的一些很酷的东西

尽管 iohyve uefi 功能尚未被正式支持,你依然可以使用内置的 iohyve 工具为 Windows 客户机做一些很酷的关于动态文件系统(ZFS)的一些事情,比如在安装更新之前创建快照:

 
1
2
3
4
$ sudo iohyve snap win2k8@preupdate
Password:
Taking snapshot win2k8@preupdate$ iohyve snaplist
win2k8@preupdate

你也可以制作一个这个客户机的独立的拷贝,一旦你制作了这个镜像,你就可以不必一遍又一遍的执行 Windows 的安装过程了:

 
1
2
3
4
5
$ sudo iohyve clone win2k8 win2k8-deploy                                                                                               
Cloning win2k8 to win2k8-deploy$ iohyve list
Guest          VMM?  Running?  rcboot?  Description
win2k8         YES   NO        NO       Tue_Dec__8_10:30:51_MST_2015
win2k8-deploy  NO    NO        NO       Tue_Dec__8_11:34:38_MST_2015






 










  (责任编辑:IT)
------分隔线----------------------------