[SOLVED] Change password cloud-init does not work

BoringASK

Member
Aug 9, 2018
13
0
6
29
Paris, France
Hello

I just created a Debian 9 cloud-init template, everything works fine: network, disk expansion, etc.

However when I ask to change the root password or another user password it does not work: the password is changed but the password set or the template password does not work.

Is there anything specific I can do to make it work ?

Thanks,
B.A
 
did you reboot afterwards ? cloud-init only sets the values on boot
 
Hello Dominik,

Yes I have restarted : all settings apply except the password change. But I didn't get the serial screen. Is this necessary for the password change ?
 
probably an issue with the cloud-init version inside of debian, try to use a newer one
 
Hi,

May I ask how you installed a newer version?
I currently have the same problem


Thanks!

Hey,

https://stackoverflow.com/questions/44444279/cloud-init-how-to-install-it-from-the-source-code was the solution. Expect that I used the .tar.gz from https://launchpad.net/cloud-init/trunk/ and not the source-code.

Preparation: Install python and python-pip
Debian / Ubuntu: apt install python3 python3-pip

Commands (as root or with sudo):

wget https://launchpad.net/cloud-init/trunk/18.3/+download/cloud-init-18.3.tar.gz
tar -xvzf cloud-init-18.3.tar.gz
cd cloud-init-18.3
pip3 install -r requirements.txt
python3 setup.py build
python3 setup.py install --init-system systemd
cloud-init init --local
cloud-init status
ln -s /usr/local/bin/cloud-init /usr/bin/cloud-init
systemctl enable cloud-init-local.service
systemctl start cloud-init-local.service
systemctl enable cloud-init.service
systemctl start cloud-init.service
systemctl enable cloud-config.service
systemctl start cloud-config.service
systemctl enable cloud-final.service
systemctl start cloud-final.service

Kind regards,

MiniMiner
 
Hello

I just created a Debian 9 cloud-init template, everything works fine: network, disk expansion, etc.

However when I ask to change the root password or another user password it does not work: the password is changed but the password set or the template password does not work.

Is there anything specific I can do to make it work ?

Thanks,
B.A
Hi! this thread is a bit dated .. but I'm very curious about how you did to make repartitioning work?
I created my two Debian8 and Debian9 VMs, on both cloud-init works perfectly (password, network, user, etc.) except repartionning.

I tested with different types of partitioning, but I still get the same result: failure
 
Hi! this thread is a bit dated .. but I'm very curious about how you did to make repartitioning work?
I created my two Debian8 and Debian9 VMs, on both cloud-init works perfectly (password, network, user, etc.) except repartionning.

I tested with different types of partitioning, but I still get the same result: failure

Hello,

maybe I can help too. Which cloud-init version do you use? Can you provide your cloud-init config?

Best regards,

MiniMiner
 
Hello,

maybe I can help too. Which cloud-init version do you use? Can you provide your cloud-init config?

Best regards,

MiniMiner
Hello! Thank you for your interest!

I tried with version 18.4, 18.3 and it's still the same problem, resizefs does not expand my partition. I also tried cloud-init 19.1 (last release released 8 days ago) and it works on practically nothing, only the username and the password are set up correctly. For the 18.5 version, everything works except the network and disk expansion.

I also tested to create my debian virtual machine with only a primary ext4 partition, but still nothing, the partition does not expand even if it is only on the disk.


I use the default cloud-init config (I only change the name 'Ubuntu' by 'debian' and remove the part 'configure source.list' in the final stage.
 
This is my cloud.cfg file
In this configuration, my VM is configured with cloud-init 18.4 (the one that was the most compatible)
Code:
root@debian:/# cloud-init --version
/usr/local/bin/cloud-init 18.4
root@debian:/#
Code:
users:
   - default
disable_root: false

preserve_hostname: false
preserve_sources_list: true

cloud_init_modules:
 - migrator
 - seed_random
 - bootcmd
 - write-files
 - growpart
 - resizefs
 - disk_setup
 - mounts
 - set_hostname
 - update_hostname
 - update_etc_hosts
 - ca-certs
 - rsyslog
 - users-groups
 - ssh

cloud_config_modules:
 - emit_upstart
 - ssh-import-id
 - locale
 - set-passwords
 - grub-dpkg
 - apt-pipelining
 - apt-configure
 - ntp
 - timezone
 - runcmd

cloud_final_modules:
 - chef
 - mcollective
 - salt-minion
 - rightscale_userdata
 - scripts-vendor
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - ssh-authkey-fingerprints
 - keys-to-console
 - phone-home
 - final-message
 - power-state-change

system_info:
   distro: debian
   default_user:
     name: debian
     lock_passwd: True
     gecos: debian
     groups: [adm, audio, cdrom, dialout, dip, floppy, lxd, netdev, plugdev, sudo, video]
     sudo: ["ALL=(ALL) NOPASSWD:ALL"]
     shell: /bin/bash
   ntp_client: auto
   paths:
      cloud_dir: /var/lib/cloud/
      templates_dir: /etc/cloud/templates/
      upstart_dir: /etc/init/
   ssh_svcname: ssh

here is my default disk configuration :


Code:
root@debian:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            992M     0  992M   0% /dev
tmpfs           201M  3.0M  198M   2% /run
/dev/vda1       9.8G  1.2G  8.2G  13% /
tmpfs          1003M     0 1003M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs          1003M     0 1003M   0% /sys/fs/cgroup
tmpfs           201M     0  201M   0% /run/user/0
root@debian:/# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  3.4G  0 rom
vda    254:0    0   10G  0 disk
└─vda1 254:1    0   10G  0 part /

My Debian 9 version :


Code:
root@debian:/# screenfetch
         _,met$$$$$gg.           root@debian
      ,g$$$$$$$$$$$$$$$P.        OS: Debian
    ,g$$P""       """Y$$.".      Kernel: x86_64 Linux 4.9.0-9-amd64
   ,$$P'              `$$$.      Uptime: 1h 34m
  ',$$P       ,ggs.     `$$b:    Packages: 355
  `d$$'     ,$P"'   .    $$$     Shell: bash 4.4.12
   $$P      d$'     ,    $$P     CPU: Intel Xeon CPU X5570 @ 2.926GHz
   $$:      $$.   -    ,d$$'     RAM: 80MiB / 2004MiB
   $$\;      Y$b._   _,d$P'     
   Y$$.    `.`"Y$$$$P"'         
   `$$b      "-.__             
    `Y$$                       
     `Y$$.                     
       `$$b.                   
         `Y$$b.                 
            `"Y$b._             
                `""""           
                                
root@debian:/#
 
Last edited:
This is my cloud.cfg file
In this configuration, my VM is configured with cloud-init 18.4 (the one that was the most compatible)
Code:
root@debian:/# cloud-init --version
/usr/local/bin/cloud-init 18.4
root@debian:/#
Code:
users:
   - default
disable_root: false

preserve_hostname: false
preserve_sources_list: true

cloud_init_modules:
 - migrator
 - seed_random
 - bootcmd
 - write-files
 - growpart
 - resizefs
 - disk_setup
 - mounts
 - set_hostname
 - update_hostname
 - update_etc_hosts
 - ca-certs
 - rsyslog
 - users-groups
 - ssh

cloud_config_modules:
 - emit_upstart
 - ssh-import-id
 - locale
 - set-passwords
 - grub-dpkg
 - apt-pipelining
 - apt-configure
 - ntp
 - timezone
 - runcmd

cloud_final_modules:
 - chef
 - mcollective
 - salt-minion
 - rightscale_userdata
 - scripts-vendor
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - ssh-authkey-fingerprints
 - keys-to-console
 - phone-home
 - final-message
 - power-state-change

system_info:
   distro: debian
   default_user:
     name: debian
     lock_passwd: True
     gecos: debian
     groups: [adm, audio, cdrom, dialout, dip, floppy, lxd, netdev, plugdev, sudo, video]
     sudo: ["ALL=(ALL) NOPASSWD:ALL"]
     shell: /bin/bash
   ntp_client: auto
   paths:
      cloud_dir: /var/lib/cloud/
      templates_dir: /etc/cloud/templates/
      upstart_dir: /etc/init/
   ssh_svcname: ssh

here is my default disk configuration :


Code:
root@debian:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            992M     0  992M   0% /dev
tmpfs           201M  3.0M  198M   2% /run
/dev/vda1       9.8G  1.2G  8.2G  13% /
tmpfs          1003M     0 1003M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs          1003M     0 1003M   0% /sys/fs/cgroup
tmpfs           201M     0  201M   0% /run/user/0
root@debian:/# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  3.4G  0 rom
vda    254:0    0   10G  0 disk
└─vda1 254:1    0   10G  0 part /

My Debian 9 version :


Code:
root@debian:/# screenfetch
         _,met$$$$$gg.           root@debian
      ,g$$$$$$$$$$$$$$$P.        OS: Debian
    ,g$$P""       """Y$$.".      Kernel: x86_64 Linux 4.9.0-9-amd64
   ,$$P'              `$$$.      Uptime: 1h 34m
  ',$$P       ,ggs.     `$$b:    Packages: 355
  `d$$'     ,$P"'   .    $$$     Shell: bash 4.4.12
   $$P      d$'     ,    $$P     CPU: Intel Xeon CPU X5570 @ 2.926GHz
   $$:      $$.   -    ,d$$'     RAM: 80MiB / 2004MiB
   $$\;      Y$b._   _,d$P'   
   Y$$.    `.`"Y$$$$P"'       
   `$$b      "-.__           
    `Y$$                     
     `Y$$.                   
       `$$b.                 
         `Y$$b.               
            `"Y$b._           
                `""""         
                              
root@debian:/#

Hello,

sorry for the late answer. Did you figure out the problem?

I think you're missing the following part in your /etc/cloud/cloud.cfg:

growpart:
mode: auto
devices: ['/']
ignore_growroot_disabled: false

Just append it at the bottom.

Best regards
 
Hello,

sorry for the late answer. Did you figure out the problem?

I think you're missing the following part in your /etc/cloud/cloud.cfg:

growpart:
mode: auto
devices: ['/']
ignore_growroot_disabled: false

Just append it at the bottom.

Best regards

Hi. it doesn't work.
Bumping into the same issue right now trying to make the template for deb9 with cloud init 20.1.

So.. some idea would be using a custom script at start-up and add it via bootcmd into the cloud.cfg, which might work.
 
Just writing a quick post to the resize part issue, maybe, it would come useful someday to someone:

So,
1st - install the cloud-guest-utils package in deb9 to have the growpart binary
2nd -in the cloud.cfg file add the following:

bootcmd:
- [ /usr/bin/growpart, "/dev/vda 1" ]

Just tested it and it works with cloud-init version 20.1
 
  • Like
Reactions: Som1031

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!