Comment 3 for bug 407949

Revision history for this message
Scott Moser (smoser) wrote :

This affects the uec instances of the ec2/uec images negatively. You can see the obvious problem here:

    def get_location_from_availability_zone(self, availability_zone):
        if availability_zone.startswith('us-'):
            return 'us'
        elif availability_zone.startswith('eu-'):
            return 'eu'
        raise Exception('Could not determine location')

That exception is not caught in the caller (ec2-set-defaults.py):

def main():
    ec2 = ec2init.EC2Init()

    availability_zone = ec2.get_availability_zone()
    location = ec2.get_location_from_availability_zone(availability_zone)

The result is that ec2-set-defaults dies before 'apply_locale' is called.

As such, locale-gen and update-locale are not called in the instance. That causes things like:

$ man asdf
man: can't set the locale; make sure $LC_* and $LANG are correct
No manual entry for asdf

To fix that, you can do what ec2-init would have done:
$ sudo locale-gen en_US.UTF-8
Generating locales...
  en_US.UTF-8... done
Generation complete.
$ sudo update-locale en_US.UTF-8
$ echo "LANG=en_US.UTF-8" | sudo tee /etc/default/locale