[SOLVED] Cloud init Ubuntu 20.04 Focal and Ubuntu 22.04 Jammy Login incorrect

syedalihussain

New Member
Jul 10, 2023
9
1
1
Hi. I followed along Techno Tim's tutorial on how you can create a VM from a Cloud Init image. I used Ubuntu 22.04 and 20.04 to create a VM. Without starting it (to avoid vm getting a UUID as he described it) I set a username and a password. Then I created a template and from this template I launched a VM. However when I try to login using the password that I set I get an error Login incorrect. I have looked at other posts in the forum and looked at the boot logs from qm start <vmid> && qm terminal <vmid> and did not found any errors or warnings. Also when I run the command `qm cloudinit dump 9001 user` I get the username that I set and the password field also set with what looks like a hashed values. I am unable to find out what the issue is. Any help would be highly appreciated.

Attaching boot logs below in the boot.txt file.

Output of `qm cloudinit dump 9001 user`:
root@proxmox:~# qm cloudinit dump 9001 user
#cloud-config
hostname: Ubuntu-Focal
manage_etc_hosts: true
user: admin
password: $5$Byq7ldzL$****
ssh_authorized_keys:
- ssh-ed25519 ****
chpasswd:
expire: False
users:
- default
package_upgrade: true
I am running Proxmox VE 7.4-3 and the link to the cloud images are these
http://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
http://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
 

Attachments

  • boot.txt
    53.4 KB · Views: 8
Thanks for the prompt reply bbgeek17. Here is what it looks like
root@proxmox:~# qm config 9001
boot: c
bootdisk: scsi0
cipassword: **********
ciuser: admin
cores: 2
ide2: local-lvm:vm-9001-cloudinit,media=cdrom,size=4M
ipconfig0: ip=dhcp
memory: 2048
meta: creation-qemu=7.2.0,ctime=1688994770
name: Ubuntu-Focal
net0: virtio=2A:58:BB:8D:C6:85,bridge=vmbr0
scsi0: local-lvm:vm-9001-disk-0,size=2252M
scsihw: virtio-scsi-pci
serial0: socket
smbios1: uuid=2a47f1c0-d265-4be0-804a-0361d67696df
sshkeys: ssh-ed25519****.com
vga: serial0
vmgenid: af297c20-c3c6-4475-9e66-ade0cc55752f
The cipassword seems to have the right number of characters. One thing I noticed was that whenever I would set the password in the GUI in the cloud-init settings it would generate a different hash even if it was the same password.

Also when I login to my router and look at the hostname that it has identified the machine with. I see `ubuntu` instead of `Ubuntu-Focal` from the qm cloudinit dump command above.
 
In a properly built cloud images, which you appear to be using, there is no "admin" user. There is a "root" user for which log in is disabled, and there is "ubuntu" user.
The PVE CloudInit is a reduced set of total functionality, I am not sure it generates an appropriate Cloud Init file to create additional user. I suspect it doesnt.
So either set credentials for "ubuntu" user, or use Custom Cloud Init for full functionality, ie creating additional users.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
Last edited:
The other poster never followed up. The cloud images you are trying to use, we use daily in our CI/CD with proxmox/cloudInit. Granted we dont use passwords, only ssh keys, but cloud-init functions just fine.

You have to be methodical in your attempt at solution. For example, its not enough to just update password on an existing clone - that portion of cloud init will not run any more. I believe its part of "run once" section. As you retry your solution, you need to remove the VM, clone it again and test your fix on first ever boot.

Start with a clean image, clean clone, just ssh-key - does it work?

PS perhaps you misunderstand how cloud-init is designed. The qm commands you run create a text file, it is then processed on VM start to create an ISO that is attached as CDrom device to the VM. The text you see in the VM config in PVE gui is converted into a properly formatted YML file. The file is processed by VM during boot, if Cloud-Init package is installed.
https://cloudinit.readthedocs.io/en/latest/


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
  • Like
Reactions: syedalihussain
Thanks for the explanation on how it works under the wraps. I was able to finally get it to work. The image that I used were

jammy-server-cloudimg-amd64.img 2023-06-16 02:36 655M Ubuntu Server 22.04 LTS (Jammy Jellyfish) daily builds
focal-server-cloudimg-amd64.img 2023-07-10 22:18 623M Ubuntu Server 20.04 LTS (Focal Fossa) daily builds

All I had to do was use a different `User` name instead of `admin`.

Also found out that some guides run this command on the downloaded image.
virt-customize -a $imageName --install qemu-guest-agent
My configs for the working Jammy VMs are:

root@proxmox:/var/lib/vz/template/qemu# qm config 101
boot: c
bootdisk: scsi0
cipassword: **********
ciuser: syedalihussain
cores: 2
ide2: local-lvm:vm-101-cloudinit,media=cdrom,size=4M
ipconfig0: ip=dhcp
memory: 2048
meta: creation-qemu=7.2.0,ctime=1689136400
name: JammyUbuntuNonVirt
net0: virtio=62:C4:84:21:50:84,bridge=vmbr0
scsi0: local-lvm:vm-101-disk-0,size=2252M
scsihw: virtio-scsi-pci
serial0: socket
smbios1: uuid=81dd35c8-2073-4df9-9ebe-429f58126188
vga: serial0
vmgenid: 5ecbf696-82b8-44a4-90cb-c9ae2903712c
and
root@proxmox:/var/lib/vz/template/qemu# qm config 101
boot: c
bootdisk: scsi0
cipassword: **********
ciuser: syedalihussain
cores: 2
ide2: local-lvm:vm-101-cloudinit,media=cdrom,size=4M
ipconfig0: ip=dhcp
memory: 2048
meta: creation-qemu=7.2.0,ctime=1689136400
name: JammyUbuntuNonVirt
net0: virtio=62:C4:84:21:50:84,bridge=vmbr0
scsi0: local-lvm:vm-101-disk-0,size=2252M
scsihw: virtio-scsi-pci
serial0: socket
smbios1: uuid=81dd35c8-2073-4df9-9ebe-429f58126188
vga: serial0
vmgenid: 5ecbf696-82b8-44a4-90cb-c9ae2903712c
root@proxmox:/var/lib/vz/template/qemu# qm cloudinit dump 101 user
#cloud-config
hostname: JammyUbuntuNonVirt
manage_etc_hosts: true
user: syedalihussain
password: $5$I/L6qsZY$Q6kEEShuZfwB1GzG17jUUwNsiEaqLYzWg7jL2QfrFn3
chpasswd:
expire: False
users:
- default
package_upgrade: true
 
I think the issue may be that a user `admin` already exists that is not allowed to login via the password.
root@JammyUbuntuNonVirt:/home/syedalihussain# cat /etc/passwd | grep admin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
There must be some documentation to explain what values can go into the cloud-init section and what can't.
 
are you using iscsi by any chance?
i have a similar issue where if i set cloudinit to use IDE any cloudimage wont load up the cloud-init drive
The IDE/SCSI CDrom compatibility is a separate issue from what was described in this thread, which is reserved username conflict.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
are you using iscsi by any chance?
i have a similar issue where if i set cloudinit to use IDE any cloudimage wont load up the cloud-init drive
BUT
change the cloudinit drive to isci and it works a treat!
i made an script here to setup a template for ubuntu 22.04 - https://gist.github.com/si458/98aa940837784e9ef9bff9e24a7a8bfd
I was having the same issue as described by syedalihussain at the beginning of this post, I would get the "Login incorrect" message even though I was using a different username. The solution you suggested did the trick for me. I created a new template, this time ensuring I used ISCSI instead of IDE for the cloudinit drive. Created a full clone, fired it up, this time loading cloudinit properly and not having the Login issue anymore.
Thanks for your answer si458.
 
hello,
I try to use:
1. Dont use "admin" account, try another. I try different accounts my there is no result (in my case user1, alexey and others);
2. Try to recreate Cloud Init drive with not IDE adapter, but use ISCSIController
screen is below - no result
2.1 I try to change current setting in template and try to REcreate template from new VM with SCSI adaptes from start.

but i still have login incorrect.
I also saw that users from Cloud Init doesn't exists in /etc/passwd files.
 
I think it is a bug or some problems in off repo. I try to use Rocky Linux 9 instead of Ubuntu and Clouds users correctly worked... very strange.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!