From 0692cabba3dc3a8306d1afcb3ee9b46034cd7cb9 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Wed, 20 Feb 2019 11:39:38 +0100 Subject: [PATCH] Remove that '.novalocal' line in /etc/hosts, added by cloud-init It messes up `hostname -f` on Debian, even if there's a correct line further down in /etc/hosts. --- global/overlay/etc/cosmos/apt/bootstrap-cosmos.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/global/overlay/etc/cosmos/apt/bootstrap-cosmos.sh b/global/overlay/etc/cosmos/apt/bootstrap-cosmos.sh index c1ccf8c..24369bb 100755 --- a/global/overlay/etc/cosmos/apt/bootstrap-cosmos.sh +++ b/global/overlay/etc/cosmos/apt/bootstrap-cosmos.sh @@ -57,6 +57,9 @@ if [ ${?} -eq 0 ]; then sed -i 's/manage_etc_hosts: true/manage_etc_hosts: false/g' /etc/cloud/cloud.cfg fi +# Remove potential $hostname.novalocal line from /etc/hosts, added by cloud-init +sed -i.bak -e "s/^127\.0\.1\.1 $(hostname)\..*novalocal.*//1" /etc/hosts + hostname $cmd_hostname short=`echo ${cmd_hostname} | awk -F. '{print $1}'` echo "127.0.1.1 ${cmd_hostname} ${short}" >> /etc/hosts