hetznercloud / cli

A command-line interface for Hetzner Cloud
MIT License
1.12k stars 80 forks source link

Cloud-init configuration not processed during server creation #511

Closed sternze closed 1 year ago

sternze commented 1 year ago

Hi!

This issue is a follow up issue to #510

The hcloud-cli processes now the file that holds the cloud-init-config, but it seems that the configuration is not processed and thus, the server is not configured correctly.

Content of the cloud_config.yml File (UTF-8 encoded):

#cloud-config
manage_etc_hosts: false

The server is created using the hcloud cli (detailed commandline in #510), but the configuration on the server does not show any indication of this cloud-config-change that should be processed.

[root@server-created-via-hcloud-cli ~]# cat /var/lib/cloud-init/instance
[root@server-created-via-hcloud-cli ~]#

If I create the server manually via the Web-GUI, and add above content of the cloud_config.yaml into the corresponding Cloud config-Section, the server is created and the changes are reflected on the server:

[root@server-created-via-web-gui ~]# cat /var/lib/cloud-init/instance
#cloud-config

# from 1 files
# part-001

---
manage_etc_hosts: false
...
[root@server-created-via-web-gui ~]#

Important: The Servers are created from the same snapshot with exactly the same configuration. The only difference is, that one server is created via hcloud-cli and the other one via the Web-GUI.

Thanks in advance, Daniel

apricote commented 1 year ago

Hey Daniel,

the file /var/lib/cloud-init/instance does not exist for me, for both servers (CLI & console). All cloud-init files should show up when you run cloud-init schema --system:

root@user-data2:~# cloud-init schema --system
Found cloud-config data types: user-data, vendor-data

1. user-data at /var/lib/cloud/instances/34301494/cloud-config.txt:
  Valid cloud-config: user-data

2. vendor-data at /var/lib/cloud/instances/34301494/vendor-cloud-config.txt:
  Valid cloud-config: vendor-data
sternze commented 1 year ago

Hi!

Sorry about being unclear in the issue. It appears that this file is only present in the CentOS installation.. :-/

As a base OS I'm using CentOS 7, where I run into the next issue.. The Command cloud-init schema --system does not exist:

[root@server-created-via-hcloud-cli ~]# cloud-init schema --system
usage: /bin/cloud-init [-h] [--version] [--file FILES] [--debug] [--force]

                       {init,modules,single,query,dhclient-hook,features,analyze,devel,collect-logs,clean,status}
                       ...
/bin/cloud-init: error: argument subcommand: invalid choice: 'schema' (choose from 'init', 'modules', 'single', 'query', 'dhclient-hook', 'features', 'analyze', 'devel', 'collect-logs', 'clean', 'status')

Anyway, I can query the data by using cloud-init query -a.

What I suspect: The data of the submitted file via hcloud-cli is prepended with a secial character and thus not being recognized by the cloud-init platform. You can find this below in the debug outputs in the paramter userdata.

Here is the relevant excerpt:

Server created via hcloud-CLI:

[root@server-created-via-hcloud-cli ~]# cloud-init query -a
...
 "userdata": "\ufeff#cloud-config\r\nmanage_etc_hosts: false\r\n",
...

Server created via Web-GUI:

[root@server-created-via-web-gui ~]# cloud-init query -a
...
 "userdata": "#cloud-config\nmanage_etc_hosts: false",
...

Thanks, Daniel


Debug Output below (Trimmed obviously irrellevant parts):

The data from the Server created via hcloud-cli:

[root@server-created-via-hcloud-cli ~]# cloud-init query -a
{
 "_beta_keys": [
  "subplatform"
 ],
 "availability_zone": null,
 "base64_encoded_keys": [],
 "cloud_name": "hetzner",
 "ds": {
  "_doc": "EXPERIMENTAL: The structure and format of content scoped under the 'ds' key may change in subsequent releases of cloud-init.",
  "meta_data": {
   "instance_id": 34304487,
   "local_hostname": "server-created-via-hcloud-cli",
   "network_config": {
    "config": [],
    "version": 1
   },
   "public_keys": []
  }
 },
 "instance_id": "34304487",
 "local_hostname": "server-created-via-hcloud-cli",
 "platform": "hetzner",
 "public_ssh_keys": [],
 "region": null,
 "sensitive_keys": [],
 "subplatform": "metadata (http://169.254.169.254/hetzner/v1/metadata)",
 "userdata": "\ufeff#cloud-config\r\nmanage_etc_hosts: false\r\n",
 "v1": {
  "_beta_keys": [
   "subplatform"
  ],
  "availability_zone": null,
  "cloud_name": "hetzner",
  "instance_id": "34304487",
  "local_hostname": "server-created-via-hcloud-cli",
  "platform": "hetzner",
  "public_ssh_keys": [],
  "region": null,
  "subplatform": "metadata (http://169.254.169.254/hetzner/v1/metadata)"
 },
 "vendordata": "Content-Type: multipart/mixed; boundary=\"===============3071183932638429129==\"\nMIME-Version: 1.0\n\n--===============3071183932638429129==\nContent-Type: text/cloud-config; charset=\"us-ascii\"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment; filename=\"cloud-config\"\n\n#cloud-config\nfqdn: server-created-via-hcloud-cli\nmanage_etc_hosts: true\nrandom_seed:\n  data: !!binary |\n    VHBxS1ZWUHY4OHFLdlRIZTd2RkorNSt2dHh2MUZnZU9JeGxpMThiSTNJN041M3FnUXpwVnlBVmJJ\n    aGM1elg5a2xHcEpyTjRuL2VqTmZwNmdWbjNsYmxjSmxXOWtFKytIR3U2VE1qTW1UVnNjNGJzeHJB\n    eFJ4UjRGa1BnRThSTVlDY0RxOHBacmNrV0FBN1NrWUhTazRoNnl6aERlRWxvY1hvbGZzWkxoaEtY\n    Vk9RMEVLbEtubU9Cd29keUo4Y0FFa09LMFk0TXFMczV6LzlsZ1cvc241K2Exc3ZFeW1MVDUwSEl0\n    dzJNWWdpRy9tTGJJT255eWVTODhwTFd4cFloNElScFdBeHFNM2dUUkZNVXpodC9BQkhlWndvelMx\n    bDR3cnZiUElrTUsvY1I5LzhUZTEwMG95eHRCYkZ1bENwWFYxZHVBb1Q5NHJxK1NFRnpOZEd5QlpE\n    cTJzbnpoemFiYjdSWUQ0NWk2UVh3VzRncEk4Z0V5UGtKNFRKTkE1ZmZhcjQ4MWdWemhQODhWQnE1\n    Ynk3eTRqQW4vY1dNU3RDQ3o4YzlNSDBDRlNnRDloTStnSjE4Z1Z1TDFvcCswYWpzR3YyT0FmS1Bq\n    N0pKZ3hSZmQrbHFPaWNaMWF3dWN4S0k2ZVlLWG9CV2pzTHdDSE9rRXdhRTJQSFEvYXNVMjRrZXFZ\n    SHgyVzkwTlA5dDUrcDF5WDc3M1NLS01CZGJFSUhxWDl3VWZPVGh4ejRGbnlKOUZHVStzdExYbnFo\n    dmxYQnhTbFVGYjVmMmdZU2pPaGRQS3NsSmdFZ3ZMU2xRYWxsWW9yUk1WVEpUVVVBQU1LNnhZdHhI\n    d1A1RG9WU3J6cDBDaHR4M20rZ0Fsek9TZFZaWVpYaGw1WDRQTDN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2d3Yrc3R5Uy9JZTBENkdVS0xkWlluM1ZiZldjQWpzaU1zVW1Pc0pVeGpNZE9r\n    SG0zQzlBWURKZlpldnN6TmdTSUNjQUJ5VzhHSURnZC9MYThFd3FocGhUN1FsSHU1VlFCRENiMllq\n    TGI2cWN2VnB0cVlKazhvZ2FWOUplbGhBUFJqajd5bGUrZnR0NEtta3N0T0pzL2tBNVpUekpnb2FD\n    U1hrWFV1dVFMalM5d0xmV0dEcmRIbWZuL2NzSS96SlFWVlRqenpRTzZ6Q0pPMnZkVTIxWGk4cnNr\n    dmFuYlgrdm9samlIc0dUdVZIMWNQZzducWJvcTRvMWFEUVdkanJYNU5pNDByQjZSR2x3c3l0ZXdS\n    MlAzUlNZNkpWWjBPMDU5K3JlTXpwZkZ3bDBVVGpUWWRYR2E4aUNwWiszNWV5WEFhUnZoN0ZDbUFl\n    Y2w1MStLWS9Ia0R6S0QwWW1FWEJORVIydmhQTXd2V2ZlMTBpeDlSRjZibVFyamZxc0xoOHYvK2FH\n    dmhvTG5pSUVLY0p4WHlnMHl5OTV2YjRZbFFzRjVKUHk0KzV6aWlYdHJWbWthNzZpMjBLSmpyN20z\n    QjF2MHF0dk9SRnE5VDBIL0lPMGt1MzJ2dFZxaHZ2UDhDUjFSUVhZUzlmT1FzbXZGMHR6ZEhnYXdW\n    YTdUU0R3OVlnOGcvZWpabU4xVHRqYUtwTXpyUmtWYWdLa0pTWVV0YUZyekxkTGgvYUsvZz0=\n  encoding: base64\n  file: /dev/urandom\nruncmd:\n- udevadm trigger -c add -s block -p ID_VENDOR=HC --verbose -p ID_MODEL=Volume\nsystem_info:\n  default_user:\n    lock_passwd: true\n    name: root\n    shell: /bin/bash\n\n--===============3071183932638429129==\nContent-Type: text/cloud-boothook; charset=\"us-ascii\"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment; filename=\"hc-boot-script\"\n\n#!/bin/bash\n\n--===============3071183932638429129==--\n"
}

The data from the Server created using the Web-Gui:

[root@server-created-via-web-gui ~]# cloud-init query -a
{
 "_beta_keys": [
  "subplatform"
 ],
 "availability_zone": null,
 "base64_encoded_keys": [],
 "cloud_name": "hetzner",
 "ds": {
  "_doc": "EXPERIMENTAL: The structure and format of content scoped under the 'ds' key may change in subsequent releases of cloud-init.",
  "meta_data": {
   "instance_id": 34305672,
   "local_hostname": "snapshot-112366511-centos-32gb-nbg1-1",
   "network_config": {
    "config": [
     {
      "mac_address": "96:00:02:53:35:a8",
      "name": "eth0",
      "subnets": [
       {
        "ipv4": true,
        "type": "dhcp"
       },
       {
        "address": "2a01:4f8:1c1e:b8c2::1/64",
        "dns_nameservers": [
         "2a01:4ff:ff00::add:1",
         "2a01:4ff:ff00::add:2"
        ],
        "gateway": "fe80::1",
        "ipv6": true,
        "type": "static"
       }
      ],
      "type": "physical"
     }
    ],
    "version": 1
   },
   "public_keys": [
    "ssh-rsa <PUB-Key>"
   ]
  }
 },
 "instance_id": "34305672",
 "local_hostname": "snapshot-112366511-centos-32gb-nbg1-1",
 "platform": "hetzner",
 "public_ssh_keys": [
  "ssh-rsa <PUB-Key>"
 ],
 "region": null,
 "sensitive_keys": [],
 "subplatform": "metadata (http://169.254.169.254/hetzner/v1/metadata)",
 "userdata": "#cloud-config\nmanage_etc_hosts: false",
 "v1": {
  "_beta_keys": [
   "subplatform"
  ],
  "availability_zone": null,
  "cloud_name": "hetzner",
  "instance_id": "34305672",
  "local_hostname": "snapshot-112366511-centos-32gb-nbg1-1",
  "platform": "hetzner",
  "public_ssh_keys": [
   "ssh-rsa <PUB-Key>"
  ],
  "region": null,
  "subplatform": "metadata (http://169.254.169.254/hetzner/v1/metadata)"
 },
 "vendordata": "Content-Type: multipart/mixed; boundary=\"===============7556550904424798562==\"\nMIME-Version: 1.0\n\n--===============7556550904424798562==\nContent-Type: text/cloud-config; charset=\"us-ascii\"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment; filename=\"cloud-config\"\n\n#cloud-config\nfq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y1UzRVBKT3d2MDZBNGdzVXE4\n    UXRRWmZqZzBRM1puNHJWSEZkV214RXdnSzkvZnlBN2xDK0xObHJoU3dJcHRnSnBUV2VVcXQ3Y2oz\n    alJqMEJtVUtpckRKZXNCYnk3N3o2WkliMUNsUE1RdlVUMDhERk9xYTdSZjhramJHVnRZWTVXM29D\n    enpRaXJ3M1ZPQ1lKZEpNRlJrb0ZHdjBpNFVmb3NDM3NQVW5LWWRUUlR1bWVkd095cVRacmh5cE9x\n    V2JFVjJlSUttNGhWOGxVMzgyYjVEcTJKcFQvRCtDekRrVm44cXcwQSt1SFZBYWpZNTZHWHpRZHNO\n    dmtBRnZyenV5dWNYbmowcmNOalpIckRPcFA1dTJISnU4dDlLb08vWk0yVm5PL28vNWtEWmtrdGVV\n    Y045QUFuUCtuakd6K0V0UzJKRzk3azU4dGZhQmlrVjd4eXpDYWNHUmJWeUUrMnlXNGtqbExrMHZF\n    cGltdnJqUGJ1V0Y5U2FKRDFjajJxWUhqNVM2WGtVcldYenRQVFBGdHFqRDRsT3NLc1dPTnlhL0x0\n    ZkdDZmRjSE5jeThueHVpYXRMUjgwbWNBT3ZzQUIwVDlNWWhHV2hUY3kvMzZ0M29PNHlhQUdJeUky\n    Y3c5RUNocy9nVU5SaksvUm1GbmxEMVZzaFdJbHFaTk91S2ZrZWdBM0orbmtGZnRhUGE2UT0=\n  encoding: base64\n  file: /dev/urandom\nruncmd:\n- udevadm trigger -c add -s block -p ID_VENDOR=HC --verbose -p ID_MODEL=Volume\nsystem_info:\n  default_user:\n    lock_passwd: true\n    name: root\n    shell: /bin/bash\n\n--===============7556550904424798562==\nContent-Type: text/cloud-boothook; charset=\"us-ascii\"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment; filename=\"hc-boot-script\"\n\n#!/bin/bash\n\n--===============7556550904424798562==--\n"
}
sternze commented 1 year ago

After further research, this appears to be the BOM character of UTF-8 Windows files..

I'll try to store the file without the BOM encoding and inform you about the outcome. 👍

sternze commented 1 year ago

This was indeed the issue!

The BOM encoding that was added by Powershell was the reason, this setting was not recognized inside cloud-init.

Thanks for pointing me in the right direction!

Idea: Maybe you could integrate a short code snippet inside the hcloud-cli to remove BOM-Bytes from any files to enhance the user experience. I will not create an issue, as it is your decision whether you want to support this!

Thanks, Daniel