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

Can not override distro default user #5981

Open
ElSamhaa opened this issue Jan 17, 2025 · 1 comment
Open

Can not override distro default user #5981

ElSamhaa opened this issue Jan 17, 2025 · 1 comment
Labels
incomplete Action required by submitter

Comments

@ElSamhaa
Copy link

ElSamhaa commented Jan 17, 2025

Bug report

According to the docs, the default user data can be overriden by the user dictionary keys. Unfortunately, this is not the case.

Steps to reproduce the problem

Apply the below user_data to Almalinux 9.5 generic cloud image

#cloud-config

user:
  name: samha
  plain_text_passwd: password
  lock_passwd: false

users:
- name: root
  plain_text_passwd: password
  lock_passwd: false

The root password is modified but the default user (i.e almalinux) is not changed to samha.

Environment details

  • Cloud-init version: 23.4
  • Operating System Distribution: Almalinux
  • Cloud provider, platform or installer type: KVM

cloud-init logs

cloud-init.tar.gz

@ElSamhaa ElSamhaa added bug Something isn't working correctly new An issue that still needs triage labels Jan 17, 2025
@TheRealFalcon
Copy link
Member

@ElSamhaa , based on your logs, it appears that whatever platform you're running isn't correctly identifying itself to cloud-init, or the metadata service associated with that platform wasn't working properly when cloud-init attempted to connect.

From cloud-init.log:

2025-01-16 21:16:58,695 - __init__.py[DEBUG]: Detected platform: DataSourceOpenStack [net,ver=None]. Checking for active instance data
2025-01-16 21:16:58,696 - util.py[DEBUG]: Resolving URL: http://[fe80::a9fe:a9fe] took 0.001 seconds
2025-01-16 21:16:58,696 - util.py[DEBUG]: Resolving URL: http://169.254.169.254 took 0.000 seconds
2025-01-16 21:16:58,700 - url_helper.py[DEBUG]: [0/1] open 'http://[fe80::a9fe:a9fe]/openstack' with {'url': 'http://[fe80::a9fe:a9fe]/openstack', 'stream': False, 'allow_redirects': True, 'method': 'GET', 'timeout': 10.0, 'headers': {'User-Agent': 'Cloud-Init/23.4-19.el9.alma.1'}} configuration
2025-01-16 21:16:58,851 - url_helper.py[DEBUG]: [0/1] open 'http://169.254.169.254/openstack' with {'url': 'http://169.254.169.254/openstack', 'stream': False, 'allow_redirects': True, 'method': 'GET', 'timeout': 10.0, 'headers': {'User-Agent': 'Cloud-Init/23.4-19.el9.alma.1'}} configuration
2025-01-16 21:16:58,852 - url_helper.py[WARNING]: Exception(s) [UrlError("HTTPConnectionPool(host='fe80::a9fe:a9fe', port=80): Max retries exceeded with url: /openstack (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffff7f1a9eb0>: Failed to establish a new connection: [Errno 22] Invalid argument'))"), UrlError("HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /openstack (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffff7dff08b0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))")] during request to http://169.254.169.254/openstack, raising last exception
2025-01-16 21:16:58,852 - url_helper.py[DEBUG]: Calling 'None' failed [0/-1s]: request error [HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /openstack (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffff7dff08b0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))]
2025-01-16 21:16:58,852 - url_helper.py[ERROR]: Timed out, no response from urls: ['http://[fe80::a9fe:a9fe]/openstack', 'http://169.254.169.254/openstack']
2025-01-16 21:16:58,852 - DataSourceOpenStack.py[DEBUG]: Giving up on OpenStack md from ['http://[fe80::a9fe:a9fe]/openstack', 'http://169.254.169.254/openstack'] after 0 seconds
2025-01-16 21:16:58,852 - util.py[WARNING]: No active metadata service found
2025-01-16 21:16:58,852 - util.py[DEBUG]: No active metadata service found
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceOpenStack.py", line 167, in _get_data
    results = self._crawl_metadata()
  File "/usr/lib/python3.9/site-packages/cloudinit/sources/DataSourceOpenStack.py", line 211, in _crawl_metadata
    raise sources.InvalidMetaDataException(
cloudinit.sources.InvalidMetaDataException: No active metadata service found
2025-01-16 21:16:58,852 - __init__.py[DEBUG]: Datasource DataSourceOpenStack [net,ver=None] not updated for events: boot-new-instance
2025-01-16 21:16:58,852 - handlers.py[DEBUG]: finish: init-network/search-OpenStack: SUCCESS: no network data found from DataSourceOpenStack
2025-01-16 21:16:58,852 - handlers.py[DEBUG]: start: init-network/search-None: searching for network data from DataSourceNone
2025-01-16 21:16:58,852 - __init__.py[DEBUG]: Seeing if we can get any data from <class 'cloudinit.sources.DataSourceNone.DataSourceNone'>
2025-01-16 21:16:58,852 - __init__.py[DEBUG]: Update datasource metadata and network config due to events: boot-new-instance
2025-01-16 21:16:58,852 - __init__.py[DEBUG]: Detected platform: DataSourceNone. Checking for active instance data

Further down you can see, 2025-01-16 21:16:58,901 - main.py[DEBUG]: Skipping user-data validation. No user-data found.

If I run your cloud-config within an LXD container, I get the result you're expecting.

@TheRealFalcon TheRealFalcon added incomplete Action required by submitter and removed bug Something isn't working correctly new An issue that still needs triage labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incomplete Action required by submitter
Projects
None yet
Development

No branches or pull requests

2 participants