LXD: ubuntu-minimal images 18.04 and 20.04 ignore cloud config

Bug #2002160 reported by Alex Klyuev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-images
Confirmed
Wishlist
Unassigned

Bug Description

when creating containers with ubuntu-minimal repository, the 18.04 and 20.04 versions of the container completely ignores cloud_init directives supplied with the profile during the container creation and operation.

When I create a container from the ubuntu-minimal image store the cloud-init components are completely ignored by 18.04, 20.04 and 22.04 images. I have my cloud_init in a separate profile and I init the containers as follows:

lxd init ubuntu-minimal:18.04 um18test -p default -p cloud_init
lxd init ubuntu-minimal:20.04 um20test -p default -p cloud_init
lxd init ubuntu-minimal:22.04 um22test -p default -p cloud_init

The cloud_init profile has the following directives:

config:
    cloud-init.user-data: |
    #cloud-config
    locale: C.UTF-8
    timezone: Europe/Moscow
    runcmd:
      - [apt-get, -y, update]
      - [apt-get, -y, upgrade]
      - [apt, -y, autoremove]
      - [touch, /tmp/simos_was_here]
    users:
            - name: alex
              plain_text_passwd: 'foobarbaz'
              chpasswd:
                   expire: True
              ssp_pwauth: false
              shell: /bin/bash
              groups: admin, sudo
              ssh_authorized_keys:
                      - ssh-ed25519 REDACTED REDACTED
   - name: ansctl
              shell: /bin/bash
              ssh_authorized_keys:
                      - ssh-ed25519 REDACTED REDACTED
    write_files:
            - content: |
                    ansctl ALL=(ALL) NOPASSWD: ALL
              path: /etc/sudoers.d/ansctl
              owner: root:root
              permissions: '0640'
description: General settings for instances
devices: {}
name: cloud_init

The config works for 22.04 minimal and for all of the full-sized images from the "ubuntu" repository

Revision history for this message
Simon Poirier (simpoir) wrote (last edit ):

This doesn't seem specific to minimal images, just related to old ubuntu versions.

cloud-init.user-data is a relatively recent config key. The version of LXD shipped with 18.04 (v3) didn't have it. Images of that release also don't have that config in their nocloud template.

However, older images support the "user.user-data", which still works with newer images (and will work as long as lxd supports it). So it's not a regression.

The question becomes if we should consider starting to add forward-compatible lxd config keys to old lxd images nocloud metadata templates. I anticipate regressions. And that's more of a feature request than a bug. Triaging as wishlist.

TLDR workaround, use "user.user-data"

Changed in cloud-images:
status: New → Confirmed
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.