[17:16] <zathras> I run Debian stable. I do not understand why cloud-init adds certain hostname alternatves as I do not see how this is caused by the debian template. Also cloud-init makes that Postfix sees a hostname and not a fqdn which creates trouble.
[17:16] <zathras> Any pointers regarding docs or how to analyse this?
[17:17] <zathras> (My host has many aliases, so why a selection is made and linked to 127.1.0.1 although it has DNS entries puzzles me)
[17:28] <Quark> zathras: clean up your config, and do `cat <your_config> | nc termbin.com 9999` so people can take a look?
[17:29] <zathras> Quark, which config(file) would that be?
[17:30] <zathras> cloud.cfg in /etc/cloud?
[17:30] <Quark> zathras: the one you are using for cloud-init (user-data, meta-data, etc.).
[17:32] <zathras> I did not actually install it. It came with the install of Debian when I selected it as OS for my Hetzner VPS. So it has Debian and Hetzner config stuff. Nothing I added, set or changed
[17:32] <zathras> so I am not entirely sure
[17:32] <Quark> Oh, I see.
[17:32] <Quark> Hmm.
[17:33] <zathras> conf.d hsa 1 debian and 2 Hetzner files
[17:33] <zathras> cloud.cfg.d sorry
[20:45] <minimal> zathras: as Quark mentioned you'd need to provide details of the configuration used by cloud-init in order for anyone to help
[20:53] <zathras> Most of my troubles seem to originate from the Debian template. However it mentions that manage_etc_hosts is set. Setting it to false will help I assume. However I cannot find it in /etc/cloud but I do find it in /var/lib/cloud/instances/<id>/ in vendor-data.txt vendor-data.txt.1 and vendor-cloud-config.txt
[20:54] <zathras> Will setting this to false help or is it just there for creation and no (re)booting purposes? If so: where should I do that?
[20:54] <zathras> *and not
[20:57] <zathras> The docs say: I should change the setting in /etc/cloud/cloud.cfg or cloud-config from user data. The setting can not be found in the first. And the second? I have no idea where that is.
[20:57] <zathras> could not find something in /root
[21:00] <minimal> zathras: what exactly is your "trouble" with the Debian template?
[21:58] <zathras> minimal, sorry for the delay. The Debian template sets /etc/hosts with 127.0.1.1 {{fqdn}} {{hostname}
[21:59] <zathras> The problem with this is that {{fqdn}} now no longer points to my external IP obviously
[22:00] <zathras> so Postfix complains as it is also configured to use dkim/dmarc and thinks the IP-address is spoofed
[22:02] <zathras> In its log I get SMTP error 553 5.7.1 sender address rejected. Due to the unmatched IP/hostname as the later is set to 127.0.1.1
[22:03] <zathras> related to ehlo
[22:04] <minimal> that sounds like a Postfix configuration-related issue
[22:05] <minimal> by "external IP" I assume you're referring to a NAT'ed IP (i.e. not an actual IP address configured on an interface of the VM)
[22:06] <zathras> no. The actual internet v4 address
[22:07] <zathras> Postfix takes the hostname or you can set it in the config of Postfix itself
[22:07] <zathras> However then this hostname no longer matches to the IP in DNS as it gets fubar-ed by the 127.1.1.0 setting enforced by cloud-init
[22:09] <zathras> So I have 2 questions: 1.  has 'managed_etc_hosts' impact on booting or was it just useful during the initial setup of the server? 2. If useful during boot, where can/should I (re)configure it?
[22:18] <zathras> However I just read that cloud_init_modules update_etc_hosts can be commented out to fix it too
[22:18] <zathras> is this the way to go?
[22:19] <zathras> basically: https://serverfault.com/questions/1108760/how-to-disable-etc-hosts-from-resetting-after-reboot
[22:21] <meena> zathras: did you read https://cloudinit.readthedocs.io/en/latest/reference/modules.html#update-etc-hosts && https://cloudinit.readthedocs.io/en/latest/reference/modules.html#update-hostname ?
[22:25] <zathras> I did read some docs, but missed these. I just read them. I missed on *where* (which file/location) to define that setting
[22:26] <zathras> It is nice that an example is provided, but it does not specify in which file/location
[22:31] <minimal> in user-data of course...
[22:33] <zathras> ok. Thank you. But where is that? Not in /etc/cloud and I did not spot it somewhere in /root
[22:33] <minimal> it's whereever your cloud provider lets you specify it
[22:33] <minimal> when you create the VM
[22:33] <zathras> see 1.40 up where I specify what I found on my system
[22:34] <minimal> ?
[22:35] <zathras> 1 hour 40 mins ago I specified my layout and where I did grep/found manage_etc_hosts
[22:36] <zathras> It looks like genereated files in /var/lib/cloud where I found it 3 times. But I did not find it in /etc/cloud
[22:37] <zathras> The VPS provider is Hetzner
[22:38] <minimal> so figure out where in Hetzner's GUI for creating VMs they let you specify user-data
[22:41] <minimal> user-data is specified at the time a VM is created
[22:46] <zathras> I did find: etc/cloud/cloud.cfg.d/90-hetznercloud.cfg with a setting: preserve_hostname
[22:47] <zathras> seems like a solution to me. Stil no clue about where the user-data is stored though
[22:47] <minimal> you provide the user-data when you create the VM
[22:48] <minimal> how exactly did you create the VM?
[22:48] <zathras> uhm. The VM is created through a webinterface. I never specified a thing. I also did not choose to install cloud-init
[22:48] <minimal> so then you did not provide any user-data
[22:49] <zathras> only things like: user-account, size of disk, name of server. That is about it iirc
[22:50] <minimal> https://docs.hetzner.com/cloud/servers/faq/#can-i-use-cloud-init-when-creating-servers
[22:50] <zathras> I also see definitions in hat cfg file for: cloud_dir: /var/lib/cloud/   && templates_dir: /etc/cloud/templates/
[22:50] <minimal> "While creating your server, you can inject cloud-init user data"
[22:51] <zathras> yes. I just read that. However I never did.
[22:52] <zathras> maybe as a background process initiated by the Hetzner Web-gui. But not intentionally
[22:53] <zathras> But am I right that preserve_host: True is the fix I am looking for?
[22:53] <minimal> and it was suggested that you DO "inject" user-data if you want to set such things as "manage_etc_hosts" or "preserve_hostname" etc
[22:54] <zathras> fine by me if I knew where to do that
[22:55] <minimal> that would be a question best addressed to Hetzner support
[22:55] <zathras> I will search the web-gui
[23:05] <zathras> could not find it. Filed a support request. Probably an answer tomorrow