locale.Error: unsupported locale setting
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Landscape Client |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
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/
main(
File "/usr/lib/
locale.
File "/usr/lib/
return _setlocale(
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-
However, landscape server keeps reporting that update (2.80-1.1ubuntu1.7) is available.
Changed in landscape-client: | |
status: | New → Confirmed |
I think the client machine should address this bug. A hint to resolve it could be:
sudo locale-gen en_US.UTF-8
sudo update-locale LANG=C.UTF-8
Landscape Client could also try to prevent future failures when detected by applying the solution proposed above:
@@ -3,6 +3,7 @@
except ImportError:
import urllib.parse as urlparse
+import subprocess setlocale( locale. LC_CTYPE, ("C", "UTF-8")) setlocale( locale. LC_CTYPE, ("C", "UTF-8")) run(["sudo" , "locale-gen", "en_US.UTF-8"], check=True) run(["sudo" , "update-locale", "LANG=C.UTF-8"], check=True)
import locale
import logging
import time
@@ -943,7 +944,12 @@
def main(args):
# Force UTF-8 encoding only for the reporter, thus allowing libapt-pkg to
# return unmangled descriptions.
- locale.
+ try:
+ locale.
+ except locale.Error:
+ subprocess.
+ subprocess.
+ raise
if "FAKE_GLOBAL_ PACKAGE_ STORE" in os.environ: handler( FakeGlobalRepor ter, args)
return run_task_
There is a PR with this proposed solution at: /github. com/CanonicalLt d/landscape- client/ pull/161
https:/