[Bug]: apt doesn't detect installed package with native architecture in name in install list

Đang mở
#70,209 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
linux, python, ubuntu
Lĩnh vực
devops, tooling

Hướng nghiên cứu

Bắt đầu từ phần xử lý pkg.install của Salt cho backend apt và tái hiện các lệnh được báo cáo với libnvidia-container-tools và libnvidia-container1:amd64 trên Ubuntu 24.04. So sánh việc phát hiện các gói đã cài đặt khi có và không có split_arch, sau đó xác minh rằng các gói đã được cài đặt ở trạng thái được yêu cầu không gây ra lệnh gọi apt không cần thiết nào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug needs-triage
What happened?

This is a followup to #68932

Hey there,

with 3006.26 installed on our nodes, salt's apt handling of packages with the architecture in the name improved. However, there seems to be (at least) 1 bug remaining.
We have this state:

nvidia_driver_bundle:
  pkg.installed:
    - pkgs: {{ driver_pkgs }}
    - require:
      - cmd: update_grub_nouveau
      - pkg: nvidia_repo_keys
      - pkg: install_helper_packages
    - update_holds: True
    - install_recommends: False

With this package list:

  "general": [
    {"nvidia-driver-pinning-{}".format(nvidia_upstream_version): nvidia_full_version},
    {"libnvidia-common": nvidia_full_version},
    {"libnvidia-cfg1:{}".format(arch): nvidia_full_version},
    {"libnvidia-compute:{}".format(arch): nvidia_full_version},
    {"libnvidia-decode:{}".format(arch): nvidia_full_version},
    {"libnvidia-encode:{}".format(arch): nvidia_full_version},
    {"libnvidia-extra:{}".format(arch): nvidia_full_version},
    {"libnvidia-gpucomp:{}".format(arch): nvidia_full_version},
    {"libnvidia-nscq": nvidia_full_version},
    {"nvidia-kernel-common": nvidia_full_version},
    {"nvidia-firmware": nvidia_full_version},
    {"nvidia-modprobe": nvidia_full_version},
    {"nvidia-persistenced": nvidia_full_version},
    "libnvidia-container-tools",
    "libnvidia-container1:{}".format(arch),
  ],

The driver was installed intially successfully. However, now, we see this behaviour:

salt-call --local pkg.install pkgs='["libnvidia-container-tools", "libnvidia-container1:amd64"]' update_holds=True 
[ERROR   ] Command 'systemd-run' failed with return code: 100
[ERROR   ] stdout: Reading package lists...
Building dependency tree...
Reading state information...
The following held packages will be changed:
  libnvidia-container1
The following packages will be upgraded:
  libnvidia-container-tools libnvidia-container1
2 upgraded, 0 newly installed, 0 to remove and 216 not upgraded.
[ERROR   ] stderr: Running as unit: run-r96f57abddd7e4cbcb238653e9dbd5b0d.scope; invocation ID: c7b8fc72ba014b79aa08bae737ae38aa
E: Held packages were changed and -y was used without --allow-change-held-packages.
[ERROR   ] retcode: 100
Error running 'pkg.install': Problem encountered installing package(s). Additional info follows:

changes:
    ----------
errors:
    - Running as unit: run-r96f57abddd7e4cbcb238653e9dbd5b0d.scope; invocation ID: c7b8fc72ba014b79aa08bae737ae38aa
      E: Held packages were changed and -y was used without --allow-change-held-packages.

With dpkg reporting:

dpkg -l | grep nvidia
hi  libnvidia-cfg1:amd64                        590.48.01-0ubuntu1                      amd64        NVIDIA binary OpenGL/GLX configuration library
hi  libnvidia-common                            590.48.01-0ubuntu1                      all          Shared files used by the NVIDIA libraries
hi  libnvidia-compute:amd64                     590.48.01-0ubuntu1                      amd64        NVIDIA libcompute package
hi  libnvidia-container-tools                   1.19.1-1                                amd64        NVIDIA container runtime library (command-line tools)
hi  libnvidia-container1:amd64                  1.19.1-1                                amd64        NVIDIA container runtime library
hi  libnvidia-decode:amd64                      590.48.01-0ubuntu1                      amd64        NVIDIA Video Decoding runtime libraries
hi  libnvidia-encode:amd64                      590.48.01-0ubuntu1                      amd64        NVENC Video Encoding runtime library
hi  libnvidia-extra:amd64                       590.48.01-0ubuntu1                      amd64        Extra libraries for the NVIDIA driver
hi  libnvidia-gpucomp:amd64                     590.48.01-0ubuntu1                      amd64        NVIDIA binary GPU compiler library
hi  libnvidia-nscq                              590.48.01-0ubuntu1                      amd64        NVSwitch Configuration and Query library
hi  nvidia-dkms-open                            590.48.01-0ubuntu1                      amd64        NVIDIA DKMS package (open kernel module)
hi  nvidia-driver-pinning-590.48.01             590.48.01-0ubuntu1                      all          APT driver pinning file for driver version 590.48.01
hi  nvidia-firmware                             590.48.01-0ubuntu1                      amd64        Firmware files used by the kernel module
hi  nvidia-kernel-common                        590.48.01-0ubuntu1                      amd64        Shared files used with the kernel module
hi  nvidia-kernel-source-open                   590.48.01-0ubuntu1                      amd64        NVIDIA kernel source package
hi  nvidia-modprobe                             590.48.01-0ubuntu1                      amd64        Load the NVIDIA kernel driver and create device files
hi  nvidia-persistenced                         590.48.01-0ubuntu1                      amd64        daemon to maintain persistent software state in the NVIDIA driver
ii  nvidia-repo-keys                            26.02-1                                 all          Adds keys to apt trusted.gpg database

Both packages are already installed, but salt thinks that libnvidia-container1 is not already installed, so it makes a call to install it with the newest version, but this doesn't work because it requires the other package to be updated, but it is held because of the state above. We would expect instead that salt does nothing because both packages are already installed.
Interestingly, this state runs through:

salt-call --local pkg.install pkgs='["libnvidia-container-tools", "libnvidia-container1:amd64"]' update_holds=True split_arch=False
local:
    ----------
    libnvidia-container-tools:
        ----------
        new:
            1.20.0-1
        old:
            1.19.1-1
    libnvidia-container1:
        ----------
        new:
            1.20.0-1
        old:
            1.19.1-1

This then updates the package.

Then, we see this:

salt-call --local state.single pkg.installed \
  name=test_nvidia_container_packages \
  pkgs='["libnvidia-container-tools", "libnvidia-container1:amd64"]' \
  update_holds=True
local:
----------
          ID: test_nvidia_container_packages
    Function: pkg.installed
      Result: True
     Comment: 1 targeted package was installed/updated.
              The following packages were already installed: libnvidia-container-tools
     Started: 14:40:04.574873
    Duration: 4158.501 ms
     Changes:   

Summary for local
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time:   4.159 s

So this confirms that salt doesn't detect the installed package properly and calls apt for no reason.

Type of salt install

Official deb

Major version

3006.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

ubuntu-24.04

salt --versions-report output
Salt Version:
          Salt: 3006.26
 
Python Version:
        Python: 3.10.20 (main, Jun 11 2026, 02:19:33) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.17.1
      cherrypy: 18.10.0
  cryptography: 47.0.0
      dateutil: 2.9.0.post0
     docker-py: Not Installed
         gitdb: 4.0.12
     gitpython: 3.1.44
        Jinja2: 3.1.6
       libgit2: 1.9.0
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.1.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.0
     pycparser: 3.00
      pycrypto: Not Installed
  pycryptodome: 3.23.0
        pygit2: 1.18.0
  python-gnupg: 0.5.6
        PyYAML: 6.0.3
         PyZMQ: 27.1.0
        relenv: 0.22.14
         smmap: 5.0.2
       timelib: 0.3.0
       Tornado: 6.5.5
           ZMQ: 4.3.5
 
System Versions:
          dist: ubuntu 24.04.2 noble
        locale: utf-8
       machine: x86_64
       release: 6.8.0-136-generic
        system: Linux
       version: Ubuntu 24.04.2 noble
Ngôn ngữ chính
Python
Star
15.8k
Fork
5.6k
Merge trung bình
5 ngày 9 giờ
Pull request đã merge (30 ngày)
99

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của saltstack/salt

Tất cả issue của saltstack/salt

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.