我嘗試使用自動無人值守安裝模式在 Proxmox 主機上安裝 Windows Server VM。VM 將按預期安裝并啟動,但網路驅動程式(以及網路配置)不可用。
我已經嘗試了幾個選項以及來自 Fedora 的演示 Win 2k19 ISO 映像和 Virtio 驅動程式 ISO 映像。
我做什么(使用 Ansible,但這不是這里的問題):
- 掛載 Virtio ISO,將內容與 autounattend.xml 和一些 PowerShell 腳本一起復制到新位置。
- 將該位置打包到一個新的 ISO 檔案中
- 創建一個帶有兩個 CDROM 驅動器的 VM 并掛載 Win ISO 和 Drivers-ISO,VM 當然還有硬碟、網路設備等。
- 啟動虛擬機
- Windows 安裝程式在 e: 上找到 autounattend.xml 并開始自動安裝
- autounattend.xml 包含驅動程式 ISO 上驅動程式的路徑,用于查找 SCSI 硬碟。那個有效
- 但未加載網路驅動程式,因此我無法通過自動無人值守配置網路。
- 我試圖構建一個 PowerShell 腳本,但它也不夠,腳本運行,沒有錯誤,但設備管理器顯示帶有感嘆號的 RedHat Virtio 以太網配接器。
- 當我在安裝后手動運行 virtio-win-gt-x64.msi 時,它說 - 該軟體已安裝,只能洗掉...
...但為什么網路驅動程式不起作用?當我重新安裝 MSI 軟體包時,網路會聯機。
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="{{ bootstrap_host_type }}" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>de-DE</UILanguage>
</SetupUILanguage>
<InputLocale>de-DE</InputLocale>
<SystemLocale>de-DE</SystemLocale>
<UILanguage>de-DE</UILanguage>
<UILanguageFallback>en-US</UILanguageFallback>
<UserLocale>de-DE</UserLocale>
</component>
<component name="Microsoft-Windows-PnpCustomizationsWinPE" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" processorArchitecture="{{ bootstrap_host_type }}" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="1">
<Path>E:\{{ bootstrap_host_type }}\{{ bootstrap_os_version }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
<Path>E:\viostor\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="3">
<Path>E:\NetKVM\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="4">
<Path>E:\Balloon\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="5">
<Path>E:\pvpanic\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="6">
<Path>E:\qemupciserial\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="7">
<Path>E:\qxldod\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="8">
<Path>E:\vioinput\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="9">
<Path>E:\viorng\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="10">
<Path>E:\vioscsi\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="11">
<Path>E:\vioserial\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="12">
<Path>E:\vioserial\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}</Path>
</PathAndCredentials>
</DriverPaths>
</component>
...
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="{{ bootstrap_host_type }}" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OEMInformation>
<HelpCustomized>false</HelpCustomized>
</OEMInformation>
<ComputerName>*</ComputerName>
<TimeZone>{{ vm_time_zone }}</TimeZone>
<RegisteredOwner/>
</component>
<component name="Microsoft-Windows-TCPIP" processorArchitecture="{{ bootstrap_host_type }}" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Interfaces>
<Interface wcm:action="add">
<Ipv6Settings>
<DhcpEnabled>false</DhcpEnabled>
<Metric>30</Metric>
<RouterDiscoveryEnabled>true</RouterDiscoveryEnabled>
</Ipv6Settings>
<Identifier>Ethernet 1</Identifier>
<UnicastIpAddresses>
<IpAddress wcm:action="add" wcm:keyValue="1">{{ network.wan.ipv6.address }}/{{ network.wan.ipv6.prefix }}</IpAddress>
</UnicastIpAddresses>
<Routes>
<Route wcm:action="add">
<Identifier>1</Identifier>
<Metric>10</Metric>
<NextHopAddress>{{ network.wan.ipv6.gateway }}</NextHopAddress>
<Prefix>0</Prefix>
</Route>
</Routes>
</Interface>
</Interfaces>
</component>
...
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="{{ bootstrap_host_type }}" 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>
<Username>administrator</Username>
<Password>
<Value>{{ vm_admin_pass }}</Value>
<PlainText>true</PlainText>
</Password>
<Enabled>true</Enabled>
<LogonCount>3</LogonCount>
</AutoLogon>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\System32\reg.exe ADD HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff /f</CommandLine>
<Order>1</Order>
<Description>Disable Network Discovery Prompt</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>powershell -File e:\scripts\configure.ps1</CommandLine>
<Description>Install and configure common tasks</Description>
<Order>2</Order>
</SynchronousCommand>
...
這里是 PowerShell 腳本。
# Create Workdir
$BasePath = "C:\Windows\Temp\Install"
New-item $BasePath -itemtype directory
# Add RedHat to Trusted Publisher
$CertName = "redhat.cer"
$CertFile = Join-Path $BasePath -ChildPath $CertName
$Cert = (Get-AuthenticodeSignature "e:\pvpanic\{{ bootstrap_os_version }}\{{ bootstrap_host_type }}\pvpanic.sys").SignerCertificate
$ExportType = [System.Security.Cryptography.X509Certificates.X509ContentType]::Cert
[System.IO.File]::WriteAllBytes($CertFile, $Cert.Export($ExportType))
Import-Certificate -FilePath $CertFile -CertStoreLocation Cert:\LocalMachine\TrustedPublisher
Start-Sleep -s 5
# install Virtio Drivers
Start-Process msiexec -Wait -ArgumentList '/i e:\virtio-win-gt-x64.msi /log "C:\Windows\Temp\Install\qemu-drivers.log" /qn /passive /norestart ADDLOCAL=ALL'
VM配置為
- pc-i440fx-6.1
- cputype=主機
- 帶有 scsi0 的 virtio SCSI 單
- net0 作為 virtio 設備,bridge=vmbr0,firewall=1 - 沒有可用的 DHCP
- ide0 with media=cdrom,local:iso/win2k19.iso
- ide1 with media=cdrom,local:iso/drivers.iso
What is wrong with my installation, that the Windows system knows the RedHat ethernet adapter but isn't really using the desired drivers? I've also installed automatically the RedHat certificate (to avoid questions during installation). But I cannot use that during autounattend (at that moment I cannot install certificates).
Also I tried to run the msiexec direct on command line. Still the same. It detects, that the software is already installed. Then I try to install the software again and via msiexec that installation runs in 2-3sek and then it is installed (which is to fast). When I do it manually with the GUI, everything is fine.
The msiexec command is
msiexec /I e:\virtio-win-gt-x64.msi /qn /passive /log ".." ADDLOCAL=ALL
The generated logfiles is about 130k in size and contains no errors. I wander if
DIFXAPP: Info: This is a no-op custom action for component CMP_WinServer2019_netkvm.
是正確的。我正在使用Fedora 的0.1.208 版本。
uj5u.com熱心網友回復:
您是否嘗試過僅使用pnputil安裝驅動程式并完全繞過 msi 安裝程式?
在我的環境(運行 Server 2019 Core VM 的 Proxmox VE 6.2-6)中,我安裝了 CD,然后運行:
Get-ChildItem E:\ -Recurse -Filter "*.inf" | ForEach-Object { pnputil.exe /add-driver $_.FullName /install }
這會導致正確安裝和選擇所有適用的驅動程式。
如果您需要安裝 QEMU 代理以支持 ACPI 命令等,那么您可以添加:
$Installer = "qemu-ga-x86_64.msi"
if ([Environment]::Is64BitOperatingSystem -eq $false)
{
$Installer = "qemu-ga-i386.msi"
}
Start-Process msiexec -ArgumentList "/I e:\GUEST-AGENT\$Installer /qn /norestart" -Wait -NoNewWindow
uj5u.com熱心網友回復:
作為對我自己問題的回答。使用 MSI 包的引數似乎有一個奇怪的問題。看起來 msiexec 安裝忽略了 ADDLOCAL 屬性和/或安裝了“某物”,但沒有安裝正確的驅動程式。同樣奇怪的是,具體的驅動程式安裝沒有任何效果。在我看來,自動安裝程序中缺少一些東西。
我不能說為什么,但使用 virtio-guest-tools.exe 似乎有效......或多或少。我需要重新安裝、卸載和安裝軟體 - 然后網路設備聯機,我可以通過 New-NetIPAddress 對其進行配置。
Start-Process -Wait -NoNewWindow -FilePath 'e:\virtio-win-guest-tools.exe' -ArgumentList '/s /qn'
Start-Process -Wait -NoNewWindow -FilePath 'e:\virtio-win-guest-tools.exe' -ArgumentList '/s /qn /uninstall'
Start-Process -Wait -NoNewWindow -FilePath 'e:\virtio-win-guest-tools.exe' -ArgumentList '/s /qn'
所以 - 這對我有用。但這是丑陋的,不正常的,永遠不應該是正確的答案。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/374222.html
