Repository navigation
feat(images): suggest packages for missing commands in WSL - #20629
Open
Muhammad Falak R Wani (mfrw) wants to merge 3 commits into
Open
Muhammad Falak R Wani (mfrw) wants to merge 3 commits into
Muhammad Falak R Wani (mfrw) wants to merge 3 commits into
Conversation
The non-interactive fallback in /etc/profile.d/PackageKit.sh prints its message with "$(gettext PackageKit 'command not found')". When gettext is not in PATH, that lookup re-enters command_not_found_handle, which takes the same branch and forks again without bound. On an image without gettext-runtime, such as the WSL image, one missing command in a non-interactive login shell (bash -lc, sudo -i, su -) exhausts the process table. Backport the upstream fix (PackageKit/PackageKit#1052): call gettext only when "type -P" finds it, and print the untranslated message otherwise. Register it as Patch0502, in the spec's proposed-upstream range. patch-add would pick Patch3002, which falls in the RHEL-only %autopatch range and is never applied here. Move PackageKit into its own comp.toml to carry the overlay. Tested with the rebuilt 1.3.6-3 on the Azure Linux 4 WSL rootfs: "bash -lc strace" now prints a single "command not found" and returns 127, where 1.3.6-2 spawned 300+ nested shells until it hit the PID limit. Interactive shells still offer to install the package. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
The WSL image is about to install PackageKit-command-not-found, which names the package that provides a missing command. PackageKit and appstream-data publish only to SDK today. appstream-data comes in with PackageKit through appstream's "(appstream-data if PackageKit)" dependency. Add both components to base-packages, and bump them so that their next build publishes there. Every binary RPM of both components installs from Base plus the promoted RPMs alone, so no SDK exceptions are needed. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Install PackageKit-command-not-found with the dnf5 backend, so that an interactive shell names the package that provides a missing command: bash: strace: command not found... The package providing this file is: 'strace' WSL users have no password and no polkit agent, so the install that command-not-found offers by default cannot be authorized. Set SingleInstall and MultipleInstall to warn in config.sh, and let users install with "sudo dnf install". Add static tests for the packages, that policy, and the gettext guard in the profile.d handler. Once PackageKit has metadata, a lookup takes about 0.04 s. The first miss after installation waits about 9 s for the metadata download. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The PackageKit and appstream-data publication-channel changes from SDK to Base still require maintainer sign-off, which the rebuild bumps do not replace.
1 open issue
What changed in this PR
Adds missing-command package suggestions to Azure Linux’s WSL image, building on the gettext recursion fix from #20628.
Changes:
- Promotes PackageKit and appstream-data from SDK to Base, with rebuild bumps.
- Installs PackageKit’s command-not-found helper and dnf5 backend, configured to suggest packages without offering installation.
- Adds static checks for package presence, warning-only policy, and the inherited gettext guard.
| File | Description |
|---|---|
specs/p/PackageKit/PackageKit.spec |
Renders the inherited patch registration and updated release. |
specs/p/PackageKit/command-not-found-dont-recurse-without-gettext.patch |
Generated copy of the #20628 recursion fix. |
specs/a/appstream-data/appstream-data.spec |
Advances the release for Base publication. |
locks/PackageKit.lock |
Updates the fingerprint and rebuild counter. |
locks/appstream-data.lock |
Updates the fingerprint and rebuild counter. |
base/images/tests/cases/static/wsl/test_wsl.py |
Adds three command-not-found configuration checks. |
base/images/teams/wsl.xml |
Includes the helper and dnf5 backend. |
base/images/config.sh |
Sets WSL’s PackageKit install policies to warn. |
base/comps/PackageKit/PackageKit.comp.toml |
Dedicated component definition inherited from #20628. |
base/comps/PackageKit/overlays/0001-command-not-found-no-gettext-recursion.overlay.toml |
Inherited overlay registering the gettext fix as Patch0502. |
base/comps/PackageKit/command-not-found-dont-recurse-without-gettext.patch |
Inherited source patch preventing recursive gettext lookup. |
base/comps/components.toml |
Removes the inline definition moved by #20628. |
base/comps/components-publish-channels.toml |
Routes PackageKit and appstream-data builds to Base. |
Review effort: Balanced
| "apache-resource-bundles", | ||
| "apiguardian", | ||
| "appstream", | ||
| "appstream-data", |
Member
Author
|
/azp run |
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stacked on #20628: the first commit here is that PR. Please review the last two commits. I'll rebase once #20628 merges.
This installs PackageKit-command-not-found with the dnf5 backend in the WSL image. An interactive shell then names the package that provides a missing command:
feat(PackageKit): publish PackageKit and appstream-data to Base
(appstream-data if PackageKit)dependency.feat(images): suggest packages for missing commands in WSL
wsl.xml.config.shtherefore setsSingleInstallandMultipleInstalltowarn, and users install withsudo dnf install.Testing (aarch64):
static-image-checks: 62 passed, 38 skipped..wsl.dockerlists docker-cli and podman-docker, andgtisuggests git.bash -lc straceprints a single "command not found".check_base_promotions.pypasses against 4.0, and also from fix(PackageKit): stop command-not-found recursing without gettext #20628's head.Fixes: https://mariner-org.visualstudio.com/mariner/_workitems/edit/25555