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

doc/cloud-init: add a note that recent cloud-init on older Ubuntu still doesn't support modern keys #14693

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

simondeziel
Copy link
Member

No description provided.

…till doesn't support modern keys

Signed-off-by: Simon Deziel <[email protected]>
@github-actions github-actions bot added the Documentation Documentation needs updating label Dec 18, 2024
@simondeziel
Copy link
Member Author

simondeziel commented Dec 18, 2024

@holmanb I couldn't find where I read it before but I think that cloud-init backports to old releases (like 20.04) intentionally disable support for the LXD datasource and causes LXD guests to use the nocloud one. Is that right?

$ lxc init ubuntu-minimal-daily:20.04 f1

$ lxc config set f1 cloud-init.user-data - << EOF
#cloud-config
runcmd:
  - touch /root/cloud-init.user-data
EOF

$ lxc config set f1 user.user-data - << EOF
#cloud-config
runcmd:
  - touch /root/user.user-data
EOF

$ lxc start f1 && lxc exec f1 -- cloud-init status --wait
$ lxc exec f1 -- cloud-init status --long | grep detail
detail: DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net]
$ lxc exec f1 -- cloud-init query userdata
#cloud-config
runcmd:
  - touch /root/user.user-data

$ lxc exec f1 -- ls -l /root/
total 1
-rw-r--r-- 1 root root 0 Dec 18 23:27 user.user-data

$ lxc exec f1 -- dpkg -l | grep cloud-init
ii  cloud-init                     24.3.1-0ubuntu0~20.04.1           all          initialization and customization tool for cloud instances

In the above, we see that only the legacy key user.user-data was taken into account.

@simondeziel simondeziel marked this pull request as ready for review December 18, 2024 23:29
@simondeziel
Copy link
Member Author

simondeziel commented Dec 18, 2024

For comparison, here is with a more modern Ubuntu version (22.04):

$ lxc init ubuntu-minimal-daily:22.04 j1

$ lxc config set j1 cloud-init.user-data - << EOF
#cloud-config
runcmd:
  - touch /root/cloud-init.user-data
EOF

$ lxc config set j1 user.user-data - << EOF
#cloud-config
runcmd:
  - touch /root/user.user-data
EOF

$ lxc start j1 && lxc exec j1 -- cloud-init status --wait
$ lxc exec j1 -- cloud-init status --long | grep detail
detail: DataSourceLXD


$ lxc exec j1 -- cloud-init query userdata
#cloud-config
runcmd:
  - touch /root/cloud-init.user-data


$ lxc exec j1 -- ls -l /root/
total 1
-rw-r--r-- 1 root root 0 Dec 18 23:31 cloud-init.user-data

$ lxc exec j1 -- dpkg -l | grep cloud-init
ii  cloud-init                      24.3.1-0ubuntu0~22.04.1                 all          initialization and customization tool for cloud instances

@tomponline tomponline merged commit a5ef247 into canonical:main Dec 19, 2024
25 checks passed
@simondeziel simondeziel deleted the cloud-init branch December 19, 2024 15:02
@holmanb
Copy link
Member

holmanb commented Dec 19, 2024

@holmanb I couldn't find where I read it before but I think that cloud-init backports to old releases (like 20.04) intentionally disable support for the LXD datasource and causes LXD guests to use the nocloud one. Is that right?

Yes. Thanks for this @simondeziel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation needs updating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants