<div dir="ltr"><div style="font-size:12.8px">Hi everyone!</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Recently we&#39;ve faced hostname issue on container running on CentOS with cPanel. </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">When container is rebooted, hostname became &quot;server1&quot; instead of &quot;<a href="http://server1.example.com/" target="_blank">server1.example.com</a>&quot;. We understand that hostname shouldn&#39;t be FQDN, but unfortunately it breaks cPanel (we&#39;ve faced at least 2 issues such as invalid HELO name and revoked certificate for WHM). So we made a patch for script /etc/vz/dists/scripts/redhat-<wbr>set_hostname.sh. If the server running cPanel, it doesn&#39;t apply hostname. It would be great to add it to future updates of OpenVZ.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Details of the patch are below:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>--- redhat-set_hostname.sh<span style="white-space:pre-wrap">        </span>2017-09-21 02:27:57.080899967 -0600</div><div>+++ redhat-set_hostname_new.sh<span style="white-space:pre-wrap">        </span>2017-09-21 02:30:24.921061967 -0600</div><div>@@ -28,8 +28,8 @@</div><div> </div><div> <span style="white-space:pre-wrap">        </span>if [ -f /etc/hostname ]; then</div><div> <span style="white-space:pre-wrap">                </span># New style: RHEL7/Fedora15+</div><div>-<span style="white-space:pre-wrap">                </span># Note hostname(5) says it should NOT be FQDN</div><div>-<span style="white-space:pre-wrap">                </span>val=${val%%.*}</div><div>+<span style="white-space:pre-wrap">                </span># Note hostname(5) says it should NOT be FQDN, but it breaks cPanel</div><div>+<span style="white-space:pre-wrap">                </span>[ -e /usr/local/cpanel/version ] || val=${val%%.*}</div><div> <span style="white-space:pre-wrap">                </span>echo &quot;$val&quot; &gt; /etc/hostname</div><div> <span style="white-space:pre-wrap">        </span>else</div><div> <span style="white-space:pre-wrap">                </span># &quot;Classic&quot; style</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">--</div><div style="font-size:12.8px">Best regards,</div><div style="font-size:12.8px">NK Support Team</div><div style="font-size:12.8px"><a href="http://www.nksupport.com/" target="_blank">http://www.nksupport.com/</a></div></div>