NAME

Rex::GPU::AMD::Setup::Apt - apt/dpkg packaging layer of the AMD driver setups, and the ROCm install (experimental)

VERSION

version 0.006

DESCRIPTION

Experimental. The apt/dpkg layer under Rex::GPU::AMD::Setup::Ubuntu and Rex::GPU::AMD::Setup::Debian, with the driver path's apt rules (as in Rex::GPU::NVIDIA::Setup::Apt): the apt timers stopped before the first apt-get, a dpkg lock timeout on every apt-get, the install run directly and dpkg -l (ii, or hi when held) as the only evidence. And "install_rocm", which is apt-only.

apt_lock_timeout

Seconds apt-get waits for the dpkg lock (-o DPkg::Lock::Timeout=). Default 120: on a fresh boot cloud-init and unattended-upgrades still hold it.

apt_get

apt-get -o DPkg::Lock::Timeout=120: every apt-get of this layer.

prepare_host

Stops unattended-upgrades, apt-daily and apt-daily-upgrade (on a fresh boot they hold the dpkg lock).

refresh_index

apt-get update -q, auto_die => 0: it exits non-zero on warnings that are no failure; a missing package shows in the next step.

has_candidate

LC_ALL=C apt-cache policy PKG lists a Candidate other than (none) -- an installed package is its own candidate, also when no source carries it any more. Read-only.

package_installed

dpkg -l PKG | grep -q '^[hi]i': installed and configured, held (hi) or not (ii). Read-only.

package_on_disk

dpkg-query -W -f='${Status}\n' PKG: true when dpkg knows the package in any state but not-installed and config-files -- unlike "package_installed", held, unpacked, half-configured and half-installed count too. Read-only.

package_held

dpkg-query -W of PKG: true when dpkg's selection for it -- the first word of ${Status} -- is hold (apt-mark hold), in any state, installed or not. Read-only.

blocking_holds

my @held = $setup->blocking_holds($plan);

The held packages (as "package_held" counts them) among the plan's packages and "dkms_dependencies" in Rex::GPU::AMD::Setup that apt-get install -y would have had to change: one of the plan's packages that is not installed (dpkg has it in no state but not-installed or config-files), or is installed at another version than its candidate -- apt aborts the whole install then; a dependency that is not installed -- apt does not install a held one. A held package at its candidate, and a held dependency in any installed version, were no obstacle and are left out. One dpkg-query -W for all of them; only when one of the plan's packages is held and installed, one LC_ALL=C apt-cache policy of those for Installed and Candidate. Without an answer from it for a package (the command failed, no such lines), that package counts as in the way. Read-only.

hold_advice

... is on hold, and apt-get install -y does not change a held package (where it would have to, it aborts the install). Run apt-mark unhold ... and install_driver again.

install_helpers

curl and gpg, only if command -v does not find them: after an "refresh_index", apt-get install --no-upgrade curl gnupg, verified.

install_packages

$setup->install_packages($plan);

DEBIAN_FRONTEND=noninteractive apt-get install -y of the plan's packages, directly: never Rex::Commands::Pkg.

verify_packages

Each of the plan's packages must be "package_installed", ii or hi in dpkg -l; dies otherwise, naming the first one that is not. A failed DKMS build makes amdgpu-dkms's post-install exit non-zero, which leaves it half-configured -- iF (hF when held), not ii or hi -- and the message for amdgpu-dkms points at the build log. For a dkms plan the message names, whichever package is missing, the holds "blocking_holds" finds in the way ("hold_note" in Rex::GPU::AMD::Setup) as the cause -- apt-get install -y does not change a held package, and where it would have to it aborts the whole install -- and apt-mark unhold of them as the way out, before the build log for amdgpu-dkms itself. The holds are asked only then, once a package is missing: a host where every package went in runs no extra command.

dkms_suite

The repo.radeon.com/amdgpu/31.60/ubuntu suite for this release (resolute, noble, jammy), undef where AMD has none. Per OS class.

dkms_repo

/etc/apt/sources.list.d/amdgpu.list with AMD's line, deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/amdgpu/31.60/ubuntu SUITE main.

place_key

gpg --dearmor of the checked key into path, through a temporary file that replaces it only when non-empty, mode 0644 for apt's _apt user.

install_rocm

my $how = $setup->install_rocm($rocm, \@targets);   # 'present' or 'installed'

Host-read-only first: "rocm_repo_dir" in Rex::GPU::AMD::Setup (dies without one), amd64, dpkg-query of rocm-core (in any state but not-installed and config-files, as "package_on_disk" counts -- held, unpacked and half-configured too: dies; AMD requires removing the old ROCm line first, and this never uninstalls) and of the target packages (all installed and configured, held or not, at the release: present; an unpacked or half-configured one is not), then -- only when not present -- "check_rocm_matrix" in Rex::GPU::AMD::Setup (a Radeon or Ryzen APU target outside the releases and kernels AMD's matrix lists for it: dies), the existing /etc/apt/sources.list.d/amdrocm-stable.sources (other content: dies). Then "prepare_host", "install_helpers", the key to /etc/apt/keyrings/amdrocm.gpg ("install_key" in Rex::GPU::AMD::Setup), the deb822 source AMD documents, "refresh_index", apt-get install of the extra and target packages, and every one must pass "verify_packages" and be installed at the release.

SEE ALSO

Rex::GPU::AMD::Setup, Rex::GPU::AMD

SUPPORT

Issues

Please report bugs and feature requests at https://github.com/Getty/rex-gpu/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.