[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#955733: cloud-init does not set locale specified in user data



Package: cloud-init
Version: 18.3-6

I am launching a Buster 10.3 EC2 instance with the following user data
to initialise and set the default locale:

    #cloud-config
    hostname: argon
    locale: en_GB.UTF-8
    timezone: Europe/London

This fails to set the locale, and "systemctl status cloud-init" shows:

    Apr 04 11:00:30 argon systemd[1]: Starting Apply the settings specified in cloud-config...
    Apr 04 11:00:43 argon cloud-init[546]: Generating locales (this might take a while)...
    Apr 04 11:00:43 argon cloud-init[546]: Generation complete.
    Apr 04 11:00:43 argon cloud-init[546]: *** update-locale: Error: invalid locale settings:  LANG=en_GB.UTF-8
    Apr 04 11:00:43 argon cloud-init[546]: Cloud-init v. 18.3 running 'modules:config' at Sat, 04 Apr 2020 10:00:41 +0000. Up 21.77 seconds.
    Apr 04 11:00:43 argon cloud-init[546]: 2020-04-04 10:00:43,604 - util.py[WARNING]: Running module locale (<module 'cloudinit.config.cc_locale' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_locale.py'>) failed
    Apr 04 11:00:45 argon systemd[1]: cloud-config.service: Main process exited, code=exited, status=1/FAILURE
    Apr 04 11:00:45 argon systemd[1]: cloud-config.service: Failed with result 'exit-code'.
    Apr 04 11:00:45 argon systemd[1]: Failed to start Apply the settings specified in cloud-config.
    
The log file "cloud-init.log" shows the error is caused by failing to
generate the requested locale.

    2020-04-04 10:00:43,005 - debian.py[DEBUG]: Generating locales for en_GB.UTF-8
    2020-04-04 10:00:43,005 - util.py[DEBUG]: Running command ['locale-gen', 'en_GB.UTF-8'] with allowed return codes [0] (shell=False, capture=False)

The command "locale-gen" does not accept a locale as an argument, but
only generates the locales listed in "/etc/locale.gen".  So the locale
requested does not get generated, and causes the subsequent failure when
setting locale.

    2020-04-04 10:00:43,196 - util.py[DEBUG]: Running command ['update-locale', '--locale-file=/etc/default/locale', 'LANG=en_GB.UTF-8'] with allowed return codes [0] (shell=False, capture=False)

Nick


Reply to: