salt icon indicating copy to clipboard operation
salt copied to clipboard

[BUG] pkg.installed (aptpkg latest_version) UnboundLocalError on foreign-arch package

Open scy opened this issue 1 year ago • 5 comments

Description When installing WINE under Debian on an amd64 machine, you usually need to pull i386 packages, too. However, the pkg.installed state seems to struggle with packages only available in foreign architectures, at least when you specify them without their architecture name.

Setup

  • on-prem machine
  • onedir packaging
  • masterless

Steps to Reproduce the behavior On an amd64 machine, try a state like this:

WINE packages:
  cmd.run:
    - unless:
        # Don't run if already enabled.
        - dpkg --print-foreign-architectures | grep -Fqx i386
    - name: dpkg --add-architecture i386 && apt update

  pkg.installed:
    - require:
        - cmd: WINE packages
    - pkgs:
        - fonts-wine
        - libwine
        - libwine:i386
        - wine
        - wine32
        - wine64

This will fail as follows:

          ID: WINE packages
    Function: pkg.installed
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/state.py", line 2428, in call
                  ret = self.states[cdata["full"]](
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
                  ret = self.loader.run(run_func, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
                  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
                  return _func_or_method(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1317, in wrapper
                  return f(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/pkg.py", line 1934, in installed
                  pkg_ret = __salt__["pkg.install"](
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
                  ret = self.loader.run(run_func, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
                  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
                  return _func_or_method(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 819, in install
                  _latest_version = latest_version(
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 507, in latest_version
                  candidates[this_pkg] = candidate
              UnboundLocalError: local variable 'this_pkg' referenced before assignment
     Started: 16:01:22.614404
    Duration: 50.036 ms
     Changes:

The code in question is in aptpkg.latest_version():

    cmd = ["apt-cache", "-q", "policy"]
    cmd.extend(names)
    if repo is not None:
        cmd.extend(repo)
    out = _call_apt(cmd, scope=False)

    short_names = [nom.split(":", maxsplit=1)[0] for nom in names]

    candidates = {}
    for line in salt.utils.itertools.split(out["stdout"], "\n"):
        if line.endswith(":") and line[:-1] in short_names:
            this_pkg = names[short_names.index(line[:-1])]
        elif "Candidate" in line:
            candidate = ""
            comps = line.split()
            if len(comps) >= 2:
                candidate = comps[-1]
                if candidate.lower() == "(none)":
                    candidate = ""
            candidates[this_pkg] = candidate

As you can see, the this_pkg variable is set in the if branch, but referenced in the elif branch. This is at least brittle, if not outright wrong.

The package causing this issue is wine32, since it doesn't exist in the amd64 architecture and thus apt-cache prints its name with an architecture suffix:

# apt-cache -q policy wine32
wine32:i386:
  Installed: 8.0~repack-4
  Candidate: 8.0~repack-4
  Version table:
 *** 8.0~repack-4 500
        500 http://deb.debian.org/debian bookworm/main i386 Packages
        100 /var/lib/dpkg/status

line.endswith(":") and line[:-1] in short_names doesn't match that.

salt-call pkg.latest_version wine32 is also broken, with the same UnboundLocalError.

Changing the line in the YAML from - wine32 to - wine32:i386 allows the state to apply cleanly.

In contrast, salt-call pkg.latest_version wine32:i386 still doesn't work.

Expected behavior Not quite sure actually. Maybe cut off the architecture suffix when parsing the apt-cache output? Or give a warning like package 'wine32' was not found, are you missing an architecture suffix (e.g. 'wine32:i386')??

In any case, the parsing loop should be modified in order to not try and parse Candidate: lines when this_pkg has not yet been set.

Versions Report

salt --versions-report
Salt Version:
          Salt: 3007.1
 
Python Version:
        Python: 3.10.14 (main, Apr  3 2024, 21:30:09) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: 18.8.0
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.4
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.7
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.1
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.5.2
        PyYAML: 6.0.1
         PyZMQ: 25.1.2
        relenv: 0.16.0
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 6.3.3
           ZMQ: 4.3.4
 
Salt Package Information:
  Package Type: onedir
 
System Versions:
          dist: debian 12.7 bookworm
        locale: utf-8
       machine: x86_64
       release: 6.1.0-25-amd64
        system: Linux
       version: Debian GNU/Linux 12.7 bookworm

scy avatar Oct 01 '24 14:10 scy

@scy Part of the problem may be that Salt doesn't support 32-bit packages on Linux and hasn't for some time.

dmurphy18 avatar Oct 01 '24 17:10 dmurphy18

@scy Part of the problem may be that Salt doesn't support 32-bit packages on Linux and hasn't for some time.

I don't think that should keep it from supporting multi-arch package installation in general though. Even if Salt itself does not support 32-bit anymore, Debian still does, and the issue here basically boils down to simple string matching. Also, multi-arch is not just about x86 vs x64, it also applies to different ARM subarchitectures or even cross-platform emulation with things like QEMU and binfmt.

scy avatar Oct 01 '24 20:10 scy

@scy FYI dropped support for armfh too. With the recent changes in the Salt Core Team, limited resources to address 32-bit items. Of course when Windows moves to a Linux kernel and runs Wine for Windows support, perhaps we will have to look further :rofl: , joking of course. A PR with the fix, changelog and pytest unit tests exercising the code will get this fixed much quicker, otherwise this will be on the TODO list, sorry but limited resources.

dmurphy18 avatar Oct 01 '24 20:10 dmurphy18

@scy FYI dropped support for armfh too. With the recent changes in the Salt Core Team, limited resources to address 32-bit items. […] A PR with the fix, changelog and pytest unit tests exercising the code will get this fixed much quicker, otherwise this will be on the TODO list, sorry but limited resources.

That's alright and understandable, all good. :) I have outlined a simple workaround in the original report above; this is therefore probably a low priority issue.

However, I still think we're somehow miscommunicating here. This issue has nothing to do with running Salt on 32-bit machines. Instead, this is about Debian's APT package manager being able to install 32-bit packages on 64-bit machines, which are completely unrelated to Salt's supported architectures. In fact, I could even install ARM packages on my AMD64 machine and run them transparently with QEMU, Linux supports these kinds of shenanigans. This issue is just about Salt not stumbling over cross-architecture packages that I wish to install.

scy avatar Oct 01 '24 20:10 scy

@scy Understand, have done all manner of crazy things on top of Linux, and older arches too (even used QEMU in a past life) What you want is a corner case, hence it would be on TODO, with the few of us left, living in fire-fighting mode is taking a lot of the time allotted.

dmurphy18 avatar Oct 01 '24 21:10 dmurphy18

FWIW, I just hit this trying to install these packages on Ubuntu 24.04 host:

install stats packages:
  pkg.installed:
    - pkgs:
      - libcairo2-dev
      - libffi-dev
      - build-essential
      - python3-dev
      - python3-wheel
      - apache2-dev
      - python3-tz
      - python3-urllib3
      - python3-pyparsing

Manually installing the packages works fine. Salt still has the same error on next run though. I'm not familiar enough with Salt internals to have any suggestions here, but doesn't seem to be related to 32-bit vs 64-bit packages.

fukawi2 avatar Jan 09 '25 02:01 fukawi2

FWIW, here's the output of apt-cache -q policy (hostname of our internal mirror redacted)

libcairo2-dev:
  Installed: 1.18.0-3build1
  Candidate: 1.18.0-3build1
  Version table:
 *** 1.18.0-3build1 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status
libffi-dev:
  Installed: 3.4.6-1build1
  Candidate: 3.4.6-1build1
  Version table:
 *** 3.4.6-1build1 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status
build-essential:
  Installed: 12.10ubuntu1
  Candidate: 12.10ubuntu1
  Version table:
 *** 12.10ubuntu1 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status
python3-dev:
  Installed: 3.12.3-0ubuntu2
  Candidate: 3.12.3-0ubuntu2
  Version table:
 *** 3.12.3-0ubuntu2 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     3.12.3-0ubuntu1 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble/main amd64 Packages
python3-wheel:
  Installed: 0.42.0-2
  Candidate: 0.42.0-2
  Version table:
 *** 0.42.0-2 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble/universe amd64 Packages
        100 /var/lib/dpkg/status
apache2-dev:
  Installed: 2.4.58-1ubuntu8.4
  Candidate: 2.4.58-1ubuntu8.4
  Version table:
 *** 2.4.58-1ubuntu8.4 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages
        500 https://mirror.example.com/canary/security.ubuntu.com/ubuntu noble-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.4.58-1ubuntu8 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble/main amd64 Packages
python3-tz:
  Installed: 2024.1-2
  Candidate: 2024.1-2
  Version table:
 *** 2024.1-2 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status
python3-urllib3:
  Installed: 2.0.7-1
  Candidate: 2.0.7-1
  Version table:
 *** 2.0.7-1 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status
python3-pyparsing:
  Installed: 3.1.1-1
  Candidate: 3.1.1-1
  Version table:
 *** 3.1.1-1 500
        500 https://mirror.example.com/canary/archive.ubuntu.com/ubuntu noble/main amd64 Packages
        100 /var/lib/dpkg/status

fukawi2 avatar Jan 09 '25 02:01 fukawi2

Having the same issue, primarily with Wine. Can confirm the issue exists between Salt 3007.1 to 3007.5, does not exist (in the same manner) in 3006.9 to 3006.12. By "in the same manner", I mean that in 3006.9 to 3006.12, dpkg returns a retcode of 1 when running the following, but reports back that the installation was successful:

(this state is remnux/packages/i386-architecture.sls)
i386-arch:
  cmd.run:
    - name: dpkg --add-architecture i386 && apt-get update
    - unless: dpkg --print-foreign-architectures | grep i386

(this state is remnux/packages/wine.sls)

include:
  - remnux.packages.i386-architecture
#  - remnux.repos.winehq

remnux-packages-wine:
  pkg.installed:
    - name: wine-stable
    - require:
      - sls: remnux.packages.i386-architecture
      # - sls: remnux.repos.winehq
[DEBUG   ] LazyLoaded zookeeper.create
[DEBUG   ] Could not LazyLoad cmd.mod_run_check: 'cmd.mod_run_check' is not available.
[INFO    ] Executing command 'dpkg' in directory '/root'
[DEBUG   ] retcode: 1
[DEBUG   ] Last command return code: 1
[INFO    ] Executing command 'dpkg' in directory '/root'
[DEBUG   ] stdout: Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Get:4 http://archive.ubuntu.com/ubuntu noble/restricted i386 Packages [17.2 kB]
Hit:5 http://security.ubuntu.com/ubuntu noble-security InRelease
Get:6 http://archive.ubuntu.com/ubuntu noble/multiverse i386 Packages [151 kB]
Get:7 http://archive.ubuntu.com/ubuntu noble/universe i386 Packages [10.3 MB]
Hit:8 https://packages.broadcom.com/artifactory/saltproject-deb stable InRelease
Get:9 http://archive.ubuntu.com/ubuntu noble/main i386 Packages [1329 kB]
Get:10 http://archive.ubuntu.com/ubuntu noble-updates/multiverse i386 Packages [4573 B]
Get:11 http://archive.ubuntu.com/ubuntu noble-updates/main i386 Packages [608 kB]
Get:12 http://archive.ubuntu.com/ubuntu noble-updates/restricted i386 Packages [22.5 kB]
Get:13 http://archive.ubuntu.com/ubuntu noble-updates/universe i386 Packages [825 kB]
Get:14 http://archive.ubuntu.com/ubuntu noble-backports/main i386 Packages [38.9 kB]
Get:15 http://security.ubuntu.com/ubuntu noble-security/restricted i386 Packages [20.7 kB]
Get:16 http://archive.ubuntu.com/ubuntu noble-backports/universe i386 Packages [16.0 kB]
Get:17 http://security.ubuntu.com/ubuntu noble-security/universe i386 Packages [664 kB]
Get:18 http://security.ubuntu.com/ubuntu noble-security/main i386 Packages [373 kB]
Get:19 http://security.ubuntu.com/ubuntu noble-security/multiverse i386 Packages [3292 B]
Fetched 14.4 MB in 1s (12.8 MB/s)
Reading package lists...
[INFO    ] {'pid': 478, 'retcode': 0, 'stdout': 'Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease\nHit:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease\nHit:3 http://archive.ubuntu.com/ubuntu noble-backports InRelease\nGet:4 http://archive.ubuntu.com/ubuntu noble/restricted i386 Packages [17.2 kB]\nHit:5 http://security.ubuntu.com/ubuntu noble-security InRelease\nGet:6 http://archive.ubuntu.com/ubuntu noble/multiverse i386 Packages [151 kB]\nGet:7 http://archive.ubuntu.com/ubuntu noble/universe i386 Packages [10.3 MB]\nHit:8 https://packages.broadcom.com/artifactory/saltproject-deb stable InRelease\nGet:9 http://archive.ubuntu.com/ubuntu noble/main i386 Packages [1329 kB]\nGet:10 http://archive.ubuntu.com/ubuntu noble-updates/multiverse i386 Packages [4573 B]\nGet:11 http://archive.ubuntu.com/ubuntu noble-updates/main i386 Packages [608 kB]\nGet:12 http://archive.ubuntu.com/ubuntu noble-updates/restricted i386 Packages [22.5 kB]\nGet:13 http://archive.ubuntu.com/ubuntu noble-updates/universe i386 Packages [825 kB]\nGet:14 http://archive.ubuntu.com/ubuntu noble-backports/main i386 Packages [38.9 kB]\nGet:15 http://security.ubuntu.com/ubuntu noble-security/restricted i386 Packages [20.7 kB]\nGet:16 http://archive.ubuntu.com/ubuntu noble-backports/universe i386 Packages [16.0 kB]\nGet:17 http://security.ubuntu.com/ubuntu noble-security/universe i386 Packages [664 kB]\nGet:18 http://security.ubuntu.com/ubuntu noble-security/main i386 Packages [373 kB]\nGet:19 http://security.ubuntu.com/ubuntu noble-security/multiverse i386 Packages [3292 B]\nFetched 14.4 MB in 1s (12.8 MB/s)\nReading package lists...', 'stderr': ''}
[INFO    ] Completed state [dpkg --add-architecture i386 && apt-get update] at time 20:41:21.912800 (duration_in_ms=3345.275)
[DEBUG   ] Could not LazyLoad pkg.ex_mod_init: 'pkg.ex_mod_init' is not available.
[INFO    ] Running state [wine-stable] at time 20:41:21.920655
[INFO    ] Executing state pkg.installed for [wine-stable]
[DEBUG   ] Could not LazyLoad pkg.resolve_capabilities: 'pkg.resolve_capabilities' is not available.
[INFO    ] Executing command dpkg-query in directory '/root'
[DEBUG   ] Could not LazyLoad pkg.check_db: 'pkg.check_db' is not available.
[INFO    ] Executing command apt-cache in directory '/root'
[INFO    ] Executing command apt-get in directory '/root'
[INFO    ] Executing command dpkg in directory '/root'
[INFO    ] Executing command apt-get in directory '/root'
[INFO    ] Executing command dpkg-query in directory '/root'
[INFO    ] Made the following changes:
'libigdgmm12:i386' changed from 'absent' to '22.3.17+ds1-1'
'libslang2' changed from 'absent' to '2.3.3-3build2'
'libgphoto2-6t64:i386' changed from 'absent' to '2.5.31-2.1build2'
'libcodec2-1.2' changed from 'absent' to '1.2.0-2build1'
'libsensors5:i386' changed from 'absent' to '1:3.6.0-9build1'
'libxrandr2' changed from 'absent' to '2:1.5.2-2build1'
'systemd-dev' changed from 'absent' to '255.4-1ubuntu8.8'
'libfribidi0:i386' changed from 'absent' to '1.0.13-3build1'
'libavc1394-0' changed from 'absent' to '0.5.4-5build3'
'libbsd0:i386' changed from 'absent' to '0.12.1-1build1.1'
'libgstreamer-plugins-base1.0-0' changed from 'absent' to '1.24.2-1ubuntu0.2'
'libigdgmm12' changed from 'absent' to '22.3.17+ds1-1'
'libxkbcommon0:i386' changed from 'absent' to '1.6.0-1build1'

--- snip ---

'libglx-mesa0:i386' changed from 'absent' to '24.2.8-1ubuntu1~24.04.1'
'libavcodec60' changed from 'absent' to '7:6.1.1-3ubuntu5'
'libsdl2-2.0-0:i386' changed from 'absent' to '2.30.0+dfsg-1ubuntu3.1'
'libva-drm2' changed from 'absent' to '2.20.0-2build1'
'libgphoto2-l10n' changed from 'absent' to '2.5.31-2.1build2'
'libelf1t64:i386' changed from 'absent' to '0.190-1.1ubuntu0.1'

[DEBUG   ] Refreshing modules...
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] The functions from module 'jinja' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] The functions from module 'yaml' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded yaml.render
[INFO    ] Completed state [wine-stable] at time 20:43:37.196931 (duration_in_ms=135276.276)
[DEBUG   ] File /var/cache/salt/minion/accumulator/123190426052176 does not exist, no need to cleanup
[DEBUG   ] The functions from module 'state' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded state.check_result
[DEBUG   ] The functions from module 'highstate' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded highstate.output
[DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded nested.output
[DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded nested.output
local:
  Name: dpkg --add-architecture i386 && apt-get update - Function: cmd.run - Result: Changed - Started: 20:41:18.567525 - Duration: 3345.275 ms
  Name: wine-stable - Function: pkg.installed - Result: Changed - Started: 20:41:21.920655 - Duration: 135276.276 ms

Summary for local
------------
Succeeded: 2 (changed=2)
Failed:    0
------------
Total states run:     2
Total run time: 138.622 s

When changing wine-stable to simply wine32, the following is observed:

[DEBUG   ] Could not LazyLoad cmd.mod_run_check: 'cmd.mod_run_check' is not available.
[INFO    ] Executing command 'dpkg' in directory '/root'
[DEBUG   ] retcode: 1
[DEBUG   ] Last command return code: 1
[INFO    ] Executing command 'dpkg' in directory '/root'
[DEBUG   ] stdout: Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Get:5 http://archive.ubuntu.com/ubuntu noble/universe i386 Packages [10.3 MB]
Hit:6 https://packages.broadcom.com/artifactory/saltproject-deb stable InRelease
Get:7 http://security.ubuntu.com/ubuntu noble-security/universe i386 Packages [664 kB]
Get:8 http://archive.ubuntu.com/ubuntu noble/main i386 Packages [1329 kB]
Get:9 http://archive.ubuntu.com/ubuntu noble/multiverse i386 Packages [151 kB]
Get:10 http://archive.ubuntu.com/ubuntu noble/restricted i386 Packages [17.2 kB]
Get:11 http://archive.ubuntu.com/ubuntu noble-updates/main i386 Packages [608 kB]
Get:12 http://security.ubuntu.com/ubuntu noble-security/restricted i386 Packages [20.7 kB]
Get:13 http://security.ubuntu.com/ubuntu noble-security/main i386 Packages [373 kB]
Get:14 http://security.ubuntu.com/ubuntu noble-security/multiverse i386 Packages [3292 B]
Get:15 http://archive.ubuntu.com/ubuntu noble-updates/multiverse i386 Packages [4573 B]
Get:16 http://archive.ubuntu.com/ubuntu noble-updates/universe i386 Packages [825 kB]
Get:17 http://archive.ubuntu.com/ubuntu noble-updates/restricted i386 Packages [22.5 kB]
Get:18 http://archive.ubuntu.com/ubuntu noble-backports/main i386 Packages [38.9 kB]
Get:19 http://archive.ubuntu.com/ubuntu noble-backports/universe i386 Packages [16.0 kB]
Fetched 14.4 MB in 1s (13.7 MB/s)
Reading package lists...
[INFO    ] {'pid': 478, 'retcode': 0, 'stdout': 'Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease\nHit:2 http://security.ubuntu.com/ubuntu noble-security InRelease\nHit:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease\nHit:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease\nGet:5 http://archive.ubuntu.com/ubuntu noble/universe i386 Packages [10.3 MB]\nHit:6 https://packages.broadcom.com/artifactory/saltproject-deb stable InRelease\nGet:7 http://security.ubuntu.com/ubuntu noble-security/universe i386 Packages [664 kB]\nGet:8 http://archive.ubuntu.com/ubuntu noble/main i386 Packages [1329 kB]\nGet:9 http://archive.ubuntu.com/ubuntu noble/multiverse i386 Packages [151 kB]\nGet:10 http://archive.ubuntu.com/ubuntu noble/restricted i386 Packages [17.2 kB]\nGet:11 http://archive.ubuntu.com/ubuntu noble-updates/main i386 Packages [608 kB]\nGet:12 http://security.ubuntu.com/ubuntu noble-security/restricted i386 Packages [20.7 kB]\nGet:13 http://security.ubuntu.com/ubuntu noble-security/main i386 Packages [373 kB]\nGet:14 http://security.ubuntu.com/ubuntu noble-security/multiverse i386 Packages [3292 B]\nGet:15 http://archive.ubuntu.com/ubuntu noble-updates/multiverse i386 Packages [4573 B]\nGet:16 http://archive.ubuntu.com/ubuntu noble-updates/universe i386 Packages [825 kB]\nGet:17 http://archive.ubuntu.com/ubuntu noble-updates/restricted i386 Packages [22.5 kB]\nGet:18 http://archive.ubuntu.com/ubuntu noble-backports/main i386 Packages [38.9 kB]\nGet:19 http://archive.ubuntu.com/ubuntu noble-backports/universe i386 Packages [16.0 kB]\nFetched 14.4 MB in 1s (13.7 MB/s)\nReading package lists...', 'stderr': ''}
[INFO    ] Completed state [dpkg --add-architecture i386 && apt-get update] at time 20:49:30.517072 (duration_in_ms=3264.398)
[DEBUG   ] Could not LazyLoad pkg.ex_mod_init: 'pkg.ex_mod_init' is not available.
[INFO    ] Running state [wine32] at time 20:49:30.525032
[INFO    ] Executing state pkg.installed for [wine32]
[DEBUG   ] Could not LazyLoad pkg.resolve_capabilities: 'pkg.resolve_capabilities' is not available.
[INFO    ] Executing command dpkg-query in directory '/root'
[DEBUG   ] Could not LazyLoad pkg.check_db: 'pkg.check_db' is not available.
[INFO    ] Executing command apt-cache in directory '/root'
[INFO    ] Executing command apt-get in directory '/root'
[INFO    ] Executing command dpkg in directory '/root'
[INFO    ] Executing command apt-get in directory '/root'
[INFO    ] Executing command dpkg-query in directory '/root'
[ERROR   ] Made the following changes:
'libgcc-s1' changed from '14-20240412-0ubuntu1' to '14.2.0-4ubuntu2~24.04'
'libcups2t64:i386' changed from 'absent' to '2.4.7-1.2ubuntu7.3'
'libcurl4t64:i386' changed from 'absent' to '8.5.0-2ubuntu10.6'
'libkrb5support0:i386' changed from 'absent' to '1.20.1-6ubuntu2.6'
'gir1.2-glib-2.0' changed from 'absent' to '2.80.0-6ubuntu3.4'
'gsettings-desktop-schemas' changed from 'absent' to '46.1-0ubuntu1'
'libwayland-client0:i386' changed from 'absent' to '1.22.0-2.1build1'
'libcurl3t64-gnutls' changed from '8.5.0-2ubuntu10.4' to '8.5.0-2ubuntu10.6'
'libxcb-randr0:i386' changed from 'absent' to '1.15-1ubuntu2'
'libargon2-1' changed from 'absent' to '0~20190702+dfsg-4build1'
'libunistring5' changed from '1.1-2build1' to '1.1-2build1.1'
'libjpeg-turbo8:i386' changed from 'absent' to '2.1.5-2ubuntu2'
'libxcb-render0:i386' changed from 'absent' to '1.15-1ubuntu2'
'libcdparanoia0:i386' changed from 'absent' to '3.10.2+debian-14build3'
'libgnutls30t64' changed from '3.8.3-1.1ubuntu3.2' to '3.8.3-1.1ubuntu3.3'

--- snip ---

'libavahi-common-data:i386' changed from 'absent' to '0.8-13ubuntu6'
'libpcre2-8-0:i386' changed from 'absent' to '10.42-4ubuntu2.1'
'libavahi-common3' changed from 'absent' to '0.8-13ubuntu6'
'openssl' changed from '3.0.13-0ubuntu3.4' to '3.0.13-0ubuntu3.5'
'libcups2t64' changed from 'absent' to '2.4.7-1.2ubuntu7.3'
'libatspi2.0-0t64:i386' changed from 'absent' to '2.52.0-1build1'

[DEBUG   ] Refreshing modules...
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] The functions from module 'jinja' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] The functions from module 'yaml' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded yaml.render
[INFO    ] Completed state [wine32] at time 20:50:31.288548 (duration_in_ms=60763.516)
[DEBUG   ] File /var/cache/salt/minion/accumulator/129220062750096 does not exist, no need to cleanup
[DEBUG   ] The functions from module 'state' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded state.check_result
[DEBUG   ] The functions from module 'highstate' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded highstate.output
[DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded nested.output
[DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded nested.output
local:
  Name: dpkg --add-architecture i386 && apt-get update - Function: cmd.run - Result: Changed - Started: 20:49:27.252674 - Duration: 3264.398 ms
----------
          ID: remnux-packages-wine
    Function: pkg.installed
        Name: wine32
      Result: False
     Comment: The following packages failed to install/update: wine32
     Started: 20:49:30.525032
    Duration: 60763.516 ms
     Changes:
              ----------
              adwaita-icon-theme:
                  ----------
                  new:
                      46.0-1
                  old:
              alsa-topology-conf:
                  ----------
                  new:
                      1.2.5.1-2
                  old:
              alsa-ucm-conf:
                  ----------
                  new:
                      1.2.10-1ubuntu5.7
                  old:
              at-spi2-common:
                  ----------
                  new:
                      2.52.0-1build1
                  old:
              at-spi2-core:
                  ----------
                  new:
                      2.52.0-1build1
                  old:
              bsdutils:
                  ----------
                  new:
                      1:2.39.3-9ubuntu6.2
                  old:
                      1:2.39.3-9ubuntu6.1
--- snip ---

              xkb-data:
                  ----------
                  new:
                      2.41-2ubuntu1.1
                  old:
              zlib1g:i386:
                  ----------
                  new:
                      1:1.3.dfsg-3.1ubuntu2.1
                  old:

Summary for local
------------
Succeeded: 1 (changed=2)
Failed:    1
------------
Total states run:     2
Total run time:  64.028 s

3007.x

When running the same states with wine-stable on 3007.x, I get the same as my first run, but when changing wine-stable to wine32 I get:

[DEBUG   ] An exception occurred in this state: local variable 'this_pkg' referenced before assignment
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/state.py", line 2428, in call
    ret = self.states[cdata["full"]](
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1317, in wrapper
    return f(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/pkg.py", line 1934, in installed
    pkg_ret = __salt__["pkg.install"](
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 819, in install
    _latest_version = latest_version(
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 507, in latest_version
    candidates[this_pkg] = candidate
UnboundLocalError: local variable 'this_pkg' referenced before assignment
[ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/state.py", line 2428, in call
    ret = self.states[cdata["full"]](
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1317, in wrapper
    return f(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/pkg.py", line 1934, in installed
    pkg_ret = __salt__["pkg.install"](
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 819, in install
    _latest_version = latest_version(
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 507, in latest_version
    candidates[this_pkg] = candidate
UnboundLocalError: local variable 'this_pkg' referenced before assignment

[INFO    ] Completed state [wine32] at time 20:55:56.034518 (duration_in_ms=926.566)
[DEBUG   ] File /var/cache/salt/minion/accumulator/125077810318544 does not exist, no need to cleanup
[DEBUG   ] The functions from module 'state' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded state.check_result
[DEBUG   ] The functions from module 'highstate' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded highstate.output
[DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded nested.output
local:
  Name: dpkg --add-architecture i386 && apt-get update - Function: cmd.run - Result: Changed - Started: 20:55:50.958476 - Duration: 4141.928 ms
----------
          ID: remnux-packages-wine
    Function: pkg.installed
        Name: wine32
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/state.py", line 2428, in call
                  ret = self.states[cdata["full"]](
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
                  ret = self.loader.run(run_func, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
                  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
                  return _func_or_method(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1317, in wrapper
                  return f(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/pkg.py", line 1934, in installed
                  pkg_ret = __salt__["pkg.install"](
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
                  ret = self.loader.run(run_func, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
                  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
                  return _func_or_method(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 819, in install
                  _latest_version = latest_version(
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 507, in latest_version
                  candidates[this_pkg] = candidate
              UnboundLocalError: local variable 'this_pkg' referenced before assignment
     Started: 20:55:55.107952
    Duration: 926.566 ms
     Changes:

Summary for local
------------
Succeeded: 1 (changed=1)
Failed:    1
------------
Total states run:     2
Total run time:   5.068 s

Then I remove the # from the wine.sls state, and use the following repo:

winehq-repo-key:
  file.managed:
    - name: /usr/share/keyrings/winehq-archive.pgp
    - source: https://dl.winehq.org/wine-builds/winehq.key
    - skip_verify: True
    - makedirs: True
    - replace: True

winehq-repo:
  pkgrepo.managed:
    - name: deb [signed-by=/usr/share/keyrings/winehq-archive.pgp] https://dl.winehq.org/wine-builds/ubuntu {{ grains['lsb_distrib_codename'] }} main
    - file: /etc/apt/sources.list.d/winehq-{{ grains['lsb_distrib_codename'] }}.list
    - refresh: True
    - clean_file: True
    - require:
      - file: winehq-repo-key

Then I re-run my original wine-stable install and get the following result, but with no version of wine actually available or "apparently" installed:

[DEBUG   ] Could not LazyLoad cmd.mod_run_check: 'cmd.mod_run_check' is not available.
[INFO    ] Executing command 'dpkg' in directory '/root'
[DEBUG   ] retcode: 1
[DEBUG   ] Last command return code: 1
[INFO    ] Executing command 'dpkg' in directory '/root'
[DEBUG   ] stdout: Get:1 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Hit:2 http://archive.ubuntu.com/ubuntu noble InRelease
Get:3 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages [1110 kB]
Get:4 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
Get:5 https://packages.broadcom.com/artifactory/saltproject-deb stable InRelease [3417 B]
Get:6 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Packages [1566 kB]
Get:7 http://security.ubuntu.com/ubuntu noble-security/main i386 Packages [373 kB]
Get:8 http://security.ubuntu.com/ubuntu noble-security/restricted i386 Packages [20.7 kB]
Get:9 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [1159 kB]
Get:10 http://security.ubuntu.com/ubuntu noble-security/multiverse i386 Packages [3292 B]
Get:11 http://security.ubuntu.com/ubuntu noble-security/universe i386 Packages [664 kB]
Get:12 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Packages [22.1 kB]
Get:13 https://packages.broadcom.com/artifactory/saltproject-deb stable/main amd64 Packages [64.1 kB]
Get:14 http://archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
Get:15 http://archive.ubuntu.com/ubuntu noble/universe i386 Packages [10.3 MB]
Get:16 http://archive.ubuntu.com/ubuntu noble/restricted i386 Packages [17.2 kB]
Get:17 http://archive.ubuntu.com/ubuntu noble/multiverse i386 Packages [151 kB]
Get:18 http://archive.ubuntu.com/ubuntu noble/main i386 Packages [1329 kB]
Get:19 http://archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages [1617 kB]
Get:20 http://archive.ubuntu.com/ubuntu noble-updates/multiverse i386 Packages [4573 B]
Get:21 http://archive.ubuntu.com/ubuntu noble-updates/restricted i386 Packages [22.5 kB]
Get:22 http://archive.ubuntu.com/ubuntu noble-updates/universe i386 Packages [825 kB]
Get:23 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [1481 kB]
Get:24 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Packages [27.1 kB]
Get:25 http://archive.ubuntu.com/ubuntu noble-updates/main i386 Packages [608 kB]
Get:26 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [1417 kB]
Get:27 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 Packages [31.8 kB]
Get:28 http://archive.ubuntu.com/ubuntu noble-backports/main amd64 Packages [48.0 kB]
Get:29 http://archive.ubuntu.com/ubuntu noble-backports/universe i386 Packages [16.0 kB]
Get:30 http://archive.ubuntu.com/ubuntu noble-backports/main i386 Packages [38.9 kB]
Fetched 23.3 MB in 2s (11.3 MB/s)
Reading package lists...
[INFO    ] {'pid': 49, 'retcode': 0, 'stdout': 'Get:1 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]\nHit:2 http://archive.ubuntu.com/ubuntu noble InRelease\nGet:3 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages [1110 kB]\nGet:4 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]\nGet:5 https://packages.broadcom.com/artifactory/saltproject-deb stable InRelease [3417 B]\nGet:6 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Packages [1566 kB]\nGet:7 http://security.ubuntu.com/ubuntu noble-security/main i386 Packages [373 kB]\nGet:8 http://security.ubuntu.com/ubuntu noble-security/restricted i386 Packages [20.7 kB]\nGet:9 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [1159 kB]\nGet:10 http://security.ubuntu.com/ubuntu noble-security/multiverse i386 Packages [3292 B]\nGet:11 http://security.ubuntu.com/ubuntu noble-security/universe i386 Packages [664 kB]\nGet:12 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Packages [22.1 kB]\nGet:13 https://packages.broadcom.com/artifactory/saltproject-deb stable/main amd64 Packages [64.1 kB]\nGet:14 http://archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]\nGet:15 http://archive.ubuntu.com/ubuntu noble/universe i386 Packages [10.3 MB]\nGet:16 http://archive.ubuntu.com/ubuntu noble/restricted i386 Packages [17.2 kB]\nGet:17 http://archive.ubuntu.com/ubuntu noble/multiverse i386 Packages [151 kB]\nGet:18 http://archive.ubuntu.com/ubuntu noble/main i386 Packages [1329 kB]\nGet:19 http://archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages [1617 kB]\nGet:20 http://archive.ubuntu.com/ubuntu noble-updates/multiverse i386 Packages [4573 B]\nGet:21 http://archive.ubuntu.com/ubuntu noble-updates/restricted i386 Packages [22.5 kB]\nGet:22 http://archive.ubuntu.com/ubuntu noble-updates/universe i386 Packages [825 kB]\nGet:23 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [1481 kB]\nGet:24 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Packages [27.1 kB]\nGet:25 http://archive.ubuntu.com/ubuntu noble-updates/main i386 Packages [608 kB]\nGet:26 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [1417 kB]\nGet:27 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 Packages [31.8 kB]\nGet:28 http://archive.ubuntu.com/ubuntu noble-backports/main amd64 Packages [48.0 kB]\nGet:29 http://archive.ubuntu.com/ubuntu noble-backports/universe i386 Packages [16.0 kB]\nGet:30 http://archive.ubuntu.com/ubuntu noble-backports/main i386 Packages [38.9 kB]\nFetched 23.3 MB in 2s (11.3 MB/s)\nReading package lists...', 'stderr': ''}
[INFO    ] Completed state [dpkg --add-architecture i386 && apt-get update] at time 21:00:42.911083 (duration_in_ms=4128.858)
[INFO    ] Running state [/usr/share/keyrings/winehq-archive.pgp] at time 21:00:42.911296
[INFO    ] Executing state file.managed for [/usr/share/keyrings/winehq-archive.pgp]
[DEBUG   ] Requesting URL https://dl.winehq.org/wine-builds/winehq.key using GET method
[DEBUG   ] Using backend: tornado
[DEBUG   ] Using selector: EpollSelector
[INFO    ] File changed:
New file
[INFO    ] Completed state [/usr/share/keyrings/winehq-archive.pgp] at time 21:00:42.988808 (duration_in_ms=77.51)
[INFO    ] Running state [deb [signed-by=/usr/share/keyrings/winehq-archive.pgp] https://dl.winehq.org/wine-builds/ubuntu noble main] at time 21:00:42.989923
[INFO    ] Executing state pkgrepo.managed for [deb [signed-by=/usr/share/keyrings/winehq-archive.pgp] https://dl.winehq.org/wine-builds/ubuntu noble main]
[INFO    ] Executing command apt-get in directory '/root'
[INFO    ] {'repo': 'deb [signed-by=/usr/share/keyrings/winehq-archive.pgp] https://dl.winehq.org/wine-builds/ubuntu noble main'}
[INFO    ] Completed state [deb [signed-by=/usr/share/keyrings/winehq-archive.pgp] https://dl.winehq.org/wine-builds/ubuntu noble main] at time 21:00:44.900656 (duration_in_ms=1910.734)
[DEBUG   ] Could not LazyLoad pkg.ex_mod_init: 'pkg.ex_mod_init' is not available.
[INFO    ] Running state [wine-stable] at time 21:00:44.908200
[INFO    ] Executing state pkg.installed for [wine-stable]
[DEBUG   ] Could not LazyLoad pkg.resolve_capabilities: 'pkg.resolve_capabilities' is not available.
[INFO    ] Executing command dpkg-query in directory '/root'
[DEBUG   ] Could not LazyLoad pkg.check_db: 'pkg.check_db' is not available.
[INFO    ] Executing command apt-cache in directory '/root'
[INFO    ] Executing command apt-get in directory '/root'
[INFO    ] Executing command dpkg in directory '/root'
[INFO    ] Executing command apt-get in directory '/root'
[INFO    ] Executing command dpkg-query in directory '/root'
[INFO    ] Made the following changes:
'libcups2t64:i386' changed from 'absent' to '2.4.7-1.2ubuntu7.3'
'libjack-jackd2-0:i386' changed from 'absent' to '1.9.21~dfsg-3ubuntu3'
'librsvg2-common' changed from 'absent' to '2.58.0+dfsg-1build1'
'libasyncns0:i386' changed from 'absent' to '0.8-6build4'
'libnettle8t64:i386' changed from 'absent' to '3.9.1-2.2build1.1'
'libdw1t64:i386' changed from 'absent' to '0.190-1.1ubuntu0.1'
'libgdk-pixbuf2.0-common' changed from 'absent' to '2.42.10+dfsg-3ubuntu3.1'
'libudev1:i386' changed from 'absent' to '255.4-1ubuntu8.8'
'libheif-plugin-libde265:i386' changed from 'absent' to '1.17.6-1ubuntu4.1'
'libxrender1' changed from 'absent' to '1:0.9.10-1.1build1'
'libsane1:i386' changed from 'absent' to '1.2.1-7build4'
'libxcb-present0:i386' changed from 'absent' to '1.15-1ubuntu2'
'libdrm-intel1:i386' changed from 'absent' to '2.4.122-1~ubuntu0.24.04.1'
'gir1.2-girepository-2.0' changed from 'absent' to '1.80.1-1'
'libmount1' changed from '2.39.3-9ubuntu6.1' to '2.39.3-9ubuntu6.2'
'libavahi-client3' changed from 'absent' to '0.8-13ubuntu6'
'libelf1t64:i386' changed from 'absent' to '0.190-1.1ubuntu0.1'
'libthai0' changed from 'absent' to '0.1.29-2build1'
'libatk-bridge2.0-0t64:i386' changed from 'absent' to '2.52.0-1build1'
'libharfbuzz0b' changed from 'absent' to '8.3.0-2build2'
'libde265-0' changed from 'absent' to '1.0.15-1build3'
'libpango-1.0-0' changed from 'absent' to '1.52.1+ds-1build1'
'i965-va-driver' changed from 'absent' to '2.4.1+dfsg1-1build2'
'libperl5.38t64:i386' changed from 'absent' to '5.38.2-3.2ubuntu0.1'
'libxcb-render0' changed from 'absent' to '1.15-1ubuntu2'
'libxshmfence1:i386' changed from 'absent' to '1.3-1build5'
'libcap2-bin' changed from 'absent' to '1:2.66-5ubuntu2.2'
--- snip ---
'wine-stable-amd64' changed from 'absent' to '10.0.0.0~noble-1'
'libdav1d7' changed from 'absent' to '1.4.1-1build1'
'intel-media-va-driver:i386' changed from 'absent' to '24.1.0+dfsg1-1'
'libpam-systemd' changed from 'absent' to '255.4-1ubuntu8.8'
'libcairo-gobject2' changed from 'absent' to '1.18.0-3build1'
--- snip ---
'wine-stable-i386:i386' changed from 'absent' to '10.0.0.0~noble-1'
'poppler-data' changed from 'absent' to '0.4.12-1'
'libglvnd0' changed from 'absent' to '1.7.0-1build1'
'libpci3' changed from 'absent' to '1:3.10.0-2build1'
--- snip ---
'wine-stable' changed from 'absent' to '10.0.0.0~noble-1'
'libudev1' changed from '255.4-1ubuntu8.4' to '255.4-1ubuntu8.8'
'dbus-bin' changed from 'absent' to '1.14.10-4ubuntu4.1'
'libsystemd0' changed from '255.4-1ubuntu8.4' to '255.4-1ubuntu8.8'
'libwayland-cursor0:i386' changed from 'absent' to '1.22.0-2.1build1'
--- snip ---
[DEBUG   ] Refreshing modules...
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] The functions from module 'jinja' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] The functions from module 'yaml' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded yaml.render
[INFO    ] Completed state [wine-stable] at time 21:02:27.746472 (duration_in_ms=102838.272)
[DEBUG   ] File /var/cache/salt/minion/accumulator/132872330677024 does not exist, no need to cleanup
[DEBUG   ] The functions from module 'state' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded state.check_result
[DEBUG   ] The functions from module 'highstate' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded highstate.output
[DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded nested.output
[DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded nested.output
[DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded nested.output
[DEBUG   ] The functions from module 'nested' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded nested.output
local:
  Name: dpkg --add-architecture i386 && apt-get update - Function: cmd.run - Result: Changed - Started: 21:00:38.782225 - Duration: 4128.858 ms
  Name: /usr/share/keyrings/winehq-archive.pgp - Function: file.managed - Result: Changed - Started: 21:00:42.911298 - Duration: 77.51 ms
  Name: deb [signed-by=/usr/share/keyrings/winehq-archive.pgp] https://dl.winehq.org/wine-builds/ubuntu noble main - Function: pkgrepo.managed - Result: Changed - Started: 21:00:42.989922 - Duration: 1910.734 ms
  Name: wine-stable - Function: pkg.installed - Result: Changed - Started: 21:00:44.908200 - Duration: 102838.272 ms

Summary for local
------------
Succeeded: 4 (changed=4)
Failed:    0
------------
Total states run:     4
Total run time: 108.955 s
root@e12459e9d998:/# wine
bash: wine: command not found

And no variation of wine is available at the bash prompt. When changing wine-stable to wine32, winehq-stable:i386, or wine-stable-i386, I get the following:

local:
  Name: dpkg --add-architecture i386 && apt-get update - Function: cmd.run - Result: Clean - Started: 21:14:24.789964 - Duration: 1024.288 ms
  Name: /usr/share/keyrings/winehq-archive.pgp - Function: file.managed - Result: Clean - Started: 21:14:25.814400 - Duration: 2.161 ms
  Name: deb [signed-by=/usr/share/keyrings/winehq-archive.pgp] https://dl.winehq.org/wine-builds/ubuntu noble main - Function: pkgrepo.managed - Result: Clean - Started: 21:14:25.816856 - Duration: 3.986 ms
----------
          ID: remnux-packages-wine
    Function: pkg.installed
        Name: wine32
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/state.py", line 2428, in call
                  ret = self.states[cdata["full"]](
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
                  ret = self.loader.run(run_func, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
                  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
                  return _func_or_method(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1317, in wrapper
                  return f(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/pkg.py", line 1934, in installed
                  pkg_ret = __salt__["pkg.install"](
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 160, in __call__
                  ret = self.loader.run(run_func, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1269, in run
                  return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1284, in _run_as
                  return _func_or_method(*args, **kwargs)
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 819, in install
                  _latest_version = latest_version(
                File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py", line 507, in latest_version
                  candidates[this_pkg] = candidate
              UnboundLocalError: local variable 'this_pkg' referenced before assignment
     Started: 21:14:25.828058
    Duration: 940.122 ms
     Changes:

Summary for local
------------
Succeeded: 3
Failed:    1
------------
Total states run:     4
Total run time:   1.971 s

Hope this helps.

digitalsleuth avatar Jun 27 '25 21:06 digitalsleuth

Fixed by #68226

twangboy avatar Sep 02 '25 19:09 twangboy