proxmox 5.1-52 Centos 7 cloud-image

Jan 4, 2016
14
0
21
50
Hello I'm trying to use the Generic cloud image of Centos 7 and I would like to disable the login via SSH-Key, I can use a file cloud-config.yaml as user-data in proxmox ?
 
I did some cloud-init debugging on Centos 7, with the NoCloud implementation adopted by proxmox there are two big problems:
  • the first is that the mac address must be in lowercase or cloud-init do not find te interfaces
  • the second is that the conf ifcfg-eth0 file generated by cloud init puts the value inside IPADDR with the a subnet i.e. 192.168.1.2/24, this blocks the network configuration.
Some one have a solution ?
 
I read the code in perl Cloudinit.pm of proxmox which generates files for cloud-init through genisoimage, and I found that for Centos the correct generation of cloud-init is that of the function configdrive2_network. To make Proxmox generate the cloud-init file with this function, just set the os_type value of the vm to windows. But is not applicable workaround.
 
Last edited:
you can manually select the type with
Code:
qm set <ID> -citype configdrive2
no need to set the os type
 
Thank you for your advice, now I try.
But you should manage the differences according to the Linux distribution.
Cloud-init networking uses three different modes according to the distro ENI, Netplan, Sysconfig and for the case of the Centos distro the netmask should be set in addition to the ip address.

Here your output:
network:
version: 1
mac_address: xxxxx
config:
- type: physical
name: eth0
subnets:
- type: static
address: 192.168.1.3/24

The possible correct output for Sysconfig (RHEL,Centos) is:
network:
version: 1
mac_address: xxxxx
config:
- type: physical
name: eth0
subnets:
- type: static
address: 192.168.1.3
netmask: 255.255.255.0
 
But you should manage the differences according to the Linux distribution.
but for vms we do not know the distribution inside
the cloud init package inside the vm should handle the correct way to configure the vm os

i know that some cloud-init packages are somewhat broken/old (debian jessie) but this is more of a guest os problem, not a proxmox one
 
Ok for now i have simply patched function nocloud_network in Cloudinit.pm.
Now use netmask:
my ($addr, $mask) = split('/', $ip);
$content .= "${i}- type: static\n"
. "${i} address: $addr\n"
. "${i} netmask: $PVE::Network::ipv4_reverse_mask->[$mask]\n";

Probably this work with both Debian and RHEL.
 
But you should manage the differences according to the Linux distribution.
No.
To be clear about this: the whole point of cloud init is supposed to be that we do not need to care about the distribution or even the OS inside the machine. The point of cloud init is to take some kind of configuration input, run it through the matching frontend, to produce an internal representation that is supposed to be completely independent from what type of input format it had previously, and then run that through the backend generating the OS specific output (at least that's the design they should have gone for...). Whether we're writing an IP address and a netmask, or a CIDR, should not make any difference whatsoever. Whether mac addresses are written in upper, lower or mixed case should not make a difference whatsoever.
Cloudinit is supposed to take the input, understand it, and produce an output the OS can understand. If it's incapable of doing that, it's the problem of the distribution you're running, and you should take it to them, not to us.
The only thing important to us - and the only thing at least I'll ever care about - is that the input we generate matches their specification. We've already had to read through enough parts of their source code to understand why things haven't been working.
 
Yes, unfortunately. But I'd much rather have them fix it. See, if we fix distribution A it might break distribution B and vice versa... it's been quite frustrating...
 
Whilst that may be the case, it appears others have adjusted around any issues with cloud-init.

Given that CentOS is very popular, simply sticking your feet in and saying "not our problem, get them to fix" is not a workable solution. As someone else has done, we could patch but then this is something we have to do each time.

Currently, CentOS does not work at all due to the subnet issue and Ubuntu adds the DNS search domain and DNS to the wrong interface (as already reported).

There has to be a better middle ground here, otherwise, a very demanded feature is useless to most.
 
  • Like
Reactions: pmoxuser7
Meh. I guess we can look into that. I still want to point out that it totally defeats the purpose of the whole cloud init project and having to workaround differently-broken variants of it that way is completely insane.
 
First of all, I want to thank the Proxmox development team for offering us the implementation of Cloud-init, you really do a great job.

I tested with Ubuntu 18.04 and all is working fine, but with CentOS 7 we have some issues.

As mentioned here, there is not IP connection by default, and with -citype configdrive2 the VM has IP connection but the resolv.conf is not correctly configured and the VM has not DNS resolution, we need to configure by hand.

Also the user and password parameters configured in the "Cloud-init" seems are not taking effect.
 
For the network settings there's an update queued. For the passwords - that's because when setting them over the api we only store hashes, and CentOS 7's current cloud-init version does not support pre-hashed passwords, only plaintext ones. Currently you can only write them in plaintext manually into the vm config in /etc/pve/qemu-server/$vmid.conf
 
Last edited:
For the network settings there's an update queued. For the passwords - that's because when setting them over the api we only store hashes, and CentOS 7's current cloud-init version does not support pre-hashed passwords, only plaintext ones. Currently you can only write the min plaintext manually into the vm config in /etc/pve/qemu-server/$vmid.conf

Hello,

Any updates from this ?
 
`them in` typo corrected...
Open eg. /etc/pve/qemu-server/100.conf, look for (or add) the line starting with `cipassword: ` and put the password there in plaintext like
Code:
cipassword: 12345678
 
Hi Guys,

For CentOS 7 use this version of Cloud-init , that works.

copr . fedorainfracloud. org / coprs / g / cloud-init / cloud-init-dev /
 

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!