Public bug reported: Hi All,
Environment details: cloud-init-22.2 Photon OS 3.0 and above I am seeing something weird after upgrading to cloud-init-22.2 My /etc/hosts looks like this: $ cat /etc/hosts 127.0.1.1 ph3dev.local ph3dev 127.0.0.1 localhost And my /etc/hostname $ cat /etc/hostname ph3dev Now if I do systemctl restart cloud-init , /etc/hostname is getting changed. $ cat /etc/hostname ph3dev.local And hostname command return fqdn instead of short name. Isn't it incorrect to have fqdn in /etc/hostname? I have prefer_fqdn_over_hostname = True in photon.py I changed frequency = PER_ONCE in cc_set_hostname.py and it doesn't modify /etc/hostname after that and this is how it was in cloud-init <= v22.1 and even in v22.1 we have prefer_fqdn_over_hostname set in photon.py but it doesn't modify /etc/hostname file. I doubt that https://github.com/canonical/cloud-init/pull/1365 has introduced this change, not sure though. We discussed a bit about this issue in https://github.com/canonical/cloud-init/pull/1365. If it helps, I see the follwing entries in cloud-init-22.1 logs: ``` 2022-08-08 06:58:38,498 - stages.py[DEBUG]: Running module set_hostname (<module 'cloudinit.config.cc_set_hostname' from '/usr/lib/python3.7/site-packages/cloudinit/config/cc_set_hostname.py'>) with frequency once-per-instance ``` And in cloud-init-22.2: ``` 2022-08-08 07:00:38,512 - modules.py[DEBUG]: Running module set_hostname (<module 'cloudinit.config.cc_set_hostname' from '/usr/lib/python3.7/site-packages/cloudinit/config/cc_set_hostname.py'>) with frequency always ``` ``` ** Affects: cloud-init Importance: Undecided Status: New ** Tags: cloud-init-22.2 hostname ** Attachment added: "cloud-init-22.1 support bundle" https://bugs.launchpad.net/bugs/1983811/+attachment/5607305/+files/cloud-init-22.1.tar.gz -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to cloud-init. https://bugs.launchpad.net/bugs/1983811 Title: Hostname getting set to fqdn after upgrading to cloud-init-22.2 Status in cloud-init: New Bug description: Hi All, Environment details: cloud-init-22.2 Photon OS 3.0 and above I am seeing something weird after upgrading to cloud-init-22.2 My /etc/hosts looks like this: $ cat /etc/hosts 127.0.1.1 ph3dev.local ph3dev 127.0.0.1 localhost And my /etc/hostname $ cat /etc/hostname ph3dev Now if I do systemctl restart cloud-init , /etc/hostname is getting changed. $ cat /etc/hostname ph3dev.local And hostname command return fqdn instead of short name. Isn't it incorrect to have fqdn in /etc/hostname? I have prefer_fqdn_over_hostname = True in photon.py I changed frequency = PER_ONCE in cc_set_hostname.py and it doesn't modify /etc/hostname after that and this is how it was in cloud-init <= v22.1 and even in v22.1 we have prefer_fqdn_over_hostname set in photon.py but it doesn't modify /etc/hostname file. I doubt that https://github.com/canonical/cloud-init/pull/1365 has introduced this change, not sure though. We discussed a bit about this issue in https://github.com/canonical/cloud-init/pull/1365. If it helps, I see the follwing entries in cloud-init-22.1 logs: ``` 2022-08-08 06:58:38,498 - stages.py[DEBUG]: Running module set_hostname (<module 'cloudinit.config.cc_set_hostname' from '/usr/lib/python3.7/site-packages/cloudinit/config/cc_set_hostname.py'>) with frequency once-per-instance ``` And in cloud-init-22.2: ``` 2022-08-08 07:00:38,512 - modules.py[DEBUG]: Running module set_hostname (<module 'cloudinit.config.cc_set_hostname' from '/usr/lib/python3.7/site-packages/cloudinit/config/cc_set_hostname.py'>) with frequency always ``` ``` To manage notifications about this bug go to: https://bugs.launchpad.net/cloud-init/+bug/1983811/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp