幼敏悟过人,读书辄成诵。这篇文章主要讲述聊聊VDI虚拟桌面的SID问题-前传(下)相关的知识,希望能为你提供帮助。
?这一系列的文字(聊聊VDI虚拟桌面的SID问题-前传「上」、聊聊VDI虚拟桌面的SID问题-前传「中」)其实都是为了这一篇:因为之前项目中出现了不少不能完成自定义过程导致桌面池无法完整制备的问题,当我尝试解决这些问题之后,就非常想记录下来。排错的基本思路是分段和隔离,接下来我们就分别看看这些环节。
Sysprep的诊断
?Sysprep自身会在不同阶段写入不同日志。
项目 | 日志路径 |
---|---|
Generalize | %WINDIR%\\System32\\Sysprep\\Panther |
Specialize | %WINDIR%\\Panther |
(OOBE的无人参与 Windows 安装程序操作) | %WINDIR%\\Panther\\Unattendgc |
?只要我们看到大概在哪个阶段出现了问题,就可以去找对应的日志看看原因。如果没有日志呢?那说明都没执行到这一步……
VC自定义的诊断
?使用VC的自定义规范时,除了Sysprep,还可以检查GuestCsutUtil的日志。看上去这个日志的路径是 C:\\WINDOWS\\TEMP\\customize-guest.log 。看一个例子吧…
[2016-05-24T16:10:37INFO] GuestCustUtil invoked.
[2016-05-24T16:10:37INFO] Params: customize -sealparam "/quiet /generalize /oobe /reboot" -nics 4000 -schedulenativeunobfusc
[2016-05-24T16:10:37INFO] Checking for Windows Sysprep Respecialize operation.
[2016-05-24T16:10:37 DEBUG] Sysprep process is currently running.
[2016-05-24T16:10:37INFO] Windows Sysprep Respecialize operation was detected.
[2016-05-24T16:10:37INFO] Copying files from C:\\Windows\\TEMP\\vmwA4EB.tmp to C:\\Windows\\TEMP\\vmwB575.tmp.
[2016-05-24T16:10:40INFO] Rescheduling Guest OS Customization.
[2016-05-24T16:10:40 DEBUG] Executing command C:\\Windows\\system32\\schtasks.exe /create /sc ONSTART /rl HIGHEST /np /z /v1 /ru SYSTEM /tr "C:\\Windows\\TEMP\\vmwB575.tmp\\guestcustutil.exe customize -sealparam \\"/quiet /generalize /oobe /reboot\\" -nics 4000 -schedulenativeunobfusc" /tn "VMware Guest OS Customization Task"
[2016-05-24T16:10:41INFO] Waiting for Sysprep to exit.
[2016-05-24T16:10:42INFO] Sysprep is no longer running.
[2016-05-24T16:12:42INFO] Rebooting...
[2016-05-24T16:12:42 DEBUG] Successfully retreived process access token.
[2016-05-24T16:12:42 DEBUG] Got LUID for SHUTDOWN privilege.
[2016-05-24T16:12:42 DEBUG] Successfully added shutdown privilege.
[2016-05-24T16:12:42INFO] GuestCustUtil exiting.
?如果是VC自定义的过程,建议先看看这个日志,再去看Sysprep的日志寻找问题根源。
几个遇到的问题 - 因为Microsoft Store应用导致的失败
?我们在之前说过,如果通用化之前安装或更新过Microsoft Store应用,将会导致Sysprep失败。原因在于:
Sysprep /generalize
要求为所有用户预配所有应用;但是,从 Microsoft Store 更新应用时,该应用将与登录的用户帐户相关联。 以下错误将出现在 Sysprep 日志文件中(位于 %WINDIR%\\System32\\Sysprep\\Panther 中):< package name> was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image. |
---|
?具体到我遇到的问题,日志里能够看到如下错误:
2021-09-23 12:49:58, InfoSYSPRP Entering SysprepGeneralizeValidate (Appx) - validating whether all apps are also provisioned.
2021-09-23 12:49:58, ErrorSYSPRP Package Windows.MiracastView_6.3.0.0_neutral_neutral_cw5n1h2txyewy was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
2021-09-23 12:49:59, ErrorSYSPRP Failed to remove apps for the current user: 0x80073cf2.
2021-09-23 12:49:59, ErrorSYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
2021-09-23 12:49:59, ErrorSYSPRP ActionPlatform::LaunchModule: Failure occurred while executing \'SysprepGeneralizeValidate\' from C:\\Windows\\System32\\AppxSysprep.dll;
dwRet = 0x3cf2
2021-09-23 12:49:59, ErrorSYSPRP SysprepSession::Validate: Error in validating actions from C:\\Windows\\System32\\Sysprep\\ActionFiles\\Generalize.xml;
dwRet = 0x3cf2
2021-09-23 12:49:59, ErrorSYSPRP RunPlatformActions:Failed while validating Sysprep session actions;
dwRet = 0x3cf2
2021-09-23 12:49:59, Error[0x0f0070] SYSPRP RunDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x3cf2
2021-09-23 12:49:59, Error[0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep generalize internal providers;
hr = 0x80073cf2
2021-09-23 12:49:59, Info[0x0f0052] SYSPRP Shutting down SysPrep log
?知道了Microsoft Store应用在Sysprep的限制之后,这个问题就很容易理解和解决了——想办法把这个APPX包删掉就行了。更何况还有官方的步骤可以参考:MiracastView 在版本 1709 Windows 10 sysprep 错误 。如果想一探究竟,了解为什么会有这样的问题,可以参考:Sysprep fails with Microsoft Store apps 。
几个遇到的问题 - 因为Windows更新导致的失败
?当Syprep运行时,会对很多系统服务的状态进行检查确认。如果自定义过程刚好卡在Windows Update未完成的时候,就会导致失败。
2021-08-31 09:49:37, ErrorSYSPRP Sysprep_Clean_Validate_Opk: Audit mode cannot be turned on if reserved storage is in use. An update or servicing operation may be using reserved storage.;
hr = 0x800F0975
2021-08-31 09:49:37, ErrorSYSPRP ActionPlatform::LaunchModule: Failure occurred while executing \'Sysprep_Clean_Validate_Opk\' from C:\\Windows\\System32\\spopk.dll;
dwRet = 0x975
2021-08-31 09:49:37, ErrorSYSPRP SysprepSession::Validate: Error in validating actions from C:\\Windows\\System32\\Sysprep\\ActionFiles\\Cleanup.xml;
dwRet = 0x975
2021-08-31 09:49:37, ErrorSYSPRP RunPlatformActions:Failed while validating Sysprep session actions;
dwRet = 0x975
2021-08-31 09:49:37, Error[0x0f0070] SYSPRP RunDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x975
2021-08-31 09:49:37, Error[0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep cleanup internal providers;
hr = 0x80070975
2021-08-31 09:49:37, Info[0x0f0052] SYSPRP Shutting down SysPrep log
?知道了这一原因,解决起来就简单了。打开Windows的设置,点进更新和安全,直接来个暂停更新7天。重启之后再运行自定义试试。
几个遇到的问题 - 因为加域失败导致的失败
?别忘了Sysprep的过程。即使sysprep命令行成功完成,我们还需要借助应答文件来完成加域动作。因此你见到如下错误提示时,应该收集日志及检查加域等定制化步骤是否有问题。
" Windows could not parse or process unattend answer file [C:\\Windows\\Panther\\unattend.xml] for pass [oobeSystem]. " |
---|
pass=“oobeSystem”
没有完成。就是可惜来不及再搜集日志进一步分析了。只能找到个相近的应答文件参考下。<
settings pass="oobeSystem">
<
component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<
AutoLogon>
<
Password>
<
Value>
***********==<
/Value>
<
PlainText>
false<
/PlainText>
<
/Password>
<
Enabled>
true<
/Enabled>
<
LogonCount>
1<
/LogonCount>
<
Username>
itstaff<
/Username>
<
/AutoLogon>
<
OOBE>
<
HideEULAPage>
true<
/HideEULAPage>
<
ProtectYourPC>
1<
/ProtectYourPC>
<
/OOBE>
?猜测是使用的VC的自定义规范勾选了自动登录但配置有问题。
【聊聊VDI虚拟桌面的SID问题-前传(下)】?另一个错误就比较明显了。系统没有完成自定义过程,重启之后在系统日志中看到了Event ID 4097,错误代码 1909的错误。这个是由于自定义过程使用的加域账号已禁用或密码错误导致失败造成的。
推荐阅读
- C语言进阶——指针进阶(字符指针指针数组数组指针)
- SSM整合配置文件详解
- 启用 Spring-Cloud-OpenFeign 配置可刷新,项目无法启动,我 TM 人傻了(上)
- OpenMLDB(一文了解带参数查询语句(paramterized query statement))
- 启用 Spring-Cloud-OpenFeign 配置可刷新,项目无法启动,我 TM 人傻了(下)
- minikube addons enable ingress 启动错误
- 线程池的各个参数的含义()
- LFS 系列从零开始 DIY Linux 系统(构建 LFS 系统 - Kbd-2.0.2)
- spring-data-redis 上百万的 QPS 压力太大连接失败,我 TM 人傻了