canonical / canonical/cloud-init
Cloudinit issue with legacy CentOS 8 stream
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 22
Description
# Bug report
version: cloud-init-23.4-7.el8.3.noarch
kernel version: 4.18.0-553.6.1.el8.x86_64
Basically I am using Packer to build the image which has cloud-init baked in the OS. When the VM is provisioned in Foreman via image-base method, the cloud-init should get the userdate template and cloud-init template from Foreman and apply onto the VM. It works with Centos 9 and Rocky9 so far.
When I configure the cloud init with CentOS 8, it keeps trying to create the default user ‘admin’ where those parameters assigned to the user are in the wrong object type.
When I run cloud-init schema --system
error:
Invalid user-data /var/lib/cloud/instances/i-bdf3f54642b2d80f8e/cloud-config.txt
Error: Cloud config schema errors: users.1.passwd: None is not of type ‘string’, users.1.sudo: [‘ALL=(ALL) ALL’] is not of type ‘boolean’, users.1.sudo: [‘ALL=(ALL) ALL’] is not of type ‘string’, ‘null’
Here is my config,
It has this part in my cloud-config.txt
users:
default
groups: users
lock-passwd: false
name: admin
passwd: null
primary-group: admin
shell: /bin/bash
sudo:
ALL=(ALL) ALL
…
which I think it comes from nowhere. I checked the cloud-init template for this VM in foreman, it does not have this section created
for my cloud.cfg in ks.cfg, I did not create any users. Here is the sample of my ks.cfg
cat << EOM > /etc/cloud/cloud.cfg.d/01_network.cfg
network:
config: disabled
EOM
cat << EOM > /etc/cloud/cloud.cfg.d/10_datasource.cfg
datasource_list: [NoCloud]
datasource:
NoCloud:
seedfrom: http://foreman1.abc.ca/userdata/
EOM
cat << EOM > /etc/cloud/cloud.cfg
#cloud-config
cloud_init_modules:
- bootcmd
- ssh
cloud_config_modules:
- runcmd
cloud_final_modules:
- scripts-per-once
- scripts-per-boot
- scripts-per-instance
- phone-home
system_info:
distro: centos
paths:
cloud_dir: /var/lib/cloud
templates_dir: /etc/cloud/templates
ssh_svcname: sshd
EOM
From my config, I did not create any default user. But when the VM is booted, I checked the cloud-init-output.log, I can see that there is an error mentioned above.
I have no idea why it keeps creating the weird default user and breaking my VM to retrieve the cloud-init template from Foreman. I tried to remove the user directives under the /var/lib/cloud/instances/i-36d64040f731b093d7/cloud-config.txt
However, if I run cloud-init init or cloud-init clean --reboot, there is still no config applied to CentOS stream 8. I could see all the userdata and cloud-config.txt needed to apply on the host but nothing is applied.
I also checked the cloud-init-output.log, it was running but it is not running the config from userdata/cloudinit template.
from cloud-init.log, there is no ERR message either.
For the same config, I could apply on CentOS 9 and Rocyk 9(some twists)
## Steps to reproduce the problem
## Environment details
- Cloud-init version: cloud-init-23.4-7.el8.3.noarch
- Operating System Distribution: CentOS 8 stream , kernel version: 4.18.0-553.6.1.el8.x86_64
- Cloud provider, platform or installer type: VMWare
## cloud-init logs
Contributor guide
Research direction
Start by reproducing the CentOS 8 Stream case with /etc/cloud/cloud.cfg, /etc/cloud/cloud.cfg.d/10_datasource.cfg, and the Foreman-provided cloud-config.txt, then run cloud-init schema --system and inspect cloud-init-output.log. Done means identifying why the generated users entry differs from the CentOS 9 behavior and restoring application of the fetched user-data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cloud, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100