Skip to content

fix(install): never let apt remove ROCm packages during dependency setup (EAI-7957) - #238

Open
fredespi wants to merge 5 commits into
mainfrom
vllm-openmpi-auto-setup-removes-rocm-system
Open

fix(install): never let apt remove ROCm packages during dependency setup (EAI-7957)#238
fredespi wants to merge 5 commits into
mainfrom
vllm-openmpi-auto-setup-removes-rocm-system

Conversation

@fredespi

Copy link
Copy Markdown
Collaborator

Summary

rocm install sdk could remove a working ROCm installation without asking.

Installing vLLM needs the OpenMPI runtime, which the CLI installs through the host package manager with apt-get install -y. That -y assumes yes for package removals as well as installs, so when apt decided to satisfy OpenMPI by evicting the ROCm stack, it went ahead unattended — the SDK install runs this path automatically whenever it has root or passwordless sudo. The field report saw rocm, rocm-hip, rocm-hip-runtime-dev, mivisionx-dev and rpp-dev removed while an older toolchain was pulled in, breaking a working ROCm 7.14 install.

This makes that transaction fail loudly instead of silently destroying the installation.

Changes

  • Before running an apt-get install step, simulate it first with apt-get -s and parse the removals apt reports.
  • If the transaction would remove any ROCm/AMDGPU package, refuse: print every affected package and tell the user to resolve the conflict manually. This applies on the --yes path and the unattended path alike, since the reported breakage happened unattended.
  • Packages are matched by component family rather than an exhaustive list, because ROCm ships hundreds of packages and adds more each release. Many core names are dashless (hsakmt-roct, llvm-amdgpu, rocminfo, hipblas), so matching only on a <family>- shape would miss them.
  • The matcher deliberately favours recall: a false positive only asks the user to install by hand, while a false negative breaks their ROCm install. It still leaves the packages these plans legitimately install or swap (openmpi-bin, mpich, libnuma1, libatomic1) removable, so the guard cannot block the very install it protects.
  • Other package managers are untouched — dnf/zypper/pacman plans are additive and have no assume-yes removal path.
  • The guard fails open if the simulation itself cannot run, so it never blocks an otherwise healthy install.

Test plan

  • Unit tests in crates/rocm-core/src/openmpi.rs cover removal parsing (including apt's trailing *), the simulate argv (adds -s, drops -y, tolerates a sudo prefix, ignores non-apt commands), and the package classifier — with the dashless core package names as explicit regression cases.
  • New scenario @id:deps-guard-refuses-rocm-removal (tests/e2e-cucumber/features/dependency_guard.feature) covers the user-visible behaviour: it asserts the CLI refuses, refuses before installing anything, and names every ROCm package at risk. It plants a runtime registry entry and stands in for the package manager, so it needs no GPU, no engine install and no network, and runs on the default mock lane.
  • Verified as a real regression test: with the guard removed the scenario fails, and passes with it restored.
  • Linux container run: clippy clean, 434 unit tests pass, and the e2e suite runs the new scenario green.

The scenario is Linux-only (@requires-os:linux) and assumes an apt host, which every Linux CI lane is; the guard is apt-specific by design. That precondition is recorded in the feature file.

Fixes EAI-7957.

@fredespi
fredespi requested a review from a team as a code owner August 12, 2026 16:55
…957)

`apt-get install -y` assumes yes for removals as well as installs, so the
automatic OpenMPI/libatomic/libnuma setup could apply a dependency solution
that removes the ROCm stack. This runs unattended under `rocm install sdk`
whenever root or passwordless sudo is available, so a pre-existing ROCm
install could be broken with no prompt.

Simulate each apt install with `apt-get -s` first and abort when the
transaction would remove a ROCm/AMDGPU package, naming every affected
package. Other package managers are unaffected: their plans are additive
and have no assume-yes removal path.

Signed-off-by: fredespi <fredrik.espinoza@gmail.com>
… to end

Pre-PR review found the protected-package matcher too narrow and the new
user-visible refusal untested at the behaviour level.

Match ROCm packages by component-family prefix instead of requiring a
`<family>-` shape. Core packages such as hsakmt-roct, llvm-amdgpu, rocminfo
and hipblas are dashless, so the previous rule did not match them and apt
could still remove them. The matcher now deliberately favours recall: a false
positive only asks the user to install by hand, while a false negative breaks
their ROCm install.

Add the Gherkin scenario root AGENTS.md requires for user-observable
behaviour. It plants a runtime registry entry and stands in for the package
manager, so it needs no GPU, no engine install and no network, and asserts the
CLI refuses, refuses before installing anything, and names every ROCm package
at risk. Verified as a regression test: it fails with the guard removed and
passes with it.

Signed-off-by: fredespi <fredrik.espinoza@gmail.com>
…scenario

Signed-off-by: fredespi <fredrik.espinoza@gmail.com>
@fredespi
fredespi force-pushed the vllm-openmpi-auto-setup-removes-rocm-system branch from f884097 to 681b91a Compare August 12, 2026 17:18
Signed-off-by: fredespi <fredrik.espinoza@gmail.com>
…up-removes-rocm-system

Signed-off-by: fredespi <fredrik.espinoza@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant