Skip to content

Commit 9ce323c

Browse files
committed
extensions/nvidia: refresh chroot apt indices before pkgnames lookup
apt-cache pkgnames reads from /var/cache/apt/pkgcache.bin, which is built from /var/lib/apt/lists/. If the rootfs was cached before `restricted` was added to ubuntu.sources, or if the framework hasn't run `apt-get update` since the final sources.list was finalized, the indices for the restricted component are simply absent - and pkgnames returns nothing for nvidia-dkms-*, even though sources.list lists the component. Verified locally that on a stale chroot the pkgnames pipeline returns empty; after `apt-get update`, it returns the full nvidia-dkms-N set. `apt-get update -qq || true`: quiet on success, doesn't abort the build if the proxy hiccups or one of the suite indices fails (apt returns non-zero on partial failures).
1 parent cdc2356 commit 9ce323c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

extensions/nvidia.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ function post_install_kernel_debs__build_nvidia_kernel_module() {
4848
display_alert "Using pinned NVIDIA_DRIVER_VERSION" "${NVIDIA_DRIVER_VERSION}" "info"
4949
else
5050
local latest pkgnames_raw sources_files sources_has_restricted apt_lists_sample
51+
# Refresh the chroot's apt indices first. The rootfs cache may
52+
# have been built before `restricted` was added to sources, or
53+
# the framework may not have run `apt-get update` since the
54+
# final sources.list was written. Without fresh indices,
55+
# `apt-cache pkgnames` returns nothing for restricted-only
56+
# packages (nvidia-dkms-*) even when sources.list lists the
57+
# component. Idempotent and quick if indices are already current.
58+
display_alert "Refreshing apt indices in chroot" "${EXTENSION}" "debug"
59+
chroot_sdcard "apt-get update -qq" || true
60+
5161
# chroot_sdcard wraps the inner command with `bash -e -o
5262
# pipefail -c …`, so this pipeline returns 1 when grep finds
5363
# no numbered nvidia-dkms-N packages (Debian / fall-through

0 commit comments

Comments
 (0)