[Bug 2020064] [NEW] locale.Error: unsupported locale setting

Launchpad Bug Tracker 2020064 at bugs.launchpad.net
Fri Jan 17 17:03:57 UTC 2025


You have been subscribed to a public bug by Mitch Burton (mitchburton):


[ Impact ]

 * When the C.UTF-8 locales is not installed, landscape-client's package
   reporter service fails to start:

Traceback (most recent call last):
  File "/usr/bin/landscape-package-reporter", line 10, in <module>
    main(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/landscape/client/package/reporter.py", line 872, in main
    locale.setlocale(locale.LC_CTYPE, ("C", "UTF-8"))
  File "/usr/lib/python3.8/locale.py", line 608, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

 * This prevents landscape-client from reporting packages, preventing
   all subsequent package activities.

[ Test Plan ]

 * Edit /etc/default/locale to contain LANG=en_GB.UTF-8
 * Run `sudo dpkg-reconfigure locales` and select only en_GB.UTF-8 and select
   en_GB.UTF-8 as default locale
 * sudo apt install landscape-client
 * Attempt to start package-reporter:

   sudo landscape-package-reporter

   Package Reporter should start without any exceptions. There will be no output
   and the process will not exit unless killed.

 * Register landscape-client with landscape server and wait for the package
   reporter log to appear at /var/log/landscape/package-reporter.log. The log
   should not contain any errors.

 * Test again using a non-UTF-8 locale setting instead of en_GB.UTF-8

[ Where problems could occur ]

 * As this is a reversion of a previous fix for a bug regarding locales, that
   issue might re-occur with non-UTF-8 locales. A comment in LP: #1827857 claims
   this has been fixed in python-apt, though.

 * Packages with control file fields containing non-ASCII characters may be
   reported incorrectly. The Debian Policy Manual says that package names cannot
   contain these but other fields might,

[ Other Info ]

  <ORIGINAL BUG REPORT FOLLOWS>

OS: Ubuntu 20.04.6 LTS
Landscape client: 23.02-0ubuntu1

Due to missing locale, the landscape client couldn't report the list of
installed packages to the landscape server (SAAS).

2023-05-10 17:23:10,675 WARNING  [MainThread] Package reporter output:
b'Traceback (most recent call last):
  File "/usr/bin/landscape-package-reporter", line 10, in <module>
    main(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/landscape/client/package/reporter.py", line 872, in main
    locale.setlocale(locale.LC_CTYPE, ("C", "UTF-8"))
  File "/usr/lib/python3.8/locale.py", line 608, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
'

As a result, the server kept reporting available updates for the machine
and when the update was triggered it failed with the following error
reported in the task activity.

"Package data has changed. Please retry the operation."

For example on the affected client machine the "apt list --installed | grep dnsmasq-base" gives the output
"dnsmasq-base/focal-updates,focal-security,now 2.80-1.1ubuntu1.7 amd64

However, landscape server keeps reporting that update
(2.80-1.1ubuntu1.7) is available.

** Affects: landscape-client
     Importance: Undecided
         Status: Fix Released

** Affects: landscape-client (Ubuntu)
     Importance: Undecided
     Assignee: Mitch Burton (mitchburton)
         Status: In Progress


** Tags: sts
-- 
locale.Error: unsupported locale setting
https://bugs.launchpad.net/bugs/2020064
You received this bug notification because you are a member of Ubuntu Sponsors, which is subscribed to the bug report.



More information about the Ubuntu-sponsors mailing list