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

user.* keys do not work with the nocloud datasource provided by LXD #14803

Open
stew3254 opened this issue Jan 15, 2025 · 0 comments
Open

user.* keys do not work with the nocloud datasource provided by LXD #14803

stew3254 opened this issue Jan 15, 2025 · 0 comments
Assignees
Milestone

Comments

@stew3254
Copy link

stew3254 commented Jan 15, 2025

When using jinja templates for cloud-init, it's very convenient to pass custom values in by user.* and then access them by ds.config.user_*. Here is a LXD profile demonstrating an example.

name: demo
description: Jinja cloud-init demo
config:
  cloud-init.user-data: |
    ## template: jinja
    #cloud-config
    users:
      - name: "{{ ds.config.user_username }}"
        sudo: ALL=(ALL) NOPASSWD:ALL
        shell: /bin/bash
        plain_text_passwd: "{{ ds.config.user_password }}"
        lock_passwd: false
  user.password: test
  user.username: test

If you were to launch this profile on a jammy or later vm, or any container, it should create a user named test with the password test instead of the ubuntu user.

Now, add a config drive to the profile under the devices section:

devices:
  config:
    source: cloud-init:config
    type: disk

Now, the user.username and user.password variables don't get passed in via the NoCloud datasource. Therefore, the default ubuntu user is created instead. This occurs because the variables were not actually passed into the meta-data file in the root of /dev/sr0 which the drive added. Therefore, no custom variables can be passed to instances launched using this method.

Currently, this breaks tooling using Focal vms as a base image, such as those trying to reproduce Ubuntu FIPS issues because Focal does not properly implement the standard LXD datasource.

@tomponline tomponline added this to the lxd-6.3 milestone Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants