[SOLVED] Change password cloud-init does not work

Discussion in 'Proxmox VE: Installation and configuration' started by BoringASK, Aug 9, 2018.

  1. BoringASK

    BoringASK New Member

    Joined:
    Aug 9, 2018
    Messages:
    12
    Likes Received:
    0
    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
     
  2. dcsapak

    dcsapak Proxmox Staff Member
    Staff Member

    Joined:
    Feb 1, 2016
    Messages:
    3,519
    Likes Received:
    318
    did you reboot afterwards ? cloud-init only sets the values on boot
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. BoringASK

    BoringASK New Member

    Joined:
    Aug 9, 2018
    Messages:
    12
    Likes Received:
    0
    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 ?
     
  4. dcsapak

    dcsapak Proxmox Staff Member
    Staff Member

    Joined:
    Feb 1, 2016
    Messages:
    3,519
    Likes Received:
    318
    probably an issue with the cloud-init version inside of debian, try to use a newer one
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. BoringASK

    BoringASK New Member

    Joined:
    Aug 9, 2018
    Messages:
    12
    Likes Received:
    0
    Dominik,

    It's work with new version of cloud-init. Thanks for your help !
     
  6. Vengance

    Vengance Member

    Joined:
    May 21, 2016
    Messages:
    75
    Likes Received:
    3
    Hi,

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


    Thanks!
     
  7. MiniMiner

    MiniMiner New Member

    Joined:
    Jan 20, 2018
    Messages:
    18
    Likes Received:
    0
    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
     
  8. atom70

    atom70 New Member

    Joined:
    Nov 7, 2018
    Messages:
    7
    Likes Received:
    2
    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
     
  9. MiniMiner

    MiniMiner New Member

    Joined:
    Jan 20, 2018
    Messages:
    18
    Likes Received:
    0
    Hello,

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

    Best regards,

    MiniMiner
     
  10. atom70

    atom70 New Member

    Joined:
    Nov 7, 2018
    Messages:
    7
    Likes Received:
    2
    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.
     
  11. atom70

    atom70 New Member

    Joined:
    Nov 7, 2018
    Messages:
    7
    Likes Received:
    2
    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:/#
    
     
    #11 atom70, May 18, 2019
    Last edited: May 18, 2019
  12. MiniMiner

    MiniMiner New Member

    Joined:
    Jan 20, 2018
    Messages:
    18
    Likes Received:
    0
    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
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice