XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Debian 12 cloud image SSH key

    Scheduled Pinned Locked Moved Management
    6 Posts 3 Posters 196 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      hypernoob
      last edited by

      Hi

      I have follows the instructions from https://xcp-ng.org/forum/topic/9943/after-days-of-research-and-tinkering-a-working-guide-for-debian-12-template-with-cloud-init-and-dhcp and i cloned a Debian 12 VM and attached the cloud image and created a template. When i add my ed25519 ssh keys from the template and boot the new VM i am refused to login via ssh.

      D 1 Reply Last reply Reply Quote 0
      • D Offline
        dinhngtu Vates 🪐 XCP-ng Team @hypernoob
        last edited by dinhngtu

        @hypernoob I suggest this procedure instead:

        • Get the Debian genericcloud QCOW2 image off of here: https://cdimage.debian.org/images/cloud/
        • Convert to VHD: qemu-img convert -O vpc debian-12-genericcloud-amd64.qcow2 debian-12-genericcloud-amd64.vhd
        • Import the converted VHD into XO
        • Attach to empty Debian VM, set to boot from hard drive and convert to template
        • Create new VMs from this template, adding your ssh keys and guest agent in cloud config if desired:
        #cloud-config
        hostname: {name}
        ssh_authorized_keys:
          - ssh-rsa ...
        apt:
          sources:
            xen-guest-agent:
              filename: xen-guest-agent.list
              source: deb [trusted=yes] https://gitlab.com/api/v4/projects/xen-project%252Fxen-guest-agent/packages/generic/deb-amd64/ release/
              append: false
        packages:
          - xen-guest-agent
        

        The same procedure will work with Ubuntu, Alma and other cloud images.

        1 Reply Last reply Reply Quote 1
        • H Offline
          hypernoob
          last edited by

          Hi dinhngtu

          I think i have found the problem. The end of the ssh key has 'bastion production' at the end of the key and i believe this is the wrong format for cloud init, all of the other parts of the configuration file work as xen orchestra indicated that the guest utils are installed. It a bit of a pain to regenerate the keys because i have a lot of devices i connect too.

          D 1 Reply Last reply Reply Quote 0
          • D Offline
            dinhngtu Vates 🪐 XCP-ng Team @hypernoob
            last edited by

            @hypernoob That's just the key's name, I use keys with long complicated names too and had no problem. What did ssh -vv tell you?

            1 Reply Last reply Reply Quote 0
            • H Offline
              hypernoob
              last edited by

              yeah that would be it. It was logging in as the local machines username, i changed it to debian and it work. My forum username says i all.

              Thanks @dinhngtu

              1 Reply Last reply Reply Quote 1
              • olivierlambertO Offline
                olivierlambert Vates 🪐 Co-Founder CEO
                last edited by

                haha we were all noobs when we started, it's fine 🙂

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post