I am trying to customize the photon os 3.0 ova as same as guest customization which is done on windows or linux vm.
Here is the requirement. Is something possible to script it?
The 1st error is from the PutUsbScanCodes function.
Do have Sleep commands between the consecutive calls to PutUsbScanCodes?
The 2nd series of errors is most probably all a result of the password not having been changed (see the 1st error).
The 3th error is the inconsistency between the script defined in the JSON file and the scripts you call.
I mentioned that before.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Not clear why script is giving different error on subsequent runs. This time keystrokes passed correctly but failed to get scripttext correctly.
I will try with the steps that you suggested now.
Again, that empty ScriptText error is because you call more customization scripts than you have defined in the JSON file.
You could also try to increase the sleep time between calls to Send-VMKeystrokes.
Start-Sleep 1
Set-VMKeystrokes -VMName $VM.Name -StringInput $paramData.Account.OldPassword -ReturnCarriage $true | Out-Null
Start-Sleep 1
Set-VMKeystrokes -VMName $VM.Name -StringInput $paramData.Account.OldPassword -ReturnCarriage $true | Out-Null
Start-Sleep 1
Set-VMKeystrokes -VMName $VM.Name -StringInput $paramData.Account.NewPassword -ReturnCarriage $true | Out-Null
Start-Sleep 1
Set-VMKeystrokes -VMName $VM.Name -StringInput $paramData.Account.NewPassword -ReturnCarriage $true | Out-Null
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
After making changes script executed with no errors but guest customization not happened.
Not sure what your current JSON file contains, but I did notice that the redirection symbols, were converted in some way.
For example
this
should be
If you check, you will probably notice that the file /etc/systemd/network/10-static-en.network does not exist.
That is one of the files that defines your network configuration
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Was the file created?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes file is created and I see IP address in that file but that is not assigning to eth0
Is the 99-dhcp-en.network file also in that folder?
Did all the commands in the 'network' script execute correctly?
You should have a log with the output of each of these customisation scripts.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I noticed you don't have the reboot in the JSON file.
Try adding it to CustomisationCode array in the JSON file.
You don't have to provide a script for the 'reboot', it is handled in the function.
"network",
"docker",
"PowerCLI",
"reboot"
]
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Even after adding reboot still same issue
You might consider enabling network debugging.
My sample 'network' script contains the following commented lines.
"#mkdir -p /etc/systemd/system/systemd-networkd.service.d/",
"#cat > /etc/systemd/system/systemd-networkd.service.d/10-loglevel-debug.conf << EOF",
"#[Service]",
"#Environment=SYSTEMD_LOG_LEVEL=debug",
"#EOF",
"#systemctl daemon-reload",
"#systemctl restart systemd-networkd",
"#systemd-delta --type=extended",
"",
Remove the comment character, and check what the logs say.
On photon network debugging you can find more info at Network Debugging
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Its my bad sorry. After checking the log file I see the issue is with netmask (in .json I mentioned as 255.255.255.0). Now I corrected and executed.
What I observed is at vcenter display I can see the configured IP but if i do ifconfig its showing 169** . I think its still taking dhcp as primary address. How to fix this?
Does the Web CLient keep showing 2 IP addresses?
Even after a restart of the VM?
Not sure what you are showing there, inside the guest OS the 'ifconfig -a' shows an APIPA address, while the log seems to show that the fixed IP is selected.
Was the this done after the guest OS was rebooted?
Did you activate network debugging as I suggested earlier?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Does the Web CLient keep showing 2 IP addresses?
Yes
Even after a restart of the VM?
Yes even after reboot its showing two ips.
Not sure what you are showing there, inside the guest OS the 'ifconfig -a' shows an APIPA address, while the log seems to show that the fixed IP is selected.
Was the this done after the guest OS was rebooted?
yes after reboot only I have checked what ip is configured eth0 and its showing apipa address. but log showing Ip is assigned.
Did you activate network debugging as I suggested earlier?
yes I have activated. Here is logfile
After rebooting OS is picking new address with apipa address
After the above message eth0 is showing updating address as static ip but again picking apipa address
Finally I found the fix and surprisingly the answer is found from the question you posted in Git.
IPv4 & IPv6 APIPA addresses generated · Issue #800 · vmware/photon · GitHub
Fix
after replacing this it worked.
LinkLocalAddressing=ipv4 to
LinkLocalAddressing=no
Thanks for your support