Ubuntu
在自定義和部署的 Ubuntu 18.04 模板上斷開 NIC
在我的 vSphere 6.7 U3 環境中,我有一個由打包程序生成的 Ubuntu 18.04 模板,然後我使用 Terraform 來部署它的兩個副本。我遇到了一個問題,即部署的 VM 的 NIC 斷開連接,從而阻止 Terraform 完成部署。
我遵循了來自 vmware 的以下 KB:https ://kb.vmware.com/s/article/56409儘管有人提到這個問題應該在我的 vSphere 和 open-vm-tools 版本中得到修復跑步。我在 Packer 生成的模板中的 KB 中列出了修復程序。
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]
有沒有其他人遇到過這個?我沒有使用 cloud-init 自定義方法。這是我在 /var/log/vmware-imc/toolsDeployPkg.log 文件中看到的唯一錯誤:
[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.
問題在這裡:
[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
需要包含 的包,File/stat.pm
在 Ubuntu 18.04 LTS 上是perl-modules-5.26
. 確保已安裝此軟體包。