Discussion:
[PVE-User] With cloud-init some bug?
lyt_yudi
2018-03-23 06:28:12 UTC
Permalink
1. Use --sshkey issue:
# qm set 111 --sshkey ~/.ssh/id_rsa.pub
400 Parameter verification failed.
sshkeys: invalid format - invalid urlencoded string: /root/.ssh/id_rsa.pub

qm set 111 --sshkey /root/.ssh/id_rsa.pub <vmid> [OPTIONS]


2. Can't setup static ip address for vm's by cloud-init
Test not passed:
CentOS-6(CentOS-6-x86_64-GenericCloud.qcow2)
CentOS-7(CentOS-7-x86_64-GenericCloud.qcow2)

Debian-9(debian-9-openstack-amd64.qcow2)
only dhcp? configuration static mode is still used in DHCP!

Test passed:
Ubuntu-16.04(xenial-server-cloudimg-amd64-disk1.img)
Ubuntu-18.04(bionic-server-cloudimg-amd64.img)

Can’t use the static ip for some Linux OS, is it the reason why the cloud-init version is too low? must be with cloudinit >= 17.1?

Thanks!
Wolfgang Bumiller
2018-03-23 07:21:22 UTC
Permalink
Post by lyt_yudi
# qm set 111 --sshkey ~/.ssh/id_rsa.pub
400 Parameter verification failed.
sshkeys: invalid format - invalid urlencoded string: /root/.ssh/id_rsa.pub
qm set 111 --sshkey /root/.ssh/id_rsa.pub <vmid> [OPTIONS]
The hook reading the file is in pve-common, so you need to update that.
Post by lyt_yudi
2. Can't setup static ip address for vm's by cloud-init
CentOS-6(CentOS-6-x86_64-GenericCloud.qcow2)
CentOS-7(CentOS-7-x86_64-GenericCloud.qcow2)
Debian-9(debian-9-openstack-amd64.qcow2)
only dhcp? configuration static mode is still used in DHCP!
Ubuntu-16.04(xenial-server-cloudimg-amd64-disk1.img)
Ubuntu-18.04(bionic-server-cloudimg-amd64.img)
Can’t use the static ip for some Linux OS, is it the reason why the cloud-init version is too low?
Possible. It also depends on how cloud-init is configured in these
images. They may not have the nocloud data sources enabled.
Try setting `citype: configdrive2`, that one should have existed longer.
Post by lyt_yudi
must be with cloudinit >= 17.1?
0.7.9 from debian stretch should also work, older ones _may_ work with
the configdrive2 type. I haven't tested older versions lately, but given
that configdrive2 was the first one we had back when Alexandre started
the original implementation it sure is worth a try.
lyt_yudi
2018-03-23 08:36:37 UTC
Permalink
Post by Wolfgang Bumiller
Post by lyt_yudi
# qm set 111 --sshkey ~/.ssh/id_rsa.pub
400 Parameter verification failed.
sshkeys: invalid format - invalid urlencoded string: /root/.ssh/id_rsa.pub
qm set 111 --sshkey /root/.ssh/id_rsa.pub <vmid> [OPTIONS]
The hook reading the file is in pve-common, so you need to update that.
Up-to: 5.0-30 fix it.
Post by Wolfgang Bumiller
Post by lyt_yudi
2. Can't setup static ip address for vm's by cloud-init
CentOS-6(CentOS-6-x86_64-GenericCloud.qcow2)
CentOS-7(CentOS-7-x86_64-GenericCloud.qcow2)
Debian-9(debian-9-openstack-amd64.qcow2)
only dhcp? configuration static mode is still used in DHCP!
Ubuntu-16.04(xenial-server-cloudimg-amd64-disk1.img)
Ubuntu-18.04(bionic-server-cloudimg-amd64.img)
Can’t use the static ip for some Linux OS, is it the reason why the cloud-init version is too low?
Possible. It also depends on how cloud-init is configured in these
images. They may not have the nocloud data sources enabled.
Try setting `citype: configdrive2`, that one should have existed longer.
will be try ...

but, use the dhcp mode , it’s had enable it, so maybe not for this reason!

[***@centos7-01 ~]# uname -a
Linux centos7-01.test.cn 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[***@centos7-01 ~]# cloud-init modules --mode final
Cloud-init v. 0.7.9 running 'modules:final' at Fri, 23 Mar 2018 08:27:47 +0000. Up 1939.19 seconds.
Cloud-init v. 0.7.9 finished at Fri, 23 Mar 2018 08:27:48 +0000. Datasource DataSourceNoCloud [seed=/dev/sr0][dsmode=net]. Up 1939.67 seconds
[***@centos7-01 ~]# mount /dev/sr0 /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
[***@centos7-01 ~]# cat /mnt/network-config
version: 1
config:
- type: physical
name: eth0
mac_address: 16:37:4B:30:0F:E6
subnets:
- type: dhcp4
- type: nameserver
address:
- 114.114.114.114
search:
- test.cn

Use the static ip mode, the conf content is:
[***@centos7-01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
GATEWAY=192.168.0.254
HWADDR=16:37:4B:30:0F:E6
IPADDR=192.168.0.58/24
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

[***@centos7-01 ~]# cat /mnt/network-config
version: 1
config:
- type: physical
name: eth0
mac_address: 16:37:4B:30:0F:E6
subnets:
- type: static
address: 192.168.0.58/24
gateway: 192.168.0.254
- type: nameserver
address:
- 114.114.114.114
search:
- test.cn
Post by Wolfgang Bumiller
Post by lyt_yudi
must be with cloudinit >= 17.1?
0.7.9 from debian stretch should also work, older ones _may_ work with
the configdrive2 type. I haven't tested older versions lately, but given
that configdrive2 was the first one we had back when Alexandre started
the original implementation it sure is worth a try.
another, will try to upgrade cloud-init >= 17.1

Thanks.
lyt_yudi
2018-03-23 09:00:11 UTC
Permalink
Hi,
Post by lyt_yudi
Post by Wolfgang Bumiller
Post by lyt_yudi
must be with cloudinit >= 17.1?
0.7.9 from debian stretch should also work, older ones _may_ work with
the configdrive2 type. I haven't tested older versions lately, but given
that configdrive2 was the first one we had back when Alexandre started
the original implementation it sure is worth a try.
another, will try to upgrade cloud-init >= 17.1
up-to cloud-init-18.1 it’s work!

# rpm -qa|grep cloud-init
cloud-init-18.1-1.el7.centos.noarch
[***@centos7-01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
GATEWAY=192.168.0.254
HWADDR=16:37:4B:30:0F:E6
IPADDR=192.168.0.58
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

But, the cipassword for centos user is still not set!
lyt_yudi
2018-03-23 09:51:17 UTC
Permalink
Post by lyt_yudi
But, the cipassword for centos user is still not set!
Sorry , my fault! The cipassword can set! It’s work with cloud-init-18.1!

Thanks
Wolfgang Bumiller
2018-03-23 10:07:01 UTC
Permalink
Post by lyt_yudi
Post by lyt_yudi
But, the cipassword for centos user is still not set!
Sorry , my fault! The cipassword can set! It’s work with cloud-init-18.1!
I just tried a fresh centos 7 installation. Curiously the password did
end up in /etc/shadow but didn't work.
Also, the default cloud-init package puts IPv4 addresses into
/etc/sysconfig/network-scripts as `IPADDR=<CIDR>`, and the journal then
warns that this is invalid - apparently it has to be split into ip
address and netmask - but that's the job of the cloud-init package, not
ours. So yeah, they just ship a broken package.
Wolfgang Bumiller
2018-03-23 10:39:55 UTC
Permalink
Post by Wolfgang Bumiller
Post by lyt_yudi
Post by lyt_yudi
But, the cipassword for centos user is still not set!
Sorry , my fault! The cipassword can set! It’s work with cloud-init-18.1!
I just tried a fresh centos 7 installation. Curiously the password did
end up in /etc/shadow but didn't work.
Right, that version of cloud-init doesn't support pre-hashed passwords,
so you need to manually add the plaintext password to the vm config.
Setting it over the API doesn't support plaintext passwords.

How did you install the newer cloud-init versions btw.?
lyt_yudi
2018-03-24 01:03:50 UTC
Permalink
Post by Wolfgang Bumiller
Post by Wolfgang Bumiller
Post by lyt_yudi
Post by lyt_yudi
But, the cipassword for centos user is still not set!
Sorry , my fault! The cipassword can set! It’s work with cloud-init-18.1!
I just tried a fresh centos 7 installation. Curiously the password did
end up in /etc/shadow but didn't work.
Right, that version of cloud-init doesn't support pre-hashed passwords,
so you need to manually add the plaintext password to the vm config.
Setting it over the API doesn't support plaintext passwords.
How did you install the newer cloud-init versions btw.?
Use this:
https://copr-be.cloud.fedoraproject.org/results/%40cloud-init/cloud-init-dev/epel-7-x86_64/00731396-cloud-init/cloud-init-18.1+28.gd29eeccd-1.el7.centos.noarch.rpm <https://copr-be.cloud.fedoraproject.org/results/@cloud-init/cloud-init-dev/epel-7-x86_64/00731396-cloud-init/cloud-init-18.1+28.gd29eeccd-1.el7.centos.noarch.rpm>
lyt_yudi
2018-03-24 09:35:15 UTC
Permalink
first, I know that this bug might be cloudbase's own.

but, here
Recognize uppercase vfat disk labels
New mkfs.vfat and fatlabel tools included in the dosfsutils package no
longer support creating vfat disks with lowercase labels. They silently
default to an all uppercase label eg CONFIG-2 instead of config-2. This
change makes cloud-init handle either upper or lower case.
https://github.com/openstack/cloudbase-init/commit/24365043e31a7cb0899d2222bbba654ef718da5b <https://github.com/openstack/cloudbase-init/commit/24365043e31a7cb0899d2222bbba654ef718da5b>

while test with cloudbase-init in windows 2008R2, It might have something to do with it

2018-03-24 16:43:50.453 1444 DEBUG cloudbaseinit.metadata.services.osconfigdrive.windows [-] Looking for Config Drive vfat in hdd get_config_drive_files c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\metadata\services\osconfigdrive\windows.py:197
2018-03-24 16:43:50.546 1444 DEBUG cloudbaseinit.utils.windows.vfat [-] Could not retrieve label for VFAT drive path '\\\\.\\PHYSICALDRIVE0' is_vfat_drive c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\vfat.py:46
2018-03-24 16:43:50.546 1444 DEBUG cloudbaseinit.utils.windows.vfat [-] mlabel failed with error b"init :: sector size (190) not a small power of two\r\nCannot initialize '::'\r\nC:\\Program Files\\Cloudbase Solutions\\Cloudbase-Init\\bin\\mlabel: Cannot initialize drive\r\n" is_vfat_drive c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\vfat.py:47
Thanks!
lyt_yudi
2018-03-26 05:52:28 UTC
Permalink
anyone succeed use cloudbase-init for windows?
Post by lyt_yudi
first, I know that this bug might be cloudbase's own.
but, here
Recognize uppercase vfat disk labels
New mkfs.vfat and fatlabel tools included in the dosfsutils package no
longer support creating vfat disks with lowercase labels. They silently
default to an all uppercase label eg CONFIG-2 instead of config-2. This
change makes cloud-init handle either upper or lower case.
https://github.com/openstack/cloudbase-init/commit/24365043e31a7cb0899d2222bbba654ef718da5b <https://github.com/openstack/cloudbase-init/commit/24365043e31a7cb0899d2222bbba654ef718da5b>
while test with cloudbase-init in windows 2008R2, It might have something to do with it
2018-03-24 16:43:50.453 1444 DEBUG cloudbaseinit.metadata.services.osconfigdrive.windows [-] Looking for Config Drive vfat in hdd get_config_drive_files c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\metadata\services\osconfigdrive\windows.py:197
2018-03-24 16:43:50.546 1444 DEBUG cloudbaseinit.utils.windows.vfat [-] Could not retrieve label for VFAT drive path '\\\\.\\PHYSICALDRIVE0' is_vfat_drive c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\vfat.py:46
2018-03-24 16:43:50.546 1444 DEBUG cloudbaseinit.utils.windows.vfat [-] mlabel failed with error b"init :: sector size (190) not a small power of two\r\nCannot initialize '::'\r\nC:\\Program Files\\Cloudbase Solutions\\Cloudbase-Init\\bin\\mlabel: Cannot initialize drive\r\n" is_vfat_drive c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\vfat.py:47
Thanks!
_______________________________________________
pve-user mailing list
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-user
lyt_yudi
2018-03-23 09:30:06 UTC
Permalink
Post by Wolfgang Bumiller
0.7.9 from debian stretch should also work
Debian 9, it’s work with cloud-init 0.7.9

It’s need to be modify interfaces conf:

***@debian9-01:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

thanks
Loading...