Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

locale_gen fails to generate a locale on Ubuntu if locale.gen exists #425

Closed
jnv opened this issue Apr 26, 2015 · 15 comments
Closed

locale_gen fails to generate a locale on Ubuntu if locale.gen exists #425

jnv opened this issue Apr 26, 2015 · 15 comments

Comments

@jnv
Copy link

jnv commented Apr 26, 2015

Issue Type:

Bug Report

Ansible Version:

1.9.0.1

Environment:

Ubuntu 14.04

Summary:

locale_gen fails to generate locale on Ubuntu if you attempt to generate a new locale which is not present in /etc/locale.gen (which is normally not used by Ubuntu).

Steps To Reproduce:

On fresh Ubuntu system, create an empty file /etc/locale.gen file and execute locale_gen with any locale, e.g.:

- locale_gen: name=en_US.UTF-8 state=present
Expected Results:

The module should generate locale without an error as long locales package is installed.

Actual Results:

The module fails with message The locales you've entered is not available on your system. even when the locale is available on the system.

This seems to be relevant to ansible/ansible#7289. File /etc/locale.gen is normally not present on Ubuntu system, however it can be part of setup by provider (in my case, it was on the VPS by OVH). If that file is present, the module will assume that the system is not Ubuntu and read /etc/locale.gen for the list of locales available for generation – however, that list may be stale or empty, the module should always look to the file /usr/share/i18n/SUPPORTED instead.

The critical path seems to be on lines 157-165 – maybe the code should check SUPPORTED file first or look for something else; probably the best option would be an output from locale -a which returns an actual list of locales available on the system.

@JanMalte
Copy link

JanMalte commented May 7, 2015

A temporary workaround is, to not rely on the ansible module for generating the locales. TYPO3 has a commit with workaround: https://github.com/typo3-ci/infrastructure/commit/648dce2637a3c47edcb924697afc8df73ac759fc

@jnv
Copy link
Author

jnv commented May 7, 2015

Even easier option is to just delete /etc/locale.gen. There's no need to keep that file on Ubuntu.

@snolahc
Copy link

snolahc commented Sep 23, 2015

Any news of accepted PR ?

@lifeofguenter
Copy link

👍 (happens on strato.de VPS as well)

@lukearmstrong
Copy link

Get the same error on Ubuntu, done nothing special before now, just giving locale_gen a go for the first time and it doesn't work.

Going to use this workaround instead of deleting /etc/locale.gen as I don't know what that file is used by and deleting it seems a bit excessive.

https://github.com/typo3-ci/infrastructure/commit/648dce2637a3c47edcb924697afc8df73ac759fc

@ansibot
Copy link

ansibot commented Aug 4, 2016

@AugustusKling, ping. This issue is still waiting on your response.
click here for bot help

@ansibot
Copy link

ansibot commented Sep 13, 2016

@AugustusKling, ping. This issue is still waiting on your response.
click here for bot help

@dpiotrowski
Copy link

If I could add something here, I'd like to say that it affects version 2.1.2.0 as well.

@ansibot
Copy link

ansibot commented Oct 6, 2016

@AugustusKling, ping. This issue is still waiting on your response.
click here for bot help

2 similar comments
@ansibot
Copy link

ansibot commented Oct 22, 2016

@AugustusKling, ping. This issue is still waiting on your response.
click here for bot help

@ansibot
Copy link

ansibot commented Nov 6, 2016

@AugustusKling, ping. This issue is still waiting on your response.
click here for bot help

@ansibot
Copy link

ansibot commented Nov 22, 2016

@AugustusKling, ping. This issue is still waiting on your response.
click here for bot help

@ansibot
Copy link

ansibot commented Dec 6, 2016

This repository has been locked. All new issues and pullrequests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pullrequest to the ansible/ansible repo.

@walterdolce
Copy link

This affects Ansible 2.3.1.0 and fails on Debian Jessie64 as well.

@ansibot
Copy link

ansibot commented Sep 10, 2017

This issue was migrated to ansible/ansible#29200

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants