canonical / canonical/cloud-init

cc-set-hostname (hostname and fqdn) are not working on google cloud VMs Ubuntu 24.04

Open
#6,058 4 comments 0 reactions 0 assignees View on GitHub
incomplete
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

# Bug report
The steps here do not seem to impact the hostname on google cloud VMs:
https://cloudinit.readthedocs.io/en/latest/reference/modules.html#mod-cc-set-hostname

## Steps to reproduce the problem
This cloud-init.yaml file, when used to launch a virtual machine on Google Cloud, does not make any changes to the hostname.

```yaml
## template: jinja
#cloud-init

{% set HOSTNAME = 'www' %}
{% set FQDN = 'www.example.com' %}

hostname: {{ HOSTNAME }}
fqdn: {{ FQDN }}
prefer_fqdn_over_hostname: true
```

This is tested with the `hostname` command, once the machine boots up.

## Environment details
- Cloud-init version: cloud-init 24.4-0ubuntu1~24.04.2
- Operating System Distribution: Ubuntu 24.04.2
- Cloud provider, platform or installer type: Google Cloud

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.