Windows Server 2012:无法安装 SMTP 服务器,系统始终需要重新启动

Windows Server 2012:无法安装 SMTP 服务器,系统始终需要重新启动

我无法在 Windows 2012 服务器上安装“SMTP 服务器”功能。安装过程总是失败,并显示“需要重新启动”消息。重新启动并(重新)启动 SMTP 服务器功能后,系统需要重新启动。

我尝试使用安装向导和 PowerShell 安装该功能。

尝试使用 PowerShell 安装该功能时出现如下错误:

PS > Install-WindowsFeature SMTP-Server
Install-WindowsFeature : Fehler bei der Anforderung zum Hinzufügen oder Entfernen von Features auf dem angegebenen
Server.
Der Vorgang kann nicht abgeschlossen werden, da der angegebene Server neu gestartet werden muss.
In Zeile:1 Zeichen:1
+ Install-WindowsFeature SMTP-Server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : DeviceError: (@{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature], Exce
   ption
    + FullyQualifiedErrorId : DISMAPI_Error__Failed_Reboot_Required,Microsoft.Windows.ServerManager.Commands.AddWindow
   sFeatureCommand

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
False   No             Failed         {}

使用此处的 Get-PendingReboot 脚本https://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542尝试安装该功能后显示以下待处理的重启状态:

CBServicing    : True
WindowsUpdate  : False
CCMClientSDK   : False
PendFileRename : False
PendFileRenVal :
RebootPending  : True

重新启动后,开始 SMTP 服务器安装之前,没有待处理的重新启动,即脚本显示(RebootPending:False)。

安装过程失败后,我甚至无法列出 Windows 功能:

PS > Get-WindowsFeature
Get-WindowsFeature : Fehler bei der Anforderung zum Auflisten der auf dem angegebenen Server verfügbaren Features.
Der Vorgang kann nicht abgeschlossen werden, da der angegebene Server neu gestartet werden muss.
In Zeile:1 Zeichen:1
+ Get-WindowsFeature
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : DeviceError: (@{Vhd=; Credent...Name=localhost}:PSObject) [Get-WindowsFeature], Deployme
   ntProviderException
    + FullyQualifiedErrorId : GetEnumerationState_Failed_Reboot_Required,Microsoft.Windows.ServerManager.Commands.GetW
   indowsFeatureCommand

dism.exe /online /get-features 报告以下内容:

Tool zur Imageverwaltung für die Bereitstellung
Version: 6.2.9200.16384

Abbildversion: 6.2.9200.16384

Featureauflistung für das Paket : Microsoft-Windows-ServerCore-Package~31bf3856a
d364e35~amd64~~6.2.9200.16384

Featurename : NetFx3ServerFeatures
Status : Aktiviert


Fehler: 3017

Der angeforderte Vorgang war nicht erfolgreich. Es ist ein Systemneustart erford
erlich, um die durchgeführten Änderungen rückgängig zu machen.

Die DISM-Protokolldatei befindet sich unter "C:\Windows\Logs\DISM\dism.log".

以下行记录在 C:\Windows\Logs\DISM\dism.log 中:

2015-06-28 21:35:58, Info                  DISM   DISM Provider Store: PID=4852 TID=5124 Provider has previously been initialized.  Returning the existing instance. - CDISMProviderStore::Internal_GetProvider
2015-06-28 21:35:58, Info                  DISM   DISM Package Manager: PID=4852 TID=5124 Processing the top level command token(get-features). - CPackageManagerCLIHandler::Private_ValidateCmdLine
2015-06-28 21:35:58, Info                  DISM   DISM Package Manager: PID=4852 TID=5124 Attempting to route to appropriate command handler. - CPackageManagerCLIHandler::ExecuteCmdLine
2015-06-28 21:35:58, Info                  DISM   DISM Package Manager: PID=4852 TID=5124 Routing the command... - CPackageManagerCLIHandler::ExecuteCmdLine
2015-06-28 21:35:59, Info                  DISM   DISM Package Manager: PID=4852 TID=5124 Feature NetFx3ServerFeatures with CBS state 7(CbsInstallStateInstalled) being mapped to dism state 7(DISM_INSTALL_STATE_INSTALLED) - CDISMPackageFeature::LogInstallStateMapping
2015-06-28 21:35:59, Error                 DISM   DISM Package Manager: PID=4852 TID=5124 Failed to get the State of the Feature - CDISMPackageFeature::Internal_GetCbsState(hr:0x80070bc9)
2015-06-28 21:35:59, Error                 DISM   DISM Package Manager: PID=4852 TID=5124 Failed to get the CBS State of the Feature - CDISMPackageFeature::get_State(hr:0x80070bc9)
2015-06-28 21:35:59, Error                 DISM   DISM Package Manager: PID=4852 TID=5124 Failed to get the feature state. - CCBSFormatter::PrintCbsFeatures_ListFormat(hr:0x80070bc9)
2015-06-28 21:35:59, Error                 DISM   DISM Package Manager: PID=4852 TID=5124 Failed while processing command get-features. - CPackageManagerCLIHandler::ExecuteCmdLine(hr:0x80070bc9)
2015-06-28 21:35:59, Info                  DISM   DISM Package Manager: PID=4852 TID=5124 Further logs for online package and feature related operations can be found at %WINDIR%\logs\CBS\cbs.log - CPackageManagerCLIHandler::ExecuteCmdLine
2015-06-28 21:35:59, Error                 DISM   DISM.EXE: DISM Package Manager processed the command line but failed. HRESULT=80070BC9

以下行记录在 C:\Windows\logs\CBS\cbs.log 中:

2015-06-28 21:35:58, Info                  CBS    TI: --- Initializing Trusted Installer ---
2015-06-28 21:35:58, Info                  CBS    TI: Last boot time: 2015-06-28 15:46:57.314
2015-06-28 21:35:58, Info                  CBS    TrustedInstaller terminated with pending operations.
2015-06-28 21:35:58, Info                  CBS    Starting TrustedInstaller initialization.
2015-06-28 21:35:58, Info                  CBS    Ending TrustedInstaller initialization.
2015-06-28 21:35:58, Info                  CBS    Starting the TrustedInstaller main loop.
2015-06-28 21:35:58, Info                  CBS    TrustedInstaller service starts successfully.
2015-06-28 21:35:58, Info                  CBS    Registering for Winlogon CreateSession notifications
2015-06-28 21:35:58, Info                  CBS    Registering for pre-shutdown notification to complete the pended operation
2015-06-28 21:35:58, Info                  CBS    Startup processing thread terminated normally
2015-06-28 21:35:58, Info                  CBS    Starting TiWorker initialization.
2015-06-28 21:35:58, Info                  CBS    Ending TiWorker initialization.
2015-06-28 21:35:58, Info                  CBS    Starting the TiWorker main loop.
2015-06-28 21:35:58, Info                  CBS    TiWorker starts successfully.
2015-06-28 21:35:58, Info                  CBS    Universal Time is: 2015-06-28 19:35:58.771
2015-06-28 21:35:58, Info                  CBS    Loaded Servicing Stack v6.2.9200.17280 with Core: C:\Windows\winsxs\amd64_microsoft-windows-servicingstack_31bf3856ad364e35_6.2.9200.17280_none_6224eed751126779\cbscore.dll
2015-06-28 21:35:58, Info                  CSI    00000001@2015/6/28:19:35:58.771 WcpInitialize (wcp.dll version 0.0.0.6) called (stack @0x7f950ce63c1 @0x7f9570198ba @0x7f956fd4dd4 @0x7f684d3d1df @0x7f684d3d95c @0x7f96b8e1d35)
2015-06-28 21:35:58, Info                  CBS    Could not load SrClient DLL from path: SrClient.dll.  Continuing without system restore points.
2015-06-28 21:35:58, Info                  CSI    00000002@2015/6/28:19:35:58.771 WcpInitialize (wcp.dll version 0.0.0.6) called (stack @0x7f950ce63c1 @0x7f957076248 @0x7f957037719 @0x7f956fd4f47 @0x7f684d3d1df @0x7f684d3d95c)
2015-06-28 21:35:58, Info                  CBS    SQM: Initializing online with Windows opt-in: False
2015-06-28 21:35:58, Info                  CBS    SQM: Cleaning up report files older than 10 days.
2015-06-28 21:35:58, Info                  CBS    SQM: Requesting upload of all unsent reports.
2015-06-28 21:35:58, Info                  CBS    SQM: Failed to start upload with file pattern: C:\Windows\servicing\sqm\*_std.sqm, flags: 0x2 [HRESULT = 0x80004005 - E_FAIL]
2015-06-28 21:35:58, Info                  CBS    SQM: Failed to start standard sample upload. [HRESULT = 0x80004005 - E_FAIL]
2015-06-28 21:35:58, Info                  CBS    SQM: Queued 0 file(s) for upload with pattern: C:\Windows\servicing\sqm\*_all.sqm, flags: 0x6
2015-06-28 21:35:58, Info                  CBS    SQM: Warning: Failed to upload all unsent reports. [HRESULT = 0x80004005 - E_FAIL]
2015-06-28 21:35:58, Info                  CBS    Session: 30454233_2827951091 initialized by client DISM Package Manager Provider.
2015-06-28 21:35:58, Info                  CBS    Enumerating Foundation package: Microsoft-Windows-ServerCore-Package~31bf3856ad364e35~amd64~~6.2.9200.16384, this could be slow
2015-06-28 21:35:59, Info                  CSI    00000003 CSI Store 1037981022800 (0x000000f1ac7d7a50) initialized
2015-06-28 21:35:59, Info                  CSI    00000004 Transaction merge required, do-not-merge flag passed.
2015-06-28 21:35:59, Info                  CSI    00000005@2015/6/28:19:35:59.604 CSI Transaction @0xf1ac867fb0 initialized for deployment engine {d16d444c-56d8-11d5-882d-0080c847b195} with flags 00000002 and client id [26]"TI5.30454233_2827951091:1/"

2015-06-28 21:35:59, Error                 CSI    00000006 (F) Current pending rollback transaction content precludes other operations; reboot to complete rollback.[gle=0x80004005]
2015-06-28 21:35:59, Info                  CBS    Failed to get transaction analysis because of pending operations. Disposition from Analyze: 0x1 [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2015-06-28 21:35:59, Info                  CBS    Failed to get inventory. [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2015-06-28 21:35:59, Info                  CSI    00000007@2015/6/28:19:35:59.916 CSI Transaction @0xf1ac867fb0 destroyed
2015-06-28 21:35:59, Info                  CBS    Failed to get CSI Inventory [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2015-06-28 21:35:59, Info                  CBS    Failed to get component state. [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2015-06-28 21:35:59, Info                  CBS    Failed to get current state of the deployment [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2015-06-28 21:35:59, Info                  CBS    Failed to get Transaction State for package: Microsoft-Windows-NetFx3-Server-OC-Package~31bf3856ad364e35~amd64~~6.2.9200.16384, update: NetFx3 [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2015-06-28 21:35:59, Error                 CBS    Failed to get store state [HRESULT = 0x80070bc9 - ERROR_FAIL_REBOOT_REQUIRED]
2015-06-28 21:37:59, Info                  CBS    Trusted Installer successfully registered to be restarted for pre-shutdown
2015-06-28 21:37:59, Info                  CBS    Trusted Installer is shutting down because: SHUTDOWN_REASON_AUTOSTOP
2015-06-28 21:37:59, Info                  CBS    Stopping Winlogon CreateSession notifications
2015-06-28 21:37:59, Info                  CBS    Unloading SysNotify DLL
2015-06-28 21:37:59, Info                  CBS    TiWorker signaled for shutdown, going to exit.
2015-06-28 21:37:59, Info                  CBS    Ending the TiWorker main loop.
2015-06-28 21:37:59, Info                  CBS    Starting TiWorker finalization.
2015-06-28 21:37:59, Info                  CBS    Ending the TrustedInstaller main loop.
2015-06-28 21:37:59, Info                  CBS    Starting TrustedInstaller finalization.
2015-06-28 21:37:59, Info                  CBS    Ending TrustedInstaller finalization.
2015-06-28 21:38:00, Info                  CBS    Ending TiWorker finalization.

我不知道是什么原因导致 CBServicing 在安装 SMTP 服务器功能时需要重新启动,也不知道如何修复该问题以便能够安装 SMTP 服务器功能。如能得到任何帮助我将不胜感激 :)。

答案1

我找到了问题所在:问题原因不是 SMTP 服务器功能本身,而是 SMTP 服务器所需的 IIS-ODBCLogging 功能。由于权限问题,此 IIS 相关功能的安装失败:安装程序似乎无法更新存储在网络共享上的 IIS 配置(用于在 Web 场中的不同服务器之间共享)。

在 C:\Windows\iis.log 中我发现:

[06/23/2015 13:28:58] [ ***** IIS 8.0 Component Based Setup ***** ]
[06/23/2015 13:28:58] "C:\Windows\System32\inetsrv\iissetup.exe" /install Metabase
[06/23/2015 13:28:58] < WARNING! > Shared configuration detected. Install/Uninstall of optional component may fail. 
[06/23/2015 13:28:58] Successfully updated IIS_IUSRS rights.
[06/23/2015 13:28:58] Successfully populated IIS_IUSRS.
[06/23/2015 13:28:58] Successfully set IISADMIN install state.
[06/23/2015 13:28:58] Successfully removed old metabase files.
[06/23/2015 13:28:59] Successfully started IISADMIN.
[06/23/2015 13:28:59] < !!FAIL!! > MB::SetData result=0x80070005
[06/23/2015 13:28:59] < !!FAIL!! > METABASE_UTIL::InstallIisAdminMetabaseEntries result=0x80070005
[06/23/2015 13:29:05] Successfully stopped IISADMIN.
[06/23/2015 13:29:05] < !!FAIL!! > MB::SetData result=0x80070005
[06/23/2015 13:29:05] < WARNING! > METABASE_UTIL::InstallLegacySnapInMetabaseEntries result=0x80070005
[06/23/2015 13:29:05] Successfully started IISADMIN.

最后,禁用 IIS 共享配置、安装该功能并再次启用共享配置就成功了。

答案2

我遇到了类似的问题,但我尝试安装 DFS 角色而不是 SMTP。就我的情况而言,该问题是由基于组件的服务 (CBS)%WINDIR%\WinSxS\pending.xml列表和与其绑定的注册表设置的权限问题引起的 ( HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackagesPending)。

本质上,系统可以读取注册表项和待处理操作列表,但无法修改它们。我通过获取注册表项和 xml 文件的所有权并删除它们(当然,首先进行了备份)解决了这个问题。

真正帮助我解决问题的 powershell cmdlet 是测试待重启我在 Windows 10 工作站上运行了它。它可以像这样安装和使用:

Install-Module PendingReboot
Test-PendingReboot -Detailed -ComputerName <yourServerHere>

结果显示,永远无法重启是由于 ComponentBasedServicing 造成的,这终于让我弄清楚了问题的原因。我删除注册表项和文件后,系统允许我添加角色,大量其他问题也一下子全部解决了。当我重新启动服务器时,花了很长时间才完成重新启动的关机部分。从那以后一切顺利。

相关内容