canonical / canonical/cloud-init

**Title:** No indication that cloud-init has already run and user-data changes will be silently ignored

Open
#6,878 2 comments 0 reactions 0 assignees View on GitHub
bug incomplete
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
3d 8h
Merged PRs (30d)
22

Description

**Title:** No indication that cloud-init has already run and user-data changes will be silently ignored

**Description:**

When a user modifies the `user-data` file after cloud-init has already completed its first-run setup, all changes are silently ignored on subsequent boots. There is no warning, no log message visible to the user, and no file on the boot partition indicating that cloud-init has already run.

This leads to a very confusing user experience, especially for less experienced users who are trying to fix configuration issues (e.g. adding an SSH public key or changing a password hash) by modifying `user-data` after the first boot.

**Steps to reproduce:**

1. Prepare a cloud-init enabled OS image (e.g. Raspberry Pi OS Lite)
2. Configure `user-data` with a password hash and SSH authorized key
3. Boot the system for the first time — cloud-init runs successfully
4. Shut down, modify `user-data` (e.g. add or change `ssh_authorized_keys`)
5. Boot again
6. Changes are silently ignored — SSH key is not added, no error or warning is shown

**Expected behavior:**

cloud-init should provide a clear, user-visible indication that it has already completed its first-run setup and that changes to `user-data` will not take effect. This could be:
- A status file on the boot partition (e.g. `cloud-init-done.txt`) with a human-readable message
- A warning written to a log file accessible from the boot partition
- A boot message visible over serial console

**Actual behavior:**

cloud-init silently skips all `user-data` processing after the first run. No warning or status file is created in a location accessible to the user.

**Suggested improvement:**

After completing first-run setup, write a status file to the boot partition (which is accessible from any OS including macOS and Windows) with a message such as:

```
cloud-init has already completed its first-run setup.
Changes to user-data will not take effect unless you reflash the SD card.
```

This small change would prevent many frustrating debugging sessions for users who are unaware of cloud-init's one-time execution model.

**Environment:**
- Raspberry Pi Zero W v1.1
- Raspberry Pi OS Lite 32-bit (Bookworm)
- cloud-init version: as shipped with Raspberry Pi OS Bookworm
- Host OS: macOS (Intel)

**Reference:**
This issue was originally reported to the Raspberry Pi Imager project, which redirected it here: https://github.com/raspberrypi/rpi-imager/issues/1618

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the first boot and subsequent user-data change on the Raspberry Pi OS environment described, then trace where cloud-init records completion and how the boot partition is exposed. Compare the available indication options in the issue and verify the chosen behavior across a completed first boot and a later boot. Done means users can find a clear indication that user-data changes will be ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.