Incorrect mapping of ipv6 loopback entry 1 to FQDN is added during Linux guest OS customization
search cancel

Incorrect mapping of ipv6 loopback entry 1 to FQDN is added during Linux guest OS customization

book

Article ID: 318559

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This article introduces how to avoid adding an ipv6 loopback entry mapping to FQDN in the  /etc/hosts during guest OS customization.

Symptoms:
When customizing a Linux guest OS, the mapping of ipv6 loopback entry ::1 to FQDN will be added in the /etc/hosts directory.

If this mapping does not exist in the file before customization, it will be added as seen below:

::1 <FQDN> <hostname>

Environment

VMware vCenter Server 6.7.x
VMware vCenter Server 7.0.x

Cause

If there is no IPv6 loopback entry mapping to FQDN in the /etc/hosts before the customization, it will be added after customization unexpectedly.

Resolution

The issue has been fixed in vCenter Server 7.0 Update 2c and later releases.
Affected versions:
  • vCenter Server 7.0 Update 1.
  • vCenter Server 7.0 Update 1c.
  • vCenter Server 7.0 Update 2a.
  • vCenter Server 7.0 Update 2b.


Workaround:
To work around this issue, follow either one of the workarounds:

Workaround #1

  1. Add below customization script in the customization spec:

    #!/bin/bash
    if [ x$1 == x"precustomization" ]; then
       echo "pre-script: do nothing"
    fi
    if [ x$1 == x"postcustomization" ]; then
       echo "post-script, modify /etc/hosts"
       sed -i '/^::1/{/localhost\.localdomain/!d}' /etc/hosts
    fi

     
  2. Enable the customization script in the VM template or VM. For more information, see Setting the customization script for virtual machines in vSphere 7.0 (74880).

Workaround #2

Remove the ipv6 loopback entry mapping to FQDN in /etc/hosts after customization:

sed -i '/^::1/{/localhost\.localdomain/!d}' /etc/hosts

Workaround #3

  1. Edit the customization perl script on the vCenter server: 

    /usr/lib/vmware-vpx/imgcust/linux/imgcust-scripts/Customization.pm
     
  2. Remove or comment out below two code lines:

    DEBUG("Ipv6 Loopback entry added");
    push(@newContent, "\n$newIpv6Line\n");