There was a lot of discussion of this on IRC today between myself, cjwatson, and smoser.
The common cause for wrong locales being set is that OpenSSH is passing them through as environment variables from client to server, without consideration of whether they are valid on the server.
In the near-term absence of an upstream solution for OpenSSH, I believe that cloud-init behavior should be changed to approximate such a design.
In descending order of priority:
- We must never leave the user with a shell with a broken locale setting. This causes a variety of problems; it makes the perl interpreter particularly noisy and annoying, but it also means users will have the wrong character set (ASCII vs UTF-8) than if they had set no locale at all in their environment (in which case they would get C.UTF-8 by default).
- We must never show a loud (16-line-long!) banner message telling users how to configure locales if the user's configured invalid locale is English. Nobody who is going to be reading English anyway needs this to be in their face. They should get a working locale and be able to get on with it, and if differences in LC_TIME between C and en_UK get in their way, they can use the normal techniques to resolve this.
- We should not show *this* loud banner message to users on a minimal image. We already have a motd informing users of minimal images that their system is minimized and not in a state meant for human interactive use. Our minimized image should be less verbose and do less handholding than a regular cloud image, and that means we should not include this banner from cloud-init on minimized images.
- I think the message is of limited value overall to users of non-English locales. First, while most of the upstream software we ship is quite well localized, I believe we do a mediocre job of localizing the Ubuntu-specific messages in the Ubuntu server; even where i18n support exists, I don't believe we are championing l10n for them or picking up the translations. So installing the langpacks isn't going to give a great experience in the user's target language. Second, because of the preceding, I believe the vast majority of actual Ubuntu Server users are comfortable navigating a CLI in English even if it is not their first language. And third, if a user does absolutely need their CLI to be in their native language, I believe the value provided to this user by having a banner message in English, even with embedded apt commands, is marginal relative to letting the user google documentation in their own language. For these reasons, I think the banner message should be dropped entirely.
I am happy to provide a patch to address either 1-3 or 1-4, whichever achieves consensus. If we don't do 4), I am inclined to also patch the message to condense it down from its current full-terminal size.
There was a lot of discussion of this on IRC today between myself, cjwatson, and smoser.
The common cause for wrong locales being set is that OpenSSH is passing them through as environment variables from client to server, without consideration of whether they are valid on the server.
Colin and I are agreed that OpenSSH should avoid setting invalid locales in the target environment. An upstream discussion of how to handle this can be found in https:/ /bugzilla. mindrot. org/show_ bug.cgi? id=1346 (and in particular, https:/ /bugzilla. mindrot. org/show_ bug.cgi? id=1346# c38).
In the near-term absence of an upstream solution for OpenSSH, I believe that cloud-init behavior should be changed to approximate such a design.
In descending order of priority:
- We must never leave the user with a shell with a broken locale setting. This causes a variety of problems; it makes the perl interpreter particularly noisy and annoying, but it also means users will have the wrong character set (ASCII vs UTF-8) than if they had set no locale at all in their environment (in which case they would get C.UTF-8 by default).
- We must never show a loud (16-line-long!) banner message telling users how to configure locales if the user's configured invalid locale is English. Nobody who is going to be reading English anyway needs this to be in their face. They should get a working locale and be able to get on with it, and if differences in LC_TIME between C and en_UK get in their way, they can use the normal techniques to resolve this.
- We should not show *this* loud banner message to users on a minimal image. We already have a motd informing users of minimal images that their system is minimized and not in a state meant for human interactive use. Our minimized image should be less verbose and do less handholding than a regular cloud image, and that means we should not include this banner from cloud-init on minimized images.
- I think the message is of limited value overall to users of non-English locales. First, while most of the upstream software we ship is quite well localized, I believe we do a mediocre job of localizing the Ubuntu-specific messages in the Ubuntu server; even where i18n support exists, I don't believe we are championing l10n for them or picking up the translations. So installing the langpacks isn't going to give a great experience in the user's target language. Second, because of the preceding, I believe the vast majority of actual Ubuntu Server users are comfortable navigating a CLI in English even if it is not their first language. And third, if a user does absolutely need their CLI to be in their native language, I believe the value provided to this user by having a banner message in English, even with embedded apt commands, is marginal relative to letting the user google documentation in their own language. For these reasons, I think the banner message should be dropped entirely.
I am happy to provide a patch to address either 1-3 or 1-4, whichever achieves consensus. If we don't do 4), I am inclined to also patch the message to condense it down from its current full-terminal size.