Air-Gapped GPU Driver Installation
Untangling the Dependency Graph
Goal
From a package bundle assumed to have been imported, you resolve the dependency graph, find the dependencies that are not resolved inside the bundle, and produce the installation order.
Why it matters
The most expensive mistake in an air-gapped network is "we imported it but the dependencies were insufficient, so it has to go out again." If import review is once a day, one round trip is a day. So before importing, you must check whether the bundle closes within itself (closure). And if you do not know the Provides relationship, you end up wandering around searching for a nonexistent package, saying "libcuda1 is not in the repository."
/opt/fixtures/gpu-airgap/src/ holds the source tree of the first import batch. It is not actual NVIDIA software, but the shape of the dependency graph is the same as the real one.
Steps
- Create the
/root/gpudirectory, and write the이름 버전(the fields are the name and the version) of every package under/opt/fixtures/gpu-airgap/src/, one per line, in/root/gpu/inventory.txt. It must be 14 lines. - Build every source directory into a
.deband collect them in/root/gpu/pool/. There must be 14.debfiles. - Create a
Packagesindex andPackages.gzin/root/gpu/pool. The index must have 14Package:entries. - Write the dependency relationships of each package, one per line, in
/root/gpu/edges.txtin the form<패키지> <의존대상>(the placeholders are the package and the dependency target). Omit version conditions and write only names. It must be at least 15 lines. - In
/root/gpu/missing.txt, write only the names of dependencies that are not resolved inside the bundle. (Those for which there is no package of that name in the bundle, and no package in the bundleProvidesit) - Sort all the packages needed to install
nvidia-driver-550so that dependencies come first, and write them one per line in/root/gpu/install-order.txt. It must be 11 lines. - Write, in a single line in
/root/gpu/provides.txt, the name of the package that provides the virtual packagelibcuda1. - Make
/root/gpu/report.txtwith the following 5 lines.BUNDLE=14/EDGES=<4번 파일의 줄 수>/MISSING=<5번 파일의 줄 수>/ORDER=11/LIBCUDA1_BY=<7번 값>(the placeholders are the line count of the file from step 4, the line count of the file from step 5, and the value from step 7)
Notes
- Repeat the build in the form
for d in /opt/fixtures/gpu-airgap/src/*/; do dpkg-deb --build "$d" /root/gpu/pool/ ; done. - To read the control fields, use
dpkg-deb -f <deb> Depends(the placeholder is the deb file) or readDEBIAN/controlin the source tree directly. - The Depends string has the form
pkg-a (= 1.0), pkg-b (>= 2.0). Split on commas and remove the parentheses. - The 11 in step 6 are
nvidia-driver-550itself and all of its transitive dependencies. The toolkit side is not included. - Common mistake 1: in step 5, including something like
libc6that is already installed on the system. The packages of this bundle are made so as not to depend on system packages. - Common mistake 2: in step 6, sorting alphabetically. It must be in dependency order.
List the import bundle
Create the /root/gpu directory, and write the 이름 버전 (the fields are the name and the version) of every package under /opt/fixtures/gpu-airgap/src/, one per line, in /root/gpu/inventory.txt. It must be 14 lines.
Extract Package and Version from DEBIAN/control in each source directory.
Build all the packages
Build every source directory into a .deb and collect them in /root/gpu/pool/. There must be 14 .deb files.
Repeat dpkg-deb --build for each directory. Handle it all at once with a shell loop.
Create the repository index
Create a Packages index and Packages.gz in /root/gpu/pool. The index must have 14 Package: entries.
It is the same method as used in the earlier course. The number of Package entries must equal the number of packages built.
Dependency edge list
Write the dependency relationships of each package, one per line, in /root/gpu/edges.txt in the form <패키지> <의존대상> (the placeholders are the package and the dependency target). Omit version conditions and write only names. It must be at least 15 lines.
If you split the Depends field on commas and strip the parentheses of the version conditions, only the dependency target names remain.
Find the dependencies that do not close
In /root/gpu/missing.txt, write only the names of dependencies that are not resolved inside the bundle. (Those for which there is no package of that name in the bundle, and no package in the bundle Provides it)
Among the targets of the edges, find the names that are not in the bundle and are not satisfied by Provides either. Exclude what is already installed on the system.
Produce the installation order
Sort all the packages needed to install nvidia-driver-550 so that dependencies come first, and write them one per line in /root/gpu/install-order.txt. It must be 11 lines.
Dependencies must come first. Do the topological sort by hand or with a script.
Trace the virtual package
Write, in a single line in /root/gpu/provides.txt, the name of the package that provides the virtual package libcuda1.
If you look at the Provides field of the control files, it shows which package provides that name.
Dependency analysis report
Make /root/gpu/report.txt with the following 5 lines.
BUNDLE=14 / EDGES=<4번 파일의 줄 수> / MISSING=<5번 파일의 줄 수> / ORDER=11 / LIBCUDA1_BY=<7번 값> (the placeholders are the line count of the file from step 4, the line count of the file from step 5, and the value from step 7)
Just gather the counts and names from the results of the earlier steps.