Disconnected NIC on customized & deployed Ubuntu 18.04 templates

stevenmiller asked:

Within my vSphere 6.7 U3 environment, I have an Ubuntu 18.04 template generated by packer which I am then using Terraform to deploy two copies of. I am running into an issue where the deployed VMs come up with their NIC’s disconnected, preventing Terraform from completing the deployment.

I have followed the following KB from vmware: https://kb.vmware.com/s/article/56409 though it is mentioned that this issue is supposed to be fixed in the release of vSphere and open-vm-tools that I am running. I have the fix outlined in the KB present in the template generated by packer.

To resolve this issue, follow below provided steps and do not skip the steps.

    Open the tmp.conf under /usr/lib/tmpfiles.d/tmp.conf file.

Go to the line 11 and add the prefix # .

For example
#D /tmp 1777 root root -

    If you have open-vm-tools installed, open the /lib/systemd/system/open-vm-tools.service file.

         In certain version path may be different the use find command locate the file 
               #find  /  -iname  open-vm-tools.service
 
Add this line “After=dbus.service” under [Unit]

Has anyone else run into this? I am not using the cloud-init customization method. This is the only error I am seeing in the /var/log/vmware-imc/toolsDeployPkg.log file:

[2020-07-17T18:17:57.140Z] [   error] Customization command failed with exitcode: 2, stderr: 'Can't locate File/stat.pm in @INC (you may need to install the File::stat module) (@INC contains: /var/run/.vmware-imgcust-dk2xFAt/scripts /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /var/run/.vmware-imgcust-dk2xFAt/scripts/Utils.pm line 26.
BEGIN failed--compilation aborted at /var/run/.vmware-imgcust-dk2xFAt/scripts/Utils.pm line 26.
Compilation failed in require at /var/run/.vmware-imgcust-dk2xFAt/scripts/Customize.pl line 24.
BEGIN failed--compilation aborted at /var/run/.vmware-imgcust-dk2xFAt/scripts/Customize.pl line 24.

My answer:


The problem is here:

[2020-07-17T18:17:57.140Z] [   error] Customization command failed with exitcode: 2, stderr: 'Can't locate File/stat.pm in @INC (you may need to install the File::stat module) (@INC contains: /var/run/.vmware-imgcust-dk2xFAt/scripts /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /var/run/.vmware-imgcust-dk2xFAt/scripts/Utils.pm line 26.

open-vm-tools needs the package that contains File/stat.pm, which on Ubuntu 18.04 LTS is perl-modules-5.26. Ensure that this package is installed.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.