初始化组件≤cloudbase-init1.1.2的机型A的机器做了自定义镜像买机型B的机器,新机器网络初始化异常的bug如何规避

2024-09-13 14:45:44 浏览数 (3)

问题:初始化组件≤cloudbase-init1.1.2的机型A的机器做了自定义镜像买机型B的机器,新机器网络初始化异常

代码语言:txt复制
ERROR cloudbaseinit.init [-] plugin 'NetworkConfigPlugin' failed with error '<x_wmi: Unexpected COM Error (-2147352567, 'Exception occurred.', (0, 'SWbemObjectEx', 'Invalid parameter ', None, 0, -2147217400), None)>'

bug:https://github.com/cloudbase/cloudbase-init/issues/50

Unexpected COM Error -2147352567

公共镜像不涉及,只有自定义才有可能遇到

初始化组件≤cloudbase-init1.1.2的机型A的机器做了自定义镜像买机型B的机器,新机器网络初始化异常的bug如何规避

①临时规避,制作镜像前执行powershell删cvm网卡(需要机器能访问公网)

代码语言:txt复制
#ps1
reg delete "HKLMSOFTWARECloudbase SolutionsCloudbase-Init" /f 2>$null
reg add "HKLMSYSTEMControlSet001Servicescloudbase-init" /v "Start" /d 2 /t REG_DWORD /f
reg delete "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionNetworkListProfiles" /f 2>$null
reg delete "HKLMSYSTEMCurrentControlSetControlTimeZoneInformation" /v "RealTimeIsUniversal" /f 2>$null
reg add "HKLMSYSTEMCurrentControlSetControlNetworkNewNetworkWindowOff" /f 2>&1 > $null

$client = new-object System.Net.WebClient
$client.DownloadFile('http://windows-1251783334.cos.ap-shanghai.myzijiebao.com/wget64.exe',' c:windowswget.exe')
wget.exe http://windows-1251783334.cos.ap-shanghai.myzijiebao.com/115.159.148.149/devcon.exe -O c:windowsdevcon.exe
ipconfig /release;devcon.exe /r remove "PCIVEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00"

②升级cloudbase-init到1.1.4(需要机器能访问公网)

代码语言:txt复制
#ps1

$client = new-object System.Net.WebClient
$client.DownloadFile('http://windows-1251783334.cos.ap-shanghai.myzijiebao.com/wget64.exe',' c:windowswget.exe')


wget.exe  http://windows-1251783334.cos.ap-shanghai.myzijiebao.com/CLOUDBASE-INIT_INSTALL1.1.4.PS1  -O  c:cloudbase-init_install.ps1
powershell  -file  c:cloudbase-init_install.ps1

sc.exe  config  cloudbase-init  obj=  LocalSystem
sc.exe  config  cloudbase-init  depend=  tcpip/dhcp/dnscache/Winmgmt
sc.exe  failure  cloudbase-init  reset=  0  actions=  restart/10000  2>&1  >  $null
sc.exe  qc  cloudbase-init  8192
net  user  cloudbase-init  /del  2>$null

#$client12 = new-object System.Net.WebClient
#cloudbase-init_1.1.2
#$client12.DownloadFile('http://windowsgz-1251783334.cos.ap-guangzhou.myzijiebao.com/ziyan/Cloudbase-Init.zip','C:Cloudbase-Init.zip')

#$client14 = new-object System.Net.WebClient
#cloudbase-init_1.1.4
$client14.DownloadFile('http://windows-1251783334.cos.ap-shanghai.myzijiebao.com/Cloudbase-Init1.1.4.zip','C:Cloudbase-Init.zip')

$7zPath = "$env:ProgramFiles7-Zip7z.exe"
if (-not (Test-Path -Path $7zPath)) {
$client7 = new-object System.Net.WebClient
$client7.DownloadFile('http://windows-1251783334.cos.ap-shanghai.myzijiebao.com/7z2408-x64.msi','c:7z2408-x64.msi')

msiexec.exe /i c:7z2408-x64.msi /qn
Start-Sleep 30
del c:7z2408-x64.msi 2>$null
}

& "$env:ProgramFiles7-Zip7z.exe" x -aoa C:Cloudbase-Init.zip -o"C:Program FilesCloudbase SolutionsCloudbase-Init"

0 人点赞