Error: Failed to import module localemod

:wave: Hallo community,

:anger: I get an error message, if I run the dom0 updater.

[user@dom0 ~]$ sudo qubesctl --show-output state.sls update.qubes-dom0
[WARNING ] /usr/lib/python3.8/site-packages/salt/utils/files.py:396: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  f_handle = open(*args, **kwargs)  # pylint: disable=resource-leakage

[ERROR   ] Failed to import module localemod, this is due most likely to a syntax error:
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/salt/loader.py", line 1685, in _load_module
    mod = spec.loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 522, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1027, in load_module
  File "<frozen importlib._bootstrap_external>", line 852, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/var/cache/salt/minion/extmods/modules/localemod.py", line 222, in <module>
    @decorators.which('locale-gen')
AttributeError: module 'salt.utils.decorators' has no attribute 'which'
local:
----------
          ID: /etc/yum.repos.d/qubes-dom0.repo
    Function: file.replace
      Result: True
     Comment: No changes needed to be made
     Started: 00:35:35.489167
    Duration: 12.268 ms
     Changes:   
----------
          ID: /etc/yum.repos.d/qubes-templates.repo
    Function: file.replace
      Result: True
     Comment: No changes needed to be made
     Started: 00:35:35.501546
    Duration: 1.288 ms
     Changes:   
----------
          ID: update
    Function: cmd.run
        Name: if qubes-dom0-update --quiet --assumeyes --clean --action=clean expire-cache >/dev/null 2>&1; then
    echo "result=True comment='Cache cleaned'"
else
    echo "result=False comment='Could not clean cache'"
fi

      Result: True
     Comment: Cache cleaned
     Started: 00:35:35.503942
    Duration: 5986.629 ms
     Changes:   
----------
          ID: update
    Function: pkg.uptodate
      Result: True
     Comment: System is already up-to-date
     Started: 00:35:43.050404
    Duration: 101501.898 ms
     Changes:   

Summary for local
------------
Succeeded: 4
Failed:    0
------------
Total states run:     4
Total run time: 107.502 s

:question: Should I be worried? How can I solve this error?

:pray: Thank you very much for your help.

It has failed to load a resource for your locale. Salt Localemod docs refer to this variable…

It appears it didn’t break any other functionality based on the “Comment” and “Result” fields.

How can I avoid this error? What should I do?

Hello there,

getting the same error after upgrading to Qubes OS 4.1. I think exactly the same issue is described and marked as Solution here: Dom0 update fails after 4.1 upgrade .
After the update attempt, there’s still a green tick shown after dom0 (!) Only after opening the Details, one can see that there is an [Error ] . Is this a security concern?

Thank you!

Please note that the upgrade process didn’t ran that smooth, I unintentionally skipped Stage 2. I ran qubes-dist-upgrade --all , but Stage 1 was stuck for a while, I aborted it and “continued” manually.
I’ll try to fix the problem by myself first.

Fixed. Followed the instructions from RhizomaticNomad from upgrade from 4.0 to 4.1 breaks dom0 update -- [ERROR ] Failed to import module localemod · Issue #7114 · QubesOS/qubes-issues · GitHub from Dom0 update fails after 4.1 upgrade

in Global settings → Default kernel used by qubes was pointing to 5.4 from fc25, changed that to 5.10.109-1.fc32.

sudo dnf remove qubes-mgmt-salt-base-overrides (not necessary, because it wasn’t installed (anymore?))

qubesctl saltutil.clear_cache
qubesctl saltutil.sync_all

After this, the Dom0 could be updated again.

That’s all I did (even no reboot).

Best regards,

Ivan