Bug 1214480

Summary: cloud-init: unwanted/undocumented sles user is generated and opensuse credentials are not upgraded after second cloud-init initialization
Product: [openSUSE] openSUSE Distribution Reporter: Matías Pecchia <mabeett>
Component: Cloud:ImagesAssignee: SUSE Public Cloud Maintainer <public-cloud-maintainers>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: mabeett
Version: Leap 15.5   
Target Milestone: ---   
Hardware: x86-64   
OS: Ubuntu   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Matías Pecchia 2023-08-22 22:29:10 UTC
1) Download Leap 15.5 - Minimal Virtual Machine - Cloud image AMD64
https://get.opensuse.org/leap/15.5/?type=server#download
aeffccb223bae45c5a60dad632b487cfb7cb91ed6518af3ed7d84e1eb3e49dab
openSUSE-Leap-15.5-Minimal-VM.x86_64-Cloud.qcow2
2) Setup a KVM virtual machine based in the downloaded drive with a cloud-init drive. with default user and one specific password ( in this example OpenSuse2023! ). Here some files:
```yaml user-data
#cloud-config
hostname: opensuse-see-if-user-is-created
manage_etc_hosts: true
password: $5$QnrWSOwo$1KtDoVEtEr/YhpmXbbv86aiIHs01Py2U12VnfUlLr82
ssh_authorized_keys:
  - ssh-rsa AAAA...NVw== foo@bar
chpasswd:
  expire: False
users:
  - default
package_upgrade: true

```

```yaml meta-data
instance-id: beeffcaaaaaaaaaaaaaaaaaaaaaffffffffffffe
```
3) Start the virtual machine, a zypper system upgrade is going to be triggered,
4) log in as opensuse user - wait cloud init ends ( in the shell `cloud-init status --wait` )
5) shutdown the VM
6) change the password for the user in the cloud-init drive, ( instance-id in meta-data must be new, password:$5$QnrWSOwo$LFAID334vgbKuy/jIXlllfe79fDvi8U.3iuvTswDiuD is OpenSuse2023!2 password ),
7) start the VM
8) You will have 2 users available: the opensuse one and sles.
Steps 2) to 5) might be part of some automatic template generation ( as packer ).
This problem might be present in other images as EC2 or Azure one.
Let me know if you need further information,

Regards,
Comment 1 Matías Pecchia 2023-08-22 22:30:49 UTC
I left a draft of solution in OBS.
https://build.opensuse.org/request/show/1104687