-2

I have run

cloud-localds seed.img user-data.yaml metadata.yaml

Where the two files are:

user-data.yaml

#cloud-config
users:
- name: chris
  password: chris
  groups: users, admin
  sudo: ALL=(ALL) NOPASSWD:ALL
  shell: /bin/bash
  lock_passwd: true
  ssh_authorized_keys:
  - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDRERY0ckhPpY/bvxKk2FhdgxDxyLEC+DHDYyuLu/HJQP/OY+fbZXXCQSV922k5ftSmDxn/Z142A8q0l1pgHjm9hMFkLo2af/iPTnVCxr/Swstgs0TIPpQx3lRBTDF9JEwc67M6WxCHlRVL4YrgbJ8DJHJWaipP8R3tzb1AuUtFEcSWiCayIZJlEC98UDh76CLvN6ax4xdKG8sKScG+5RSQc+Ln3vqIqlhWKO1TilXHOYo16NEauXSFqk5SXykgHZQdFldxJlklet1qa/sTvWF8geBjxJ2xxRSbU1cnW0mk5S5ObhWqE3gqmjnxfNd+8M5XZDXhuunPBVEja8Z+mFbFL1srhXj4M+cmW7s6BWStf6zS9ZGYAzbla89dGXq5VaNvz7uepV0v6cZpf4Sh6fXmkYhEEgU704TNE4Z6Bn8vJVNrHALvdSkgF6aHSry9BQ36dUPr/HG6kEHsyqTsXbG6Zbx5bEkN6oR1+uUu9pwNcj3EFDcFN3bTfkDs126M3q7ql/Zpq5fP98usQWC+uaklAHeYNrxXraMqsnbrFcFsF9gLNDTh/QS3vwBDJ32v8vnKsxGpgK+fjOLmn2j4wF2zCJMt56MDXn8bqqE0YhoB69N6F0s3rh9W1UrMPeyuBYAoz2F1bK3/8Rn3tCIp4JIUczx81vNeJaOkGY85DVzaLQ== chris@nixos

metadata.yaml

instance-id: gitlab-local-ubuntu
local-hostname: gitlab-local-ubuntu

The command I use to run the VM:

qemu-system-x86_64  \
  -machine accel=kvm,type=q35 \
  -cpu host \
  -m 8G \
  -nographic \
  -device virtio-net-pci,netdev=net0 \
  -netdev user,id=net0,hostfwd=tcp::2222-:22 \
  -drive if=virtio,format=qcow2,file=jammy-server-cloudimg-amd64-disk-kvm.img \
  -drive if=virtio,format=raw,file=seed.img

Running with the above does not seem to add the user, I've tried using the SSH key as well as logging in manually with "chris" as user and password. It does however seem to set the hostname according to metedata.yaml.

What might the issue be? In the console logs I see this:

cloud-init[342]: Cloud-init v. 23.1.2-0ubuntu0~22.04.1 running 'init' at Tue, 30 May 2023 13:20:42 +0000. Up 4.06 seconds.
cloud-init[342]: ci-info: ++++++++++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++++++++
cloud-init[342]: ci-info: +--------+------+----------------------------+---------------+--------+-------------------+
cloud-init[342]: ci-info: | Device |  Up  |          Address           |      Mask     | Scope  |     Hw-Address    |
cloud-init[342]: ci-info: +--------+------+----------------------------+---------------+--------+-------------------+
cloud-init[342]: ci-info: | enp0s2 | True |         10.0.2.15          | 255.255.255.0 | global | 52:54:00:12:34:56 |
cloud-init[342]: ci-info: | enp0s2 | True | fe80::5054:ff:fe12:3456/64 |       .       |  link  | 52:54:00:12:34:56 |
cloud-init[342]: ci-info: |   lo   | True |         127.0.0.1          |   255.0.0.0   |  host  |         .         |
cloud-init[342]: ci-info: |   lo   | True |          ::1/128           |       .       |  host  |         .         |
cloud-init[342]: ci-info: +--------+------+----------------------------+---------------+--------+-------------------+
cloud-init[342]: ci-info: ++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++
cloud-init[342]: ci-info: +-------+-------------+----------+-----------------+-----------+-------+
cloud-init[342]: ci-info: | Route | Destination | Gateway  |     Genmask     | Interface | Flags |
cloud-init[342]: ci-info: +-------+-------------+----------+-----------------+-----------+-------+
cloud-init[342]: ci-info: |   0   |   0.0.0.0   | 10.0.2.2 |     0.0.0.0     |   enp0s2  |   UG  |
cloud-init[342]: ci-info: |   1   |   10.0.2.0  | 0.0.0.0  |  255.255.255.0  |   enp0s2  |   U   |
cloud-init[342]: ci-info: |   2   |   10.0.2.2  | 0.0.0.0  | 255.255.255.255 |   enp0s2  |   UH  |
cloud-init[342]: ci-info: |   3   |   10.0.2.3  | 0.0.0.0  | 255.255.255.255 |   enp0s2  |   UH  |
cloud-init[342]: ci-info: +-------+-------------+----------+-----------------+-----------+-------+
cloud-init[342]: ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
cloud-init[342]: ci-info: +-------+-------------+---------+-----------+-------+
cloud-init[342]: ci-info: | Route | Destination | Gateway | Interface | Flags |
cloud-init[342]: ci-info: +-------+-------------+---------+-----------+-------+
cloud-init[342]: ci-info: |   1   |  fe80::/64  |    ::   |   enp0s2  |   U   |
cloud-init[342]: ci-info: |   3   |    local    |    ::   |   enp0s2  |   U   |
cloud-init[342]: ci-info: |   4   |  multicast  |    ::   |   enp0s2  |   U   |
cloud-init[342]: ci-info: +-------+-------------+---------+-----------+-------+
cloud-init[342]: 2023-05-30 13:20:42,377 - schema.py[WARNING]: Invalid cloud-config provided: Please run 'sudo cloud-init schema --system' to see the schema errors.

The last line is concerning, but running cloud-init devel schema --config-file user-data.yaml show Valid cloud-config: user-data.yaml.

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286

1 Answers1

1

Seems I downloaded the wrong image file. jammy-server-cloudimg-amd64.img works correctly while the one I had (jammy-server-cloudimg-amd64-disk-kvm.img) does not.

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286