Skip to content

Fix locale generation on debian base distros#6472

Open
paulober wants to merge 3 commits intocanonical:mainfrom
paulober:fix-debian-locales
Open

Fix locale generation on debian base distros#6472
paulober wants to merge 3 commits intocanonical:mainfrom
paulober:fix-debian-locales

Conversation

@paulober
Copy link
Copy Markdown
Contributor

Proposed Commit Message

fix(debian): Fix locale generation

The current debian apply_locale implementation
depends on a modified locale-gen script that
only exists on ubuntu systems. This patch
fixes the generation of new locales
and should also work on ubuntu
with out the reliance on the custom
locale-gen patch.

Fixes GH-6471

Additional Context

#6471

Test Steps

Try setting a locale on debian 13 with the current cloud-init release. It will run without problems but not generate the selected locale because locale-gen doesn't support locale-gen <locale> but want you select the locales in /etc/locale.gen prior to the execution of this script.

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

@tdewey-rpi

@paulober paulober marked this pull request as draft September 12, 2025 16:19
@paulober paulober marked this pull request as ready for review September 19, 2025 07:21
@blackboxsw blackboxsw self-assigned this Sep 22, 2025
@paulober paulober force-pushed the fix-debian-locales branch 3 times, most recently from f74135b to bfc8063 Compare September 29, 2025 13:33
@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Oct 14, 2025
@paulober
Copy link
Copy Markdown
Contributor Author

paulober commented Oct 15, 2025

@blackboxsw

@blackboxsw blackboxsw removed the stale-pr Pull request is stale; will be auto-closed soon label Oct 15, 2025
@canonical canonical deleted a comment from github-actions bot Oct 16, 2025
@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Oct 31, 2025
@canonical canonical deleted a comment from github-actions bot Nov 2, 2025
@github-actions github-actions bot removed the stale-pr Pull request is stale; will be auto-closed soon label Nov 3, 2025
@github-actions
Copy link
Copy Markdown

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Nov 18, 2025
@paulober
Copy link
Copy Markdown
Contributor Author

@blackboxsw This is required for locale generation on Debian and related distros (except for ubuntu) to work.

@github-actions github-actions bot removed the stale-pr Pull request is stale; will be auto-closed soon label Nov 26, 2025
@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Dec 10, 2025
@canonical canonical deleted a comment from github-actions bot Dec 12, 2025
@blackboxsw blackboxsw removed the stale-pr Pull request is stale; will be auto-closed soon label Dec 12, 2025
@github-actions
Copy link
Copy Markdown

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Dec 27, 2025
@paulober
Copy link
Copy Markdown
Contributor Author

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@blackboxsw

@github-actions github-actions bot removed the stale-pr Pull request is stale; will be auto-closed soon label Jan 1, 2026
@github-actions
Copy link
Copy Markdown

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Jan 16, 2026
@paulober
Copy link
Copy Markdown
Contributor Author

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@blackboxsw Please merge this now. Locale gen in cloud-init is currently broken for every Debian based distribution other than Ubuntu.

@github-actions github-actions bot removed the stale-pr Pull request is stale; will be auto-closed soon label Jan 17, 2026
@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Jan 31, 2026
@blackboxsw
Copy link
Copy Markdown
Collaborator

Thank you @paulober I'll put this on my list this upcoming week. Where I have some concerns is this appears to change behavior by disallowing the addition supplemental locales and disabling other locales on the system. Once I wrap my head around how I'd like us to approach this with clear direction, I'll add a solid review on this.

@blackboxsw blackboxsw removed the stale-pr Pull request is stale; will be auto-closed soon label Jan 31, 2026
@canonical canonical deleted a comment from github-actions bot Jan 31, 2026
@blackboxsw blackboxsw added this to the cloud-init 26.1 milestone Jan 31, 2026
@blackboxsw
Copy link
Copy Markdown
Collaborator

Adding this to our milestone for the upcoming 26.1 release.

@github-actions
Copy link
Copy Markdown

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Feb 15, 2026
@paulober
Copy link
Copy Markdown
Contributor Author

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@blackboxsw

@github-actions github-actions bot removed the stale-pr Pull request is stale; will be auto-closed soon label Feb 18, 2026
Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @paulober for your extended patience here. I have added some significant requests for testing, a couple of questions about certain locale format support and a suggestion for retaining already generated locales.

We definitely want to retain original behavior where new locales can be added, and we don't want to disable or comment existing locales.

Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimally, we'd need to retain original behavior by only adding new locales, not commenting out pre-existing locales. Additionally, please confirm some of the regex search/compile operations match all expected locale formats/prefixes in unittests.

@blackboxsw
Copy link
Copy Markdown
Collaborator

blackboxsw commented Feb 23, 2026

There is an additional integration test that can be run to validate that we don't degrade expected behavior if you have access to a machine with LXD installed:

CLOUD_INIT_KEEP_INSTANCE=1 CLOUD_INIT_CLOUD_INIT_SOURCE=cloudinit.deb  CLOUD_INIT_CLOUD_INIT_OS_IMAGE=noble tox -e integration-tests -- tests/integration_tests/modules/test_combined.py::TestCombined::test_configured_locale

This test currently fails due to the fact that this PR comments out previously configured locales.

@blackboxsw
Copy link
Copy Markdown
Collaborator

Migrating to 26.2 due to my delayed review. We'll pull this in when we can resolve outstanding questions regarding retained behavior.

Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
@paulober paulober force-pushed the fix-debian-locales branch from bfc8063 to d56de70 Compare March 2, 2026 19:27
Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
@paulober paulober requested a review from blackboxsw March 2, 2026 21:05
Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you again for the followup @paulober. Things are looking good. One more volley regarding _normalize_locale behavior and a couple of nits. Otherwise I think this is shaping up nicely.

Signed-off-by: paulober <paul.oberosler@raspberrypi.com>
@paulober paulober requested a review from blackboxsw March 10, 2026 22:25
distro.apply_locale(locale, out_fn=LOCALE_PATH)
assert [
["locale-gen", locale],
["locale-gen"],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @paulober. Minor fixes needed throughout this test file to assert --keep-existing is also provided to the locale-gen command.

Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulober changes look good here. Thanks for the updates. All that's left is some unittest fixes in test_debian for --keep-existing

@blackboxsw
Copy link
Copy Markdown
Collaborator

When we are sure tox -e py3 passes all tests, this looks good to me.

@github-actions
Copy link
Copy Markdown

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging blackboxsw, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag blackboxsw to reopen it.)

@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale-pr Pull request is stale; will be auto-closed soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants