VMware Cloud Community
vin01
Expert
Expert
Jump to solution

vmware Photon OS 3.0 Customization

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?

  1. We ship  photon ova to the customers for building docker containers.
  2. Once we ship this to customers they will deploy the ova in vcenter cluster by passing all required parameters from a variable or a json file(hostname,ip etc)
  3. Objective is to have all the configuration parameters in a json file and use import-vapp with OvfConfiguration passed from that json file.
  4. After deploying ova using invoke-vmscript and we need to push the code to install docker & other container application
Regards Vineeth.K
36 Replies
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

Not clear why script is giving different error on subsequent runs. This time keystrokes passed correctly but failed to get scripttext correctly.

pastedImage_0.png

I will try with the steps  that you suggested now.

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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.

Set-VMKeystrokes -VMName $VM.Name -StringInput $paramData.Account.User -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.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

vin01
Expert
Expert
Jump to solution

After making changes script executed with no errors but guest customization not happened.

pastedImage_1.png

pastedImage_0.png

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Not sure what your current JSON file contains, but I did notice that the redirection symbols, were converted in some way.

For example

this

"cat \u003e /etc/systemd/network/99-dhcp-en.network \u003c\u003c EOF",

should be

"cat > /etc/systemd/network/99-dhcp-en.network << EOF",

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

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

Even after replacing the redirection symbols still Ip is not assigned. Is something other then  redirection symbols to be replaced.

Attaching the json file which is used and also I have noticed Ip address is updated in 10-static-en.network but not assigned to eth0

pastedImage_0.png

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Was the file created?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

Yes file is created and I see IP address in that file but that is not assigning to eth0

pastedImage_0.png

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

Is the 99-dhcp-en.network file also in that folder?

yes I can see 99-dhcp in the folder.

Did all the commands in the 'network' script execute correctly?

Yes I have verified rest of the commands executed correctly.

Logfile attached. Can you check is anything I am missing.

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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.

"CustomisationCode": [

    "network",

    "docker",

    "PowerCLI",

    "reboot"

]


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

vin01
Expert
Expert
Jump to solution

Even after adding reboot still same issue

pastedImage_0.png

pastedImage_1.png

pastedImage_0.png

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You might consider enabling network debugging.

My sample 'network' script contains the following commented lines.

    "# Network debugging",

    "#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

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

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?

pastedImage_1.png

pastedImage_2.png

pastedImage_0.png

Regards Vineeth.K
Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

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

pastedImage_1.png

After the above message eth0 is showing updating address as static ip but again picking apipa address

pastedImage_2.png

Regards Vineeth.K
Reply
0 Kudos
vin01
Expert
Expert
Jump to solution

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

Regards Vineeth.K
Reply
0 Kudos