Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hostname getting set to fqdn after upgrading to cloud-init-22.2 #4006

Closed
ubuntu-server-builder opened this issue May 12, 2023 · 5 comments
Closed
Labels
launchpad Migrated from Launchpad priority Fix soon

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1983811

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = 2022-08-19T16:37:38.567425+00:00
date_created = 2022-08-08T07:08:17.420811+00:00
date_fix_committed = 2022-08-14T16:09:13.859621+00:00
date_fix_released = 2022-08-19T16:37:38.567425+00:00
id = 1983811
importance = high
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1983811
milestone = None
owner = sshedi
owner_name = Shreenidhi Shedi
private = False
status = fix_released
submitter = sshedi
submitter_name = Shreenidhi Shedi
tags = ['cloud-init-22.2', 'hostname']
duplicates = []

Launchpad user Shreenidhi Shedi(sshedi) wrote on 2022-08-08T07:08:17.420811+00:00

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 #1365 has introduced this change, not sure though.

We discussed a bit about this issue in #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
@ubuntu-server-builder ubuntu-server-builder added launchpad Migrated from Launchpad priority Fix soon labels May 12, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Shreenidhi Shedi(sshedi) wrote on 2022-08-08T07:08:17.420811+00:00

Launchpad attachments: cloud-init-22.1 support bundle

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Shreenidhi Shedi(sshedi) wrote on 2022-08-08T07:09:05.520891+00:00

Launchpad attachments: cloud-init-22.2 support bundle

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user James Falcon(falcojr) wrote on 2022-08-12T13:45:00.919556+00:00

Thanks for the detailed bug report. Yes, running always rather than once-per-instance does represent a regression.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Shreenidhi Shedi(sshedi) wrote on 2022-08-14T15:59:32.168426+00:00

Issue is fixed in:
25326a3

I will close this bug or if it's not possible from my end, feel free to close this issue.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Brett Holman(holmanb) wrote on 2022-08-19T16:37:39.691491+00:00

This bug is believed to be fixed in cloud-init in version 22.3. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launchpad Migrated from Launchpad priority Fix soon
Projects
None yet
Development

No branches or pull requests

1 participant