Skip to content

Read a Held Package as Installed in install-tools.sh's package_installed #3511

Closed

Description

@ptr727

Summary

host-setup/linux/install-tools.sh's package_installed matches dpkg's whole ${Status} against install ok installed. A held package's status is hold ok installed, so it reads as missing. apt_missing builds on it, so a held package is planned for install again, and line 766's present check skips a held package it should count.

Reproduce

In a throwaway debian:13 container, apt-get install -y less && apt-mark hold less, then dpkg-query -W -f='${Status} | ${db:Status-Status}\n' less prints hold ok installed | installed.

Fix

Compare ${db:Status-Status} to installed, which reads a held package as installed. ptr727/HomeAutomation-Config#1093 made the same fix in that repository's install-lib.sh package_installed, and the hub copy can take the same one-line body.

Found by the local strict review of ptr727/HomeAutomation-Config#1093.

Activity

  1. added
    bug
    on Oct 26, 2026
  2. ptr727 commented on Oct 26, 2026

    @ptr727
    OwnerAuthor

    A caveat on the one-line fix, read after filing: line 766 feeds the Docker conflict removal, run_root apt-get remove -y "${present[@]}". Today a held conflicting package is skipped there and stays installed. With the fix it joins present, and apt-get remove -y then refuses with exit 100 (Held packages were changed and -y was used without --allow-change-held-packages), measured with apt-get purge -y on a held package in debian:13. A dry run with -s passes, so it doesn't catch this. ptr727/HomeAutomation-Config#1093 handles the same case in USBDev/usb-dev-setup.sh by reading ${db:Status-Want} for hold and reporting a held conflict for manual action before removing anything.

  3. ptr727 commented on Oct 26, 2026

    @ptr727
    OwnerAuthor

    A second hub copy of the same check already reads a hold correctly: host-setup/linux/setup-github.sh:126 matches ^(install|hold) ok installed. So the hub holds two package_installed definitions that disagree on a held package. Per "Design Before Code", the fix is one shared definition, taken by both scripts, rather than a second per-site patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions