Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Prepare preview 13 with offline NVIDIA drivers and preserved update context (#742)

Dee57c6ce031ea1
diff --git a/.github/workflows/os-nvidia.yml b/.github/workflows/os-nvidia.yml
new file mode 100644
index 000000000..f1b4c8e6d
--- /dev/null
+++ b/.github/workflows/os-nvidia.yml
@@ -0,0 +1,81 @@
+name: Harness OS offline NVIDIA installation
+
+on:
+ workflow_dispatch:
+ inputs:
+ image_run_id:
+ description: 'Verified reference image for focused candidate testing'
+ type: string
+ default: '37222390225'
+ required: true
+
+permissions:
+ contents: read
+ actions: read
+
+concurrency:
+ group: harness-nvidia-install-${{ github.ref }}
+ cancel-in-progress: false
+
+jobs:
+ nvidia:
+ runs-on: ubuntu-24.04
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/download-artifact@v6
+ with:
+ name: programmer-os-x86_64
+ path: os/dist
+ run-id: ${{ inputs.image_run_id || '37222390225' }}
+ github-token: ${{ github.token }}
+ - name: Check source and reference inventory
+ run: |
+ make -C os check
+ go run github.com/rhysd/actionlint/cmd/[email protected] .github/workflows/os-nvidia.yml
+ python3 - <<'PY'
+ import hashlib, json
+ from pathlib import Path
+ dist = Path('os/dist')
+ manifest = json.loads((dist / 'manifest.json').read_text())
+ lock = json.loads(Path('os/lock.json').read_text())
+ iso = next(dist.glob('*.iso'))
+ with iso.open('rb') as handle:
+ assert hashlib.file_digest(handle, 'sha256').hexdigest() == manifest['iso']['sha256']
+ assert iso.stat().st_size == manifest['iso']['bytes']
+ assert manifest['arch_snapshot'] == lock['arch_snapshot']
+ snapshot = lock['arch_snapshot']
+ text = '[options]\nArchitecture = x86_64\nSigLevel = Required DatabaseOptional\n'
+ for repo in ['core', 'extra']:
+ text += f'[{repo}]\nServer = https://archive.archlinux.org/repos/{snapshot}/$repo/os/$arch\n'
+ Path('os/dist/nvidia-pacman.conf').write_text(text)
+ PY
+ - name: Build signed offline cache in an isolated Arch root
+ run: |
+ docker run --rm --privileged -v "$PWD:/src" -w /src archlinux:base-devel bash -euc '
+ pacman -Syu --noconfirm archlinux-keyring arch-install-scripts python
+ python3 os/tools/build-nvidia.py --config os/dist/nvidia-pacman.conf \
+ --base-packages os/dist/packages.txt --work os/work/nvidia-build --output os/work/nvidia-bundle
+ tar -cf os/dist/nvidia-bundle.tar -C os/work/nvidia-bundle .
+ cp os/work/nvidia-bundle/manifest.json os/dist/nvidia-bundle-manifest.json
+ '
+ - name: Install native VM tools
+ run: |
+ sudo apt-get update -qq
+ sudo apt-get install -y --no-install-recommends qemu-system-x86 qemu-utils ovmf python3-pil tesseract-ocr
+ sudo chmod a+rw /dev/kvm
+ - name: Prove offline package authentication, selection, installation and encrypted reboot
+ run: python3 os/tests/nvidia_install_vm.py --iso os/dist/*.iso --candidate-bundle os/dist/nvidia-bundle.tar
+ - name: Retain native evidence without virtual disks or duplicate packages
+ if: always()
+ uses: actions/upload-artifact@v6
+ with:
+ name: harness-os-nvidia-install
+ path: |
+ os/test-results/nvidia-install/
+ !os/test-results/nvidia-install/*.qcow2
+ !os/test-results/nvidia-install/OVMF_VARS.fd
+ !os/test-results/nvidia-install/served/bundle.tar
+ os/dist/nvidia-bundle-manifest.json
+ retention-days: 14
+ compression-level: 0
diff --git a/.github/workflows/os.yml b/.github/workflows/os.yml
index 1e61ada2f..25298b130 100644
--- a/.github/workflows/os.yml
+++ b/.github/workflows/os.yml
@@ -266,6 +266,39 @@ jobs:
retention-days: 14
compression-level: 0
+ nvidia:
+ needs: image
+ if: ${{ always() && !inputs.publish_run_id && !inputs.development_update && (needs.image.result == 'success' || inputs.checks == 'hardware' && inputs.image_run_id != '') && !cancelled() }}
+ runs-on: ubuntu-24.04
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/download-artifact@v6
+ with:
+ name: programmer-os-x86_64
+ path: os/dist
+ run-id: ${{ inputs.image_run_id || github.run_id }}
+ github-token: ${{ github.token }}
+ - name: Check the fixture and install VM tools
+ run: |
+ python3 -m py_compile os/tests/nvidia_install_guest.py os/tests/nvidia_install_vm.py
+ sudo apt-get update -qq
+ sudo apt-get install -y --no-install-recommends qemu-system-x86 qemu-utils ovmf python3-pil tesseract-ocr
+ sudo chmod a+rw /dev/kvm
+ - name: Install the selected NVIDIA driver offline and reboot encrypted
+ run: python3 os/tests/nvidia_install_vm.py --iso os/dist/*.iso
+ - name: Retain exact-image NVIDIA installation evidence
+ if: always()
+ uses: actions/upload-artifact@v6
+ with:
+ name: harness-os-nvidia-install
+ path: |
+ os/test-results/nvidia-install/
+ !os/test-results/nvidia-install/*.qcow2
+ !os/test-results/nvidia-install/OVMF_VARS.fd
+ retention-days: 14
+ compression-level: 0
+
essentials:
needs: image
if: ${{ always() && inputs.checks == 'essentials' && !inputs.publish_run_id && !inputs.development_update && (needs.image.result == 'success' || inputs.image_run_id != '') && !cancelled() }}
diff --git a/os/INSTALL.md b/os/INSTALL.md
index 33dc4982a..021b5d9dc 100644
--- a/os/INSTALL.md
+++ b/os/INSTALL.md
@@ -1,6 +1,6 @@
# Install Harness on a ThinkPad
-These instructions are for **0.1.0-preview.12**, using a Mac to prepare the USB.
+These instructions are for **0.1.0-preview.13**, using a Mac to prepare the USB.
The USB opens the installer directly. Installation begins only when you choose **Install Harness**
in the installer; it erases the entire selected disk.
@@ -21,20 +21,20 @@ compute still need testing on the actual hardware.
## 2. Download and verify on the Mac
-From the [preview 12 release](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.12),
+From the [preview 13 release](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.13),
download both files into the same folder:
-- `harness-0.1.0-preview.12-x86_64.iso`
-- `harness-0.1.0-preview.12-x86_64.iso.sha256`
+- `harness-0.1.0-preview.13-x86_64.iso`
+- `harness-0.1.0-preview.13-x86_64.iso.sha256`
If they are in Downloads, open Terminal and run:
```sh
cd ~/Downloads
-shasum -a 256 -c harness-0.1.0-preview.12-x86_64.iso.sha256
+shasum -a 256 -c harness-0.1.0-preview.13-x86_64.iso.sha256
```
-The result must say `harness-0.1.0-preview.12-x86_64.iso: OK`.
+The result must say `harness-0.1.0-preview.13-x86_64.iso: OK`.
If it does not, download the files again before flashing.
## 3. Flash the USB
diff --git a/os/README.md b/os/README.md
index 1cfe632de..321ea5a97 100644
--- a/os/README.md
+++ b/os/README.md
@@ -32,7 +32,7 @@ a confirmation or password prompt. Running agents and terminals stay alive.
The update checker records release ancestry so a source-built runtime cannot be
replaced by an older public CLI with a higher development version number.
-[Download preview 12](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.12)
+[Download preview 13](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.13)
· [Mac → USB → ThinkPad installation guide](INSTALL.md)
· [Standalone HTML/CSS landing page](../website/public/os/README.md)
· [Development feedback loop and Mac support targets](DEVELOPMENT.md)
@@ -232,16 +232,32 @@ This initial recovery path requires the USB; it is not an automatic boot fallbac
## NVIDIA and local AI
-The small base image carries Intel/AMD graphics and Linux firmware. NVIDIA's
-compute driver is installed on demand with
-`sudo pacman -S --needed nvidia-open-lts nvidia-utils`, followed by
-`sudo mkinitcpio -P` and a reboot. These are the matching packages for the included
-LTS kernel and supported Turing-or-newer GPUs, including the intended RTX targets.
+The base package set carries Intel/AMD graphics and Linux firmware. Image builds
+with the `nvidia-offline` capability also carry signed, snapshot-matched NVIDIA
+packages on the USB. During installation, exact PCI IDs from the packaged current
+support table select `nvidia-open-lts` and `nvidia-utils` for supported GPUs.
+The installer configures early display modules and firmware for encrypted boot.
+The compressed cache is excluded from the disk copy; generic installations gain
+no NVIDIA packages, boot settings or package cache. No compiler or DKMS is needed.
+
+If any NVIDIA display needs a legacy driver, or is already assigned to VFIO, the
+installer leaves the GPU configuration alone. Existing installations made with
+older images can install `nvidia-open-lts nvidia-utils` from the same repository
+snapshot, regenerate initramfs with `sudo mkinitcpio -P`, and reboot. Updating the
+OS does not silently change their GPU driver. The current open modules support
+Turing and newer; older GPUs need a separate driver assessment.
See [Arch's package](https://archlinux.org/packages/extra/x86_64/nvidia-open-lts/)
and [NVIDIA's supported GPUs](https://github.com/NVIDIA/open-gpu-kernel-modules).
No NVIDIA hardware validation has been performed yet. Verify `nvidia-smi` and the
actual AI workload on each physical machine before treating it as supported.
+`os/tests/nvidia_install_vm.py` exercises offline installation, damaged archive
+and signature rejection, unchanged base packages, early modules/GSP firmware,
+encrypted reboot, keyboard input and a browser on a virtual GPU. PCI discovery
+uses explicit fixtures; none of those checks establishes physical rendering,
+CUDA, sleep/wake or local-agent performance. The publication gate requires this
+evidence from the exact ISO and separate generic-install exclusion checks.
+
OpenCode is bundled; other agent executables are installed through hn's existing
engine install recipes when selected. Accounts, API credentials and model downloads are supplied by the
owner. System guidance for agents lives at `/usr/share/harness-os/AGENTS.md`.
diff --git a/os/build.sh b/os/build.sh
index 3bb0bc92c..323078ac1 100644
--- a/os/build.sh
+++ b/os/build.sh
@@ -49,6 +49,9 @@ repo-add "$BUILD_DIR/repo/harness-build.db.tar.gz" "$BUILD_DIR/repo/"*.pkg.tar.g
python3 tools/build-hardware.py --config "$PROFILE/pacman.conf" \
--work "$BUILD_DIR/hardware-build" \
--output "$PROFILE/airootfs/usr/share/harness-os/hardware/broadcom"
+python3 tools/build-nvidia.py --config "$PROFILE/pacman.conf" \
+ --work "$BUILD_DIR/nvidia-build" \
+ --output "$PROFILE/airootfs/usr/share/harness-os/hardware/nvidia"
cp -a live/. "$PROFILE/airootfs/"
mkdir -p "$PROFILE/airootfs/root" "$PROFILE/airootfs/etc/pacman.d/hooks"
cp tools/customize-live.sh "$PROFILE/airootfs/root/setup-live.sh"
diff --git a/os/hardware.py b/os/hardware.py
index 7b959b31d..9e47457b2 100644
--- a/os/hardware.py
+++ b/os/hardware.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-"""Small, on-demand hardware diagnosis and selected Broadcom Wi-Fi preparation."""
+"""On-demand hardware diagnosis and selected offline Wi-Fi/GPU preparation."""
import argparse
import fcntl
import hashlib
@@ -18,6 +18,7 @@ import tempfile
# https://wireless.docs.kernel.org/en/latest/en/users/drivers/b43.html
BROADCOM_IDS = {'14e4:4331': 'BCM4331', '14e4:43a0': 'BCM4360'}
BUNDLE = Path('/usr/share/harness-os/hardware/broadcom')
+NVIDIA_BUNDLE = Path('/usr/share/harness-os/hardware/nvidia')
PCI_NAME = re.compile(r'[0-9a-f]{4,8}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-7]')
@@ -77,7 +78,98 @@ def report(sysfs=Path('/sys'), proc=Path('/proc')):
'available': 'sse4_2' in flags.split() if flags is not None else None},
'pci': pci_devices(sysfs),
'backlights': [p.name for p in sorted((sysfs / 'class/backlight').glob('*'))],
- 'broadcom_bundle_available': (BUNDLE / 'manifest.json').is_file()}
+ 'broadcom_bundle_available': (BUNDLE / 'manifest.json').is_file(),
+ 'nvidia_bundle_available': (NVIDIA_BUNDLE / 'manifest.json').is_file()}
+
+
+def nvidia_bundle_manifest(folder, all_files=False):
+ manifest = json.loads((folder / 'manifest.json').read_text())
+ if manifest.get('schema') != 1 or manifest.get('driver') != 'nvidia-open' or manifest.get('architecture') != 'x86_64':
+ raise ValueError('Unsupported NVIDIA bundle.')
+ supported = manifest.get('supported_devices', {})
+ if not supported or any(not re.fullmatch(r'10de:[0-9a-f]{4}', key) or not isinstance(value, list) or
+ not value or any(not isinstance(name, str) or not name for name in value)
+ for key, value in supported.items()):
+ raise ValueError('Invalid NVIDIA support table.')
+ if not re.fullmatch(r'\d+\.\d+\.\d+', manifest.get('driver_version', '')):
+ raise ValueError('Invalid NVIDIA driver version.')
+ if all_files:
+ for name, expected in manifest.get('files', {}).items():
+ relative = Path(name)
+ if relative.is_absolute() or '..' in relative.parts or len(relative.parts) > 2:
+ raise ValueError('Invalid NVIDIA bundle path.')
+ path = folder / name
+ if path.is_symlink() or not path.resolve().is_relative_to(folder.resolve()):
+ raise ValueError('NVIDIA bundle files must stay inside their directory.')
+ if not path.is_file() or path.stat().st_size != expected['bytes'] or digest(path) != expected['sha256']:
+ raise ValueError('NVIDIA bundle checksum mismatch: ' + name)
+ return manifest
+
+
+def nvidia_selection(devices, supported):
+ cards = [d for d in devices if d['id'].startswith('10de:') and d['class'] in {'030000', '030200'}]
+ if not cards:
+ return None
+ # nvidia-utils blacklists nouveau globally. Do not break a second legacy
+ # NVIDIA display, or take over a GPU explicitly assigned to passthrough.
+ if any(card['id'] not in supported for card in cards):
+ return {'status': 'unchanged', 'reason': 'An NVIDIA GPU needs a different driver.'}
+ if any(card['driver'] not in {None, 'nouveau', 'nvidia'} for card in cards):
+ return {'status': 'unchanged', 'reason': 'Keep the existing GPU assignment.'}
+ return {'status': 'selected', 'devices': [card['id'] for card in cards]}
+
+
+def configure_nvidia_install(target, devices, bundle=NVIDIA_BUNDLE):
+ target = target.resolve()
+ if target == Path('/') or not target.is_mount() or not (target / 'etc/harness-live').is_file():
+ raise ValueError('GPU preparation requires the mounted installation image.')
+ if not any(d['id'].startswith('10de:') and d['class'] in {'030000', '030200'} for d in devices):
+ return None
+ manifest = nvidia_bundle_manifest(bundle)
+ selected = nvidia_selection(devices, manifest['supported_devices'])
+ if selected['status'] != 'selected':
+ return selected
+ manifest = nvidia_bundle_manifest(bundle, all_files=True)
+ lock = json.loads((target / 'usr/share/harness-os/lock.json').read_text())
+ if manifest['arch_snapshot'] != lock['arch_snapshot']:
+ raise ValueError('NVIDIA bundle and installed package snapshot differ.')
+ output = run('arch-chroot', target, 'pacman', '-Q', *manifest['base_packages'], capture=True)
+ if dict(line.split(' ', 1) for line in output.splitlines()) != manifest['base_packages']:
+ raise ValueError('NVIDIA dependencies differ from the validated base.')
+ names = sorted(manifest['packages'])
+ if not names or any(not re.fullmatch(r'[a-zA-Z0-9_+.:\-]+\.pkg\.tar\.zst', name) for name in names):
+ raise ValueError('Invalid offline NVIDIA package list.')
+ for name in names:
+ if 'packages/' + name not in manifest['files'] or 'packages/' + name + '.sig' not in manifest['files']:
+ raise ValueError('Offline NVIDIA packages require signatures.')
+ # Read directly from the live USB. Neither generic nor GPU installations
+ # copy this large compressed package cache into their permanent filesystem.
+ with tempfile.TemporaryDirectory(prefix='harness-gpu-', dir=target / 'var/tmp') as temporary:
+ folder = Path(temporary)
+ packages = folder / 'packages'
+ packages.mkdir()
+ config = folder / 'pacman.conf'
+ config.write_text('[options]\nArchitecture = auto\nCheckSpace\nSigLevel = Required\nLocalFileSigLevel = Required\n')
+ config.chmod(0o600)
+ run('mount', '--bind', bundle / 'packages', packages)
+ try:
+ run('mount', '-o', 'remount,bind,ro', packages)
+ prefix = '/' + str(packages.relative_to(target))
+ run('arch-chroot', target, 'pacman', '--config', '/' + str(config.relative_to(target)),
+ '-U', '--needed', '--noconfirm', *[prefix + '/' + name for name in names], timeout=600)
+ finally:
+ run('umount', packages)
+ for module in ['nvidia', 'nvidia_modeset', 'nvidia_uvm', 'nvidia_drm']:
+ magic = run('arch-chroot', target, 'modinfo', '-k', manifest['kernel'], '-F', 'vermagic', module, capture=True)
+ version = run('arch-chroot', target, 'modinfo', '-k', manifest['kernel'], '-F', 'version', module, capture=True)
+ if magic.split()[0] != manifest['kernel'] or version != manifest['driver_version']:
+ raise ValueError('Installed NVIDIA modules do not match the kernel and userspace.')
+ config = target / 'etc/mkinitcpio.conf.d/30-harness-nvidia.conf'
+ config.parent.mkdir(parents=True, exist_ok=True)
+ config.write_text('# Display driver must be ready for disk unlock and the Harness session.\n'
+ 'MODULES+=(nvidia nvidia_modeset nvidia_drm)\n')
+ return dict(selected, status='installed', driver='nvidia-open-lts',
+ kernel=manifest['kernel'], driver_version=manifest['driver_version'], packages=manifest['packages'])
def bundle_manifest(folder, all_files=False):
@@ -147,7 +239,8 @@ def configure_install(target, devices=None):
# It must never install a compiler into the running live overlay by mistake.
if target == Path('/') or not target.is_mount() or not (target / 'etc/harness-live').is_file():
raise ValueError('Wi-Fi preparation requires the mounted installation image.')
- selected = [d for d in (pci_devices() if devices is None else devices) if needs_broadcom(d)]
+ devices = pci_devices() if devices is None else devices
+ selected = [d for d in devices if needs_broadcom(d)]
folder = target / BUNDLE.relative_to('/')
result = {'drivers': [], 'devices': [d['id'] for d in selected]}
if selected:
@@ -178,6 +271,12 @@ def configure_install(target, devices=None):
# The USB keeps the offline cache; the installed computer does not. Unrelated
# machines receive neither wl nor its compiler/kernel-header dependencies.
shutil.rmtree(folder, ignore_errors=False)
+ nvidia = configure_nvidia_install(target, devices)
+ if nvidia is not None:
+ result['nvidia'] = nvidia
+ if nvidia['status'] == 'installed':
+ result['drivers'].append(nvidia['driver'])
+ result['devices'].extend(nvidia['devices'])
state = target / 'var/lib/harness-os/hardware.json'
state.parent.mkdir(parents=True, exist_ok=True)
state.write_text(json.dumps(result, indent=2) + '\n')
diff --git a/os/installer.py b/os/installer.py
index dda79ae17..8b8e4587d 100644
--- a/os/installer.py
+++ b/os/installer.py
@@ -280,6 +280,13 @@ def preserve_trial(trial, target, home):
return {key: value for key, value in receipt.items() if key != 'entries'}
+def copy_image(source, target):
+ # Bound extraction memory and skip the optional GPU archive cache entirely.
+ # Selected hardware reads its signed packages directly from the live USB.
+ run('unsquashfs', '-mem', '64M', '-f', '-no-progress', '-excludes', '-d', target, source,
+ 'usr/share/harness-os/hardware/nvidia')
+
+
def install(config, source, target, progress=None):
report = progress or (lambda message: print(message, flush=True))
validate_config(config)
@@ -337,7 +344,7 @@ def install(config, source, target, progress=None):
report('Copying Harness…')
# Unsquashfs defaults to 512 MiB of caches. Bound them so installation
# still fits on a 1 GiB machine after trying the bundled agent/browser.
- run('unsquashfs', '-mem', '64M', '-f', '-no-progress', '-d', target, source)
+ copy_image(source, target)
# Extract on Btrfs first: FAT cannot represent the image's Unix metadata.
# Copy boot contents without that metadata before regenerating initramfs.
boot_staging = target / 'boot.from-image'
diff --git a/os/live_update.py b/os/live_update.py
index b02a24354..8141a2cbd 100644
--- a/os/live_update.py
+++ b/os/live_update.py
@@ -369,6 +369,54 @@ def restart(cli_changed):
run('systemctl', '--user', 'is-active', '--quiet', 'hn-screen.service')
+def capture_view():
+ """Remember the OS screen, without selecting an unrelated SSH client."""
+ try:
+ rows = run('/usr/bin/hn', 'list-clients', '-F',
+ '#{client_pid}\t#{session_id}\t#{window_id}\t#{pane_id}\t#{client_tty}', timeout=3)
+ for row in rows.splitlines():
+ parts = row.split('\t')
+ if len(parts) != 5 or not parts[0].isdigit():
+ continue
+ groups = Path('/proc') / parts[0] / 'cgroup'
+ try:
+ belongs = any(line.split(':', 2)[-1].endswith('/hn-screen.service')
+ for line in groups.read_text().splitlines())
+ except OSError:
+ continue
+ if not belongs:
+ continue
+ if all(re.fullmatch(pattern, value) for pattern, value in
+ zip([r'\$\d+', r'@\d+', r'%\d+', r'/dev/pts/\d+'], parts[1:])):
+ return dict(zip(['session', 'window', 'pane', 'tty'], parts[1:]))
+ except (OSError, subprocess.SubprocessError):
+ pass
+ return None
+
+
+def restore_view(view):
+ if view is None:
+ return
+ for name, pattern in [('session', r'\$\d+'), ('window', r'@\d+'), ('pane', r'%\d+')]:
+ if not isinstance(view, dict) or not isinstance(view.get(name), str) or not re.fullmatch(pattern, view[name]):
+ raise ValueError('Invalid saved Harness screen selection.')
+ # A task may finish while the screen reconnects. Restore only objects that
+ # still exist, without resurrecting a closed terminal or creating a session.
+ sessions = run('/usr/bin/hn', 'list-sessions', '-F', '#{session_id}').splitlines()
+ if view['session'] not in sessions:
+ return
+ current = capture_view()
+ if current is None:
+ return
+ run('/usr/bin/hn', 'switch-client', '-c', current['tty'], '-t', view['session'])
+ windows = run('/usr/bin/hn', 'list-windows', '-t', view['session'], '-F', '#{window_id}').splitlines()
+ if view['window'] in windows:
+ run('/usr/bin/hn', 'select-window', '-t', view['window'])
+ panes = run('/usr/bin/hn', 'list-panes', '-t', view['window'], '-F', '#{pane_id}').splitlines()
+ if view['pane'] in panes:
+ run('/usr/bin/hn', 'select-pane', '-t', view['pane'])
+
+
def screen_ready(target):
"""Wait for an attached client executing the selected binary, not just foot."""
deadline = time.monotonic() + 30
@@ -414,6 +462,7 @@ def recover_interrupted():
# Restore its known runtime even if a power cut lost its final receipt.
restart(True)
screen_ready(previous)
+ restore_view(transaction.get('view'))
write(STATE / 'transaction.json', {'status': 'interrupted', 'previous': str(previous)})
@@ -436,15 +485,19 @@ def apply(rollback=False):
else:
candidate = versions(BUNDLED)
old = versions(previous)
- write(STATE / 'transaction.json', {'previous': str(previous), 'target': str(target), 'status': 'applying'})
+ view = capture_view()
+ write(STATE / 'transaction.json', {'previous': str(previous), 'target': str(target), 'status': 'applying', 'view': view})
select(target)
try:
restart(candidate['cli'] != old['cli'])
screen_ready(target)
+ restore_view(view)
except BaseException:
select(previous)
write(STATE / 'transaction.json', {'status': 'failed', 'previous': str(previous)})
restart(candidate['cli'] != old['cli'])
+ screen_ready(previous)
+ restore_view(view)
notice('Update failed · Super+u')
raise
write(STATE / 'applied.json', {'previous': str(previous), 'current': str(target), 'at': time.time()})
diff --git a/os/lock.json b/os/lock.json
index 3b92e9d2c..6802652da 100644
--- a/os/lock.json
+++ b/os/lock.json
@@ -1,8 +1,12 @@
{
- "version": "0.1.0-preview.12",
+ "version": "0.1.0-preview.13",
"arch_snapshot": "2026/10/01",
"architecture": "x86_64",
"upgrades_from": [
+ {
+ "version": "0.1.0-preview.12",
+ "arch_snapshot": "2026/10/01"
+ },
{
"version": "0.1.0-preview.11",
"arch_snapshot": "2026/10/01"
diff --git a/os/root/usr/share/harness-os/AGENTS.md b/os/root/usr/share/harness-os/AGENTS.md
index b6f47dada..87e567621 100644
--- a/os/root/usr/share/harness-os/AGENTS.md
+++ b/os/root/usr/share/harness-os/AGENTS.md
@@ -68,9 +68,14 @@ is required.
`Super+l` locks the screen. `sudo systemctl poweroff` shuts down cleanly.
- On supported NVIDIA Turing and newer GPUs, including RTX 4090/5090 and RTX 6000
generations, the LTS-kernel packages are `nvidia-open-lts nvidia-utils`.
- Install both from the same repository snapshot, regenerate initramfs with
- `sudo mkinitcpio -P`, reboot, and verify `nvidia-smi` before claiming GPU compute
- works. Older NVIDIA GPUs need a different driver assessment.
+ New USB images carrying the NVIDIA bundle install them offline when the exact
+ GPU IDs match the bundled support table. Check `pacman -Q` and
+ `/var/lib/harness-os/hardware.json` before installing anything. Other machines
+ receive no NVIDIA packages. Mixed legacy GPUs and passthrough assignments are
+ left alone. On older installations, install both from the same repository
+ snapshot, regenerate initramfs with `sudo mkinitcpio -P`, and reboot. Verify
+ `nvidia-smi` and the actual workload before claiming GPU compute works.
+ Older NVIDIA GPUs need a different driver assessment.
- CUDA SDKs, model weights and model servers are installed only when a task needs
them. A driver working is not evidence that a particular AI framework supports
the GPU; test the actual framework and workload.
diff --git a/os/tests/fast_update_vm.py b/os/tests/fast_update_vm.py
index 0244347e9..2b2032cc4 100644
--- a/os/tests/fast_update_vm.py
+++ b/os/tests/fast_update_vm.py
@@ -68,6 +68,7 @@ def exercise(vm, fixture, host_url):
vm.command('hn new-window -n live-agent opencode')
vm.command('for n in $(seq 1 80); do pgrep -u 1000 -x opencode > /tmp/fast-original-agent && exit 0; sleep .25; done; exit 1')
vm.command('cat /proc/sys/kernel/random/boot_id > /tmp/fast-original-boot')
+ vm.command('hn hn-list-clients -F "#{session_id}" > /tmp/fast-visible-session')
vm.command('mkdir -p ~/.config/systemd/user/harness-update.service.d ~/.config/systemd/user/harness-update.timer.d')
put(vm, '/tmp/update-service.conf', '[Service]\nExecStart=\nExecStart=/usr/bin/python3 /usr/lib/harness-os/live_update.py check --feeds /tmp/fast-updates/feeds-hn.json\n')
# systemd's default AccuracySec=1min can coalesce the one-second fixture
@@ -111,6 +112,8 @@ assert (root/'heartbeat').stat().st_mtime_ns != before
vm.command('python3 -c ' + shlex.quote(expression))
vm.command('while read -r pid; do kill -0 "$pid" || exit 1; done < /tmp/fast-original-agent; '
'cmp /tmp/fast-original-boot /proc/sys/kernel/random/boot_id')
+ vm.command('hn hn-list-clients -F "#{session_id}" > /tmp/fast-restored-session; '
+ 'cmp /tmp/fast-visible-session /tmp/fast-restored-session')
vm.command('for n in $(seq 1 80); do hn select-window -t update-probe && exit 0; sleep .25; done; exit 1')
wait_text(vm, 'visible lock probe', name + '-restored')
vm.type_probe(name)
diff --git a/os/tests/nvidia_install_guest.py b/os/tests/nvidia_install_guest.py
new file mode 100644
index 000000000..814118d0b
--- /dev/null
+++ b/os/tests/nvidia_install_guest.py
@@ -0,0 +1,130 @@
+#!/usr/bin/env python3
+"""Real offline installation with only PCI discovery replaced by GPU fixtures."""
+import importlib.util
+import json
+from pathlib import Path
+import subprocess
+import tempfile
+import time
+
+
+def load(name, path):
+ spec = importlib.util.spec_from_file_location(name, path)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
+
+def main():
+ hardware = load('hardware', '/usr/lib/harness-os/hardware.py')
+ installer = load('installer', '/usr/lib/harness-os/install.py')
+ assert subprocess.check_output(['nmcli', 'networking'], text=True).strip() == 'disabled'
+ config = dict(disk='/dev/vda', expected_serial='HN_OS_TEST', confirm_erase='/dev/vda',
+ username='me', hostname='harness', password='test-password-123',
+ encrypt=True, serial_console=True)
+ installer.selected_disk(config)
+ bundle = hardware.nvidia_bundle_manifest(hardware.NVIDIA_BUNDLE, all_files=True)
+ # Exercise the actual extraction flags, including directories beside the cache.
+ with tempfile.TemporaryDirectory(prefix='harness-copy-', dir='/run') as temp:
+ root = Path(temp)
+ source, target = root / 'source', root / 'target'
+ gpu = source / hardware.NVIDIA_BUNDLE.relative_to('/')
+ gpu.mkdir(parents=True)
+ (gpu / 'large-cache').write_text('not installed')
+ (gpu.parent / 'preserved').write_text('other hardware')
+ (source / 'ordinary').write_text('ordinary file')
+ hardware.run('mksquashfs', source, root / 'fixture.sfs', '-noappend', '-no-progress', '-processors', '1')
+ installer.copy_image(root / 'fixture.sfs', target)
+ assert not (target / hardware.NVIDIA_BUNDLE.relative_to('/')).exists()
+ assert (target / 'usr/share/harness-os/hardware/preserved').read_text() == 'other hardware'
+ assert (target / 'ordinary').read_text() == 'ordinary file'
+
+ def card(identity, driver='nouveau'):
+ return dict(address='0000:03:00.0', id=identity, **{'class': '030000'}, driver=driver, interfaces=[])
+
+ targets = ['GeForce RTX 4090', 'GeForce RTX 5090', 'RTX 6000 Ada Generation', 'RTX PRO 6000 Blackwell']
+ identities = {name: next(key for key, names in bundle['supported_devices'].items()
+ if any(name in value for value in names)) for name in targets}
+ devices = [card(identities[targets[0]])]
+ for identity in identities.values():
+ assert hardware.nvidia_selection([card(identity)], bundle['supported_devices'])['status'] == 'selected'
+ original_run = installer.run
+ evidence = {'target_device_ids': identities, 'cache_extraction_excluded': True}
+
+ def hardware_selection(*args, **kwargs):
+ if args[:3] != ('/usr/bin/python3', '/usr/lib/harness-os/hardware.py', 'configure-install'):
+ return original_run(*args, **kwargs)
+ target = Path(args[3])
+ before = hardware.run('arch-chroot', target, 'pacman', '-Q', capture=True)
+ # Native negative rows must neither add packages nor write boot settings.
+ for fixture in [[], [card('10de:1b80')], devices + [card('10de:1b80')],
+ [card(devices[0]['id'], 'vfio-pci')]]:
+ result = hardware.configure_nvidia_install(target, fixture)
+ assert result is None or result['status'] == 'unchanged', result
+ assert hardware.run('arch-chroot', target, 'pacman', '-Q', capture=True) == before
+ assert not (target / 'etc/mkinitcpio.conf.d/30-harness-nvidia.conf').exists()
+ # A damaged archive must fail before the package transaction.
+ small = min((hardware.NVIDIA_BUNDLE / 'packages').glob('*.pkg.tar.zst'), key=lambda p: p.stat().st_size)
+ original = small.read_bytes()
+ small.write_bytes(b'corrupted-archive')
+ try:
+ hardware.configure_nvidia_install(target, devices)
+ except ValueError as error:
+ assert 'checksum' in str(error), error
+ else:
+ raise AssertionError('A damaged GPU archive was accepted')
+ finally:
+ small.write_bytes(original)
+ assert hardware.run('arch-chroot', target, 'pacman', '-Q', capture=True) == before
+ # Match the checksum of a deliberately invalid signature. Pacman itself
+ # must still reject it; a hash-only test would not prove authentication.
+ manifest_path = hardware.NVIDIA_BUNDLE / 'manifest.json'
+ original_manifest = manifest_path.read_bytes()
+ signature = small.with_name(small.name + '.sig')
+ original_signature = signature.read_bytes()
+ signature.write_bytes(b'invalid-pgp-signature')
+ changed = json.loads(original_manifest)
+ changed['files'][str(signature.relative_to(hardware.NVIDIA_BUNDLE))] = {
+ 'bytes': signature.stat().st_size, 'sha256': hardware.digest(signature)}
+ manifest_path.write_text(json.dumps(changed))
+ try:
+ hardware.configure_nvidia_install(target, devices)
+ except subprocess.CalledProcessError as error:
+ assert 'pacman' in error.cmd and '-U' in error.cmd, error
+ else:
+ raise AssertionError('Pacman accepted an invalid package signature')
+ finally:
+ signature.write_bytes(original_signature)
+ manifest_path.write_bytes(original_manifest)
+ assert hardware.run('arch-chroot', target, 'pacman', '-Q', capture=True) == before
+ assert not list((target / 'var/tmp').glob('harness-gpu-*')), 'Failed transaction leaked a package mount'
+ started = time.monotonic()
+ result = hardware.configure_install(target, devices)
+ after = hardware.run('arch-chroot', target, 'pacman', '-Q', capture=True)
+ old = dict(line.split(' ', 1) for line in before.splitlines())
+ new = dict(line.split(' ', 1) for line in after.splitlines())
+ assert all(new.get(name) == version for name, version in old.items()), 'A base package changed'
+ added = {name: version for name, version in new.items() if name not in old}
+ assert added == {value['name']: value['version'] for value in bundle['packages'].values()}, added
+ assert not (target / hardware.NVIDIA_BUNDLE.relative_to('/')).exists()
+ assert not (target / hardware.BUNDLE.relative_to('/')).exists()
+ assert not list((target / 'var/tmp').glob('harness-gpu-*'))
+ assert result['drivers'] == ['nvidia-open-lts'] and result['nvidia']['status'] == 'installed'
+ evidence.update(optional_packages=added, offline_prepare_seconds=round(time.monotonic() - started, 3),
+ corrupted_archive_rejected=True, invalid_signature_rejected=True,
+ negative_selections_unchanged=True, cache_absent=True, base_packages_unchanged=True,
+ hardware_state=result)
+ return None
+
+ installer.run = hardware_selection
+ started = time.monotonic()
+ installer.install(config, installer.live_payload(), Path('/mnt/harness-os'))
+ assert evidence.get('hardware_state'), 'The installer did not invoke hardware preparation'
+ evidence.update(status='passed', kernel=bundle['kernel'], driver_version=bundle['driver_version'],
+ installation_seconds=round(time.monotonic() - started, 3),
+ scope='Offline encrypted installation with synthetic PCI selection; no physical GPU')
+ print('HN_NVIDIA_RESULT=' + json.dumps(evidence), flush=True)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/os/tests/nvidia_install_vm.py b/os/tests/nvidia_install_vm.py
new file mode 100644
index 000000000..5099a6451
--- /dev/null
+++ b/os/tests/nvidia_install_vm.py
@@ -0,0 +1,138 @@
+#!/usr/bin/env python3
+"""Native offline NVIDIA package installation and generic encrypted-boot checks."""
+import argparse
+from functools import partial
+import hashlib
+from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
+import json
+import os
+from pathlib import Path
+import re
+import shlex
+import subprocess
+import threading
+import time
+from footprint_vm import copy_file
+from vm import VM, check_graphical_keyboard
+
+
+def digest(path):
+ with path.open('rb') as handle:
+ return hashlib.file_digest(handle, 'sha256').hexdigest()
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--iso', required=True, type=Path)
+ parser.add_argument('--candidate-bundle', type=Path, help='Focused candidate test on an older reference ISO; not release acceptance')
+ parser.add_argument('--output', type=Path, default=Path('os/test-results/nvidia-install'))
+ args = parser.parse_args()
+ assert os.access('/dev/kvm', os.R_OK | os.W_OK), 'Native x86 KVM is required'
+ iso = args.iso.resolve()
+ manifest = json.loads(iso.with_name('manifest.json').read_text())
+ assert digest(iso) == manifest['iso']['sha256'] and iso.stat().st_size == manifest['iso']['bytes']
+ assert args.candidate_bundle or 'nvidia-offline' in manifest['capabilities']
+ folder = args.output.resolve()
+ folder.mkdir(parents=True, exist_ok=False)
+ served = folder / 'served'
+ served.mkdir()
+ (served / 'browser.html').write_text('<!doctype html><html lang="en"><title>Harness check</title>'
+ '<style>body{font:32px monospace;margin:3rem}</style>'
+ '<h1>Offline driver check</h1><p>Harness preview is visible.</p></html>')
+ if args.candidate_bundle:
+ (served / 'bundle.tar').symlink_to(args.candidate_bundle.resolve())
+ server = ThreadingHTTPServer(('127.0.0.1', 0), partial(SimpleHTTPRequestHandler, directory=str(served)))
+ threading.Thread(target=server.serve_forever, daemon=True).start()
+ vm = VM(folder, iso, 'uefi', 2048, 'usb')
+ config = dict(username='me', password='test-password-123', encrypt=True)
+ receipt = dict(status='running', started_at=time.time(), iso_sha256=manifest['iso']['sha256'],
+ image_source_commit=manifest['source_commit'],
+ test_source_commit=subprocess.check_output(['git', 'rev-parse', 'HEAD'], text=True).strip(),
+ memory_mib=2048, firmware='uefi', live_transport='usb', candidate_injected=bool(args.candidate_bundle),
+ physical_gpu_validation='unavailable: no GPU passthrough')
+ try:
+ vm.start(live=True)
+ vm.wait(r'root@[^\r\n]*[#] ', timeout=180)
+ vm.shell_ready = True
+ vm.command('stty -echo')
+ if args.candidate_bundle:
+ source = Path(__file__).resolve().parents[1]
+ receipt['candidate_sha256'] = {}
+ for local, guest in [('hardware.py', 'hardware.py'), ('installer.py', 'install.py')]:
+ copy_file(vm, (source / local).read_bytes(), '/usr/lib/harness-os/' + guest)
+ receipt['candidate_sha256'][local] = digest(source / local)
+ # Stream once into the writable overlay; never store a second 325 MiB copy.
+ vm.command('nm-online -q --timeout=60 && mkdir -p /usr/share/harness-os/hardware/nvidia && '
+ 'curl --fail --silent --show-error ' + shlex.quote(f'http://10.0.2.2:{server.server_port}/bundle.tar') +
+ ' | tar -xf - -C /usr/share/harness-os/hardware/nvidia', timeout=180)
+ vm.command('nmcli networking off')
+ script = Path(__file__).with_name('nvidia_install_guest.py')
+ copy_file(vm, script.read_bytes(), '/run/nvidia-test.py')
+ receipt['guest_fixture_sha256'] = digest(script)
+ output, _ = vm.command('python3 /run/nvidia-test.py', timeout=1200)
+ (folder / 'installation.log').write_text(output)
+ match = re.search(r'HN_NVIDIA_RESULT=(\{[^\r\n]+\})', output)
+ assert match, 'Offline NVIDIA acceptance receipt is missing'
+ receipt['installation'] = json.loads(match.group(1))
+ assert receipt['installation']['status'] == 'passed'
+ vm.screenshot('01-live-install-complete')
+ vm.command('sync')
+ vm.stop()
+ vm.start(live=False)
+ vm.login_installed(config)
+ receipt['keyboard'] = check_graphical_keyboard(vm, 'nvidia-installed')
+ vm.command('printf %s ' + shlex.quote(config['password'] + '\n') + ' | sudo -S true')
+ vm.command('test ! -e /usr/share/harness-os/hardware/nvidia && test ! -e /etc/harness-live')
+ output, _ = vm.command('sudo -n lsinitcpio /boot/initramfs-linux-lts.img')
+ (folder / 'initramfs-files.txt').write_text(output)
+ for module in ['nvidia', 'nvidia_modeset', 'nvidia_drm']:
+ filename = module.replace('_', '[-_]')
+ assert re.search(r'/' + filename + r'\.ko(?:\.(?:zst|xz|gz))?(?:\s|$)', output), module
+ firmware, _ = vm.command('modinfo -F firmware nvidia')
+ # Serial shell-integration escapes may precede the first output line.
+ names = re.findall(r'nvidia/[A-Za-z0-9._/-]+', firmware)
+ assert names and all(name in output for name in names), 'GSP firmware missing from initramfs'
+ receipt['early_display_modules_and_firmware'] = 'passed'
+ output, status = vm.command('nvidia-smi', check=False)
+ assert status != 0, 'This fixture must not claim a physical GPU'
+ receipt['nvidia_smi'] = {'exit_code': status, 'output': output, 'physical_gpu_available': False}
+ output, _ = vm.command('pacman -Q nvidia-open-lts nvidia-utils; harness hardware; '
+ 'cat /var/lib/harness-os/hardware.json')
+ (folder / 'installed-hardware.txt').write_text(output)
+ vm.command('sudo -n nmcli networking on; nm-online -q --timeout=60')
+ vm.command('hn-browser ' + shlex.quote(f'http://10.0.2.2:{server.server_port}/browser.html'))
+ deadline = time.monotonic() + 45
+ while time.monotonic() < deadline:
+ vm.screenshot('02-browser-after-driver-install')
+ visible = subprocess.check_output(['tesseract', str(folder / '02-browser-after-driver-install.png'),
+ 'stdout', '--psm', '11'], text=True, stderr=subprocess.DEVNULL, timeout=10)
+ (folder / 'browser.txt').write_text(visible)
+ if 'Harness preview is visible.' in visible:
+ break
+ time.sleep(1)
+ else:
+ raise AssertionError('Chromium did not render the page after NVIDIA package installation')
+ vm.keys('meta_l', 'b')
+ receipt['return_keyboard'] = check_graphical_keyboard(vm, 'nvidia-browser-return')
+ receipt['generic_browser_after_driver_reboot'] = 'passed'
+ receipt['status'] = 'passed'
+ except BaseException as error:
+ receipt.update(status='failed', error=repr(error))
+ try:
+ vm.screenshot('failure')
+ except Exception:
+ pass
+ raise
+ finally:
+ receipt['finished_at'] = time.time()
+ (folder / 'receipt.json').write_text(json.dumps(receipt, indent=2) + '\n')
+ vm.stop()
+ server.shutdown()
+ server.server_close()
+ vm.log.close()
+ vm.stderr.close()
+ vm.control.cleanup()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/os/tests/test_live_update.py b/os/tests/test_live_update.py
index 0f17ce493..d01a0b803 100644
--- a/os/tests/test_live_update.py
+++ b/os/tests/test_live_update.py
@@ -32,6 +32,7 @@ class FastUpdates(unittest.TestCase):
patch.object(update, 'SYSTEM_LOCK', self.root / 'system.lock'),
patch.object(update, 'check_system', return_value={}),
patch.object(update, 'screen_ready'),
+ patch.object(update, 'capture_view', return_value=None),
patch.object(update, 'notice'), patch.object(update, 'versions', side_effect=self.versions)]
for item in self.patches:
item.start()
@@ -328,5 +329,39 @@ class FastUpdates(unittest.TestCase):
self.assertFalse((self.state / 'request.json').exists())
+class ScreenSelection(unittest.TestCase):
+ def test_capture_chooses_os_screen_among_other_clients_and_rejects_bad_ids(self):
+ rows = '201\t$1\t@2\t%3\t/dev/pts/8\n202\t$4\t@5\t%6\t/dev/pts/9'
+ def groups(path):
+ if path == Path('/proc/201/cgroup'):
+ return '0::/user.slice/ssh-session.scope\n'
+ return '0::/user.slice/app.slice/hn-screen.service\n'
+ with patch.object(update, 'run', return_value=rows), \
+ patch.object(update.Path, 'read_text', autospec=True, side_effect=groups):
+ self.assertEqual(update.capture_view(), {'session': '$4', 'window': '@5', 'pane': '%6', 'tty': '/dev/pts/9'})
+ with patch.object(update, 'run', return_value=rows.replace('$4', '--all')), \
+ patch.object(update.Path, 'read_text', autospec=True, side_effect=groups):
+ self.assertIsNone(update.capture_view())
+
+ def test_restore_targets_reconnected_os_client_and_existing_objects(self):
+ view = {'session': '$4', 'window': '@5', 'pane': '%6', 'tty': '/dev/pts/9'}
+ commands = []
+ def run(*args, **kwargs):
+ commands.append(args)
+ return {'list-sessions': '$0\n$4', 'list-windows': '@5', 'list-panes': '%6'}.get(args[1], '')
+ with patch.object(update, 'run', side_effect=run), \
+ patch.object(update, 'capture_view', return_value=dict(view, tty='/dev/pts/20')):
+ update.restore_view(view)
+ self.assertIn(('/usr/bin/hn', 'switch-client', '-c', '/dev/pts/20', '-t', '$4'), commands)
+ self.assertIn(('/usr/bin/hn', 'select-window', '-t', '@5'), commands)
+ self.assertIn(('/usr/bin/hn', 'select-pane', '-t', '%6'), commands)
+ with patch.object(update, 'run', return_value='$0') as run:
+ update.restore_view(view)
+ run.assert_called_once_with('/usr/bin/hn', 'list-sessions', '-F', '#{session_id}')
+ with patch.object(update, 'run') as run, self.assertRaises(ValueError):
+ update.restore_view(dict(view, pane='--all'))
+ run.assert_not_called()
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/os/tests/test_nvidia.py b/os/tests/test_nvidia.py
new file mode 100644
index 000000000..1b271ef23
--- /dev/null
+++ b/os/tests/test_nvidia.py
@@ -0,0 +1,94 @@
+import importlib.util
+import json
+from pathlib import Path
+import tempfile
+import unittest
+from unittest.mock import patch
+
+
+def load(name, path):
+ spec = importlib.util.spec_from_file_location(name, path)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
+
+ROOT = Path(__file__).resolve().parents[1]
+hardware = load('nvidia_hardware', ROOT / 'hardware.py')
+builder = load('nvidia_builder', ROOT / 'tools/build-nvidia.py')
+
+
+class NvidiaSelection(unittest.TestCase):
+ def card(self, identity='10de:2684', driver='nouveau', kind='030000'):
+ return {'id': identity, 'driver': driver, 'class': kind}
+
+ def test_match_supported_display_and_compute_devices_without_pci_ranges(self):
+ supported = {'10de:2684': ['RTX 4090'], '10de:2b85': ['RTX 5090']}
+ self.assertEqual(hardware.nvidia_selection([self.card(), self.card('10de:2b85', None, '030200')], supported),
+ {'status': 'selected', 'devices': ['10de:2684', '10de:2b85']})
+ for devices in [[], [self.card('8086:1234')], [self.card(kind='040300')]]:
+ self.assertIsNone(hardware.nvidia_selection(devices, supported))
+ self.assertEqual(hardware.nvidia_selection([self.card('10de:ffff')], supported)['status'], 'unchanged')
+
+ def test_legacy_second_gpu_and_passthrough_are_preserved(self):
+ supported = {'10de:2684': ['RTX 4090']}
+ for devices in [[self.card(), self.card('10de:1b80')], [self.card(driver='vfio-pci')],
+ [self.card(driver='another-driver')]]:
+ self.assertEqual(hardware.nvidia_selection(devices, supported)['status'], 'unchanged')
+
+ def test_running_root_cannot_be_used_as_an_installation(self):
+ with patch.object(hardware, 'run') as run, self.assertRaises(ValueError):
+ hardware.configure_nvidia_install(Path('/'), [self.card()])
+ run.assert_not_called()
+
+ def test_generic_target_does_not_read_or_install_optional_bundle(self):
+ with tempfile.TemporaryDirectory() as temp:
+ target = Path(temp)
+ (target / 'etc').mkdir()
+ (target / 'etc/harness-live').touch()
+ with patch.object(hardware.Path, 'is_mount', return_value=True), \
+ patch.object(hardware, 'run') as run, patch.object(hardware, 'nvidia_bundle_manifest') as read:
+ self.assertIsNone(hardware.configure_nvidia_install(target, [], target / 'absent'))
+ run.assert_not_called()
+ read.assert_not_called()
+
+ def test_bundle_hashes_and_symlink_confinement(self):
+ with tempfile.TemporaryDirectory() as temp:
+ folder = Path(temp) / 'bundle'
+ folder.mkdir()
+ outside = Path(temp) / 'outside'
+ outside.write_bytes(b'driver')
+ (folder / 'driver').symlink_to(outside)
+ manifest = {'schema': 1, 'driver': 'nvidia-open', 'architecture': 'x86_64',
+ 'driver_version': '615.71.09', 'supported_devices': {'10de:2684': ['RTX 4090']},
+ 'files': {'driver': {'bytes': 6, 'sha256': hardware.digest(outside)}}}
+ (folder / 'manifest.json').write_text(json.dumps(manifest))
+ with self.assertRaisesRegex(ValueError, 'inside'):
+ hardware.nvidia_bundle_manifest(folder, all_files=True)
+ (folder / 'driver').unlink()
+ (folder / 'driver').write_bytes(b'corrupted')
+ with self.assertRaisesRegex(ValueError, 'checksum'):
+ hardware.nvidia_bundle_manifest(folder, all_files=True)
+
+
+class NvidiaSupportTable(unittest.TestCase):
+ def test_current_table_only_with_subsystem_rows(self):
+ contents = '''<table><tr><td>Navigation</td></tr></table>
+<a id="Current"></a><table><thead><tr><th>Product</th></tr></thead><tbody>
+<tr><td>NVIDIA RTX &amp; fixture</td><td>2684</td><td>K</td></tr>
+<tr><td>OEM fixture</td><td>2684 1028 0001</td><td>K</td></tr>
+</tbody></table><a id="legacy"></a><table><tr><td>GTX 1080</td><td>1B80</td></tr></table>'''
+ self.assertEqual(builder.supported_devices(contents, '615.71.09'),
+ {'10de:2684': ['NVIDIA RTX & fixture', 'OEM fixture']})
+
+ def test_older_release_missing_current_marker_and_invalid_ids_fail(self):
+ for contents, version in [('<a id="Current"></a><table></table>', '615.71.09'),
+ ('<table><tr><td>Old</td><td>2684</td></tr></table>', '615.71.09'),
+ ('<a id="Current"></a><table><tr><td>Bad</td><td>bad-id</td></tr></table>', '615.71.09'),
+ ('anything', '580.1.1')]:
+ with self.subTest(contents=contents, version=version), self.assertRaises(ValueError):
+ builder.supported_devices(contents, version)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/os/tests/test_publication.py b/os/tests/test_publication.py
index ab4b82474..573b2ad2b 100644
--- a/os/tests/test_publication.py
+++ b/os/tests/test_publication.py
@@ -11,6 +11,37 @@ spec.loader.exec_module(publish)
class PublicationGuards(unittest.TestCase):
+ def test_nvidia_requires_exact_image_authenticated_offline_install_and_reboot(self):
+ manifest = {'source_commit': 'source-one', 'iso': {'sha256': 'image-one'},
+ 'hardware': {'nvidia': {'kernel': 'exact-kernel', 'driver_version': '615.71.09',
+ 'packages': {'driver.pkg.tar.zst': {'name': 'driver', 'version': '1'}}}}}
+ receipt = dict(status='passed', iso_sha256='image-one', image_source_commit='source-one',
+ test_source_commit='source-one', candidate_injected=False,
+ keyboard={'confirmed_seconds_since_boot': 20}, return_keyboard={'confirmed_seconds_since_boot': 40},
+ early_display_modules_and_firmware='passed', generic_browser_after_driver_reboot='passed',
+ installation=dict(status='passed', kernel='exact-kernel', driver_version='615.71.09',
+ optional_packages={'driver': '1'}, cache_extraction_excluded=True,
+ corrupted_archive_rejected=True, invalid_signature_rejected=True,
+ negative_selections_unchanged=True, cache_absent=True, base_packages_unchanged=True))
+ publish.validate_nvidia(manifest, receipt)
+ for key, value in receipt.items():
+ bad = copy.deepcopy(receipt)
+ bad.pop(key)
+ with self.subTest(missing=key), self.assertRaises(ValueError):
+ publish.validate_nvidia(manifest, bad)
+ if key.endswith('commit') or key == 'iso_sha256':
+ bad[key] = 'other'
+ with self.subTest(different=key), self.assertRaises(ValueError):
+ publish.validate_nvidia(manifest, bad)
+ bad = dict(receipt, candidate_injected=True)
+ with self.assertRaises(ValueError):
+ publish.validate_nvidia(manifest, bad)
+ for key in receipt['installation']:
+ bad = copy.deepcopy(receipt)
+ bad['installation'].pop(key)
+ with self.subTest(missing=key), self.assertRaises(ValueError):
+ publish.validate_nvidia(manifest, bad)
+
def test_optional_hardware_requires_matching_native_install_and_rebuild(self):
manifest = {'source_commit': 'source-one', 'iso': {'sha256': 'image-one'},
'hardware': {'broadcom': {'kernel': 'exact-kernel',
@@ -121,6 +152,13 @@ class PublicationGuards(unittest.TestCase):
for row in hardware_receipts:
row['checks'].append('Unrelated hardware receives no optional Wi-Fi packages and retains no USB driver cache')
publish.validate_receipts(hardware_manifest, hardware_receipts)
+ gpu_manifest = dict(manifest, capabilities=['nvidia-offline'])
+ with self.assertRaisesRegex(ValueError, 'NVIDIA-driver exclusion'):
+ publish.validate_receipts(gpu_manifest, receipts)
+ gpu_receipts = copy.deepcopy(receipts)
+ for row in gpu_receipts:
+ row['checks'].append('Unrelated hardware receives no NVIDIA packages, boot configuration or USB GPU cache')
+ publish.validate_receipts(gpu_manifest, gpu_receipts)
for change in [dict(status='failed'), dict(scope='live session only'), dict(iso_sha256='another-image'),
dict(image_source_commit='another-source'), dict(checks=['Live hn ready;']), dict(encrypted=False)]:
bad = copy.deepcopy(receipts)
diff --git a/os/tests/vm.py b/os/tests/vm.py
index 35139f428..2ec91f0a2 100644
--- a/os/tests/vm.py
+++ b/os/tests/vm.py
@@ -1033,6 +1033,11 @@ assert str(i.live_payload()) == '/run/archiso/copytoram/airootfs.sfs'
vm.command('python3 -c ' + shlex.quote('import json; assert json.load(open('
'"/var/lib/harness-os/hardware.json")) == {"drivers": [], "devices": []}'))
result['checks'].append('Unrelated hardware receives no optional Wi-Fi packages and retains no USB driver cache')
+ if 'nvidia-offline' in manifest.get('capabilities', []):
+ vm.command('test ! -e /usr/share/harness-os/hardware/nvidia && '
+ 'test ! -e /etc/mkinitcpio.conf.d/30-harness-nvidia.conf && '
+ '! pacman -Q nvidia-open-lts && ! pacman -Q nvidia-utils')
+ result['checks'].append('Unrelated hardware receives no NVIDIA packages, boot configuration or USB GPU cache')
vm.command('! pgrep -x chromium')
vm.command('test "$(npm prefix -g)" = "$HOME/.local"')
vm.command('findmnt -n -o FSTYPE / | grep -qx btrfs')
diff --git a/os/tools/build-nvidia.py b/os/tools/build-nvidia.py
new file mode 100644
index 000000000..4f658b6fc
--- /dev/null
+++ b/os/tools/build-nvidia.py
@@ -0,0 +1,168 @@
+#!/usr/bin/env python3
+"""Prepare signed, snapshot-matched NVIDIA packages outside the minimal image."""
+import argparse
+import base64
+from html.parser import HTMLParser
+import importlib.util
+import json
+import os
+from pathlib import Path
+import re
+import shutil
+
+spec = importlib.util.spec_from_file_location('hardware_builder', Path(__file__).with_name('build-hardware.py'))
+builder = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(builder)
+run, identity = builder.run, builder.identity
+
+
+class CurrentGPUs(HTMLParser):
+ """Only the driver's Current table; legacy tables contain unsupported IDs."""
+ def __init__(self):
+ super().__init__(convert_charrefs=True)
+ self.current = self.table = self.cell = self.done = False
+ self.cells = []
+ self.text = ''
+ self.devices = {}
+
+ def handle_starttag(self, tag, attrs):
+ attributes = dict(attrs)
+ if tag == 'a' and attributes.get('id') == 'Current' and not self.done:
+ self.current = True
+ elif tag == 'table' and self.current:
+ self.table = True
+ elif tag == 'tr' and self.table:
+ self.cells = []
+ elif tag == 'td' and self.table:
+ self.cell, self.text = True, ''
+
+ def handle_data(self, data):
+ if self.cell:
+ self.text += data
+
+ def handle_endtag(self, tag):
+ if tag == 'td' and self.cell:
+ self.cells.append(' '.join(self.text.split()))
+ self.cell = False
+ elif tag == 'tr' and self.table and self.cells:
+ if len(self.cells) < 2 or not self.cells[0] or not re.fullmatch(
+ r'[0-9A-Fa-f]{4}(?: [0-9A-Fa-f]{4} [0-9A-Fa-f]{4})?', self.cells[1]):
+ raise ValueError('Malformed current NVIDIA GPU row.')
+ key = '10de:' + self.cells[1].split()[0].lower()
+ self.devices.setdefault(key, set()).add(self.cells[0])
+ elif tag == 'table' and self.table:
+ self.current = self.table = False
+ self.done = True
+
+
+def supported_devices(contents, version):
+ # Since 590 the main driver has dropped pre-Turing hardware. Older release
+ # tables include devices that the open kernel module cannot drive.
+ if not re.fullmatch(r'\d+\.\d+\.\d+', version) or int(version.split('.')[0]) < 590:
+ raise ValueError('Reassess open-kernel support for this NVIDIA driver.')
+ parser = CurrentGPUs()
+ parser.feed(contents)
+ parser.close()
+ if not parser.done or not parser.devices:
+ raise ValueError('Missing current NVIDIA GPU support table.')
+ return {key: sorted(value) for key, value in sorted(parser.devices.items())}
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--config', type=Path, required=True)
+ parser.add_argument('--base-packages', type=Path, help='Verified existing image inventory for a focused native check')
+ parser.add_argument('--work', type=Path, required=True)
+ parser.add_argument('--output', type=Path, required=True)
+ args = parser.parse_args()
+ if os.geteuid() != 0 or os.uname().sysname != 'Linux' or os.uname().machine != 'x86_64':
+ parser.error('Run in the isolated x86-64 Linux image builder as root.')
+ source = Path(__file__).resolve().parents[1]
+ lock = json.loads((source / 'lock.json').read_text())
+ work, output = args.work.resolve(), args.output.resolve()
+ work.mkdir(parents=True, exist_ok=False)
+ output.mkdir(parents=True, exist_ok=False)
+ cache, database, root = (work / name for name in ['cache', 'database', 'root'])
+ for folder in [cache, database, root, database / 'local']:
+ folder.mkdir()
+ config = work / 'pacman.conf'
+ config.write_text(args.config.read_text().replace('[options]', '[options]\nCacheDir = ' + str(cache)))
+ pacman = ['pacman', '--config', config, '--dbpath', database, '--cachedir', cache]
+ run(*pacman, '-Sy', '--noconfirm')
+
+ def resolve(names):
+ text = run(*pacman, '-Sp', '--noconfirm', '--print-format', 'HN_PACKAGE\t%n\t%v', *names, capture=True)
+ result = dict(line.split('\t')[1:] for line in text.splitlines() if line.startswith('HN_PACKAGE\t'))
+ if not set(names).issubset(result):
+ raise ValueError('Package resolution omitted an explicit target.')
+ return result
+
+ if args.base_packages:
+ base = dict(line.split(' ', 1) for line in args.base_packages.read_text().splitlines())
+ else:
+ base = resolve([line.strip() for line in (source / 'packages.x86_64').read_text().splitlines()
+ if line.strip() and not line.startswith('#')])
+ drivers = resolve(['linux-lts', 'nvidia-open-lts', 'nvidia-utils'])
+ extra = {name: version for name, version in drivers.items() if name not in base}
+ shared = {name: version for name, version in drivers.items() if name in base}
+ if any(base[name] != version for name, version in shared.items()):
+ raise ValueError('NVIDIA and image dependencies do not use the same snapshot.')
+ if not {'nvidia-open-lts', 'nvidia-utils'} <= extra.keys() or set(extra) & {'gcc', 'make', 'dkms', 'linux-lts-headers'}:
+ raise ValueError('NVIDIA preparation must use prebuilt modules outside the base image.')
+ run(*pacman, '-Sw', '--noconfirm', *drivers)
+ run('pacstrap', '-C', config, '-c', root, 'base', 'linux-lts', 'nvidia-open-lts', 'nvidia-utils')
+ kernels = [path.parent.name for path in (root / 'usr/lib/modules').glob('*/pkgbase')
+ if path.read_text().strip() == 'linux-lts']
+ if len(kernels) != 1:
+ raise ValueError('Expected one LTS kernel in the NVIDIA preparation root.')
+ kernel = kernels[0]
+ version = run('arch-chroot', root, 'modinfo', '-k', kernel, '-F', 'version', 'nvidia', capture=True)
+ modules = {}
+ for module in ['nvidia', 'nvidia_modeset', 'nvidia_uvm', 'nvidia_drm']:
+ magic = run('arch-chroot', root, 'modinfo', '-k', kernel, '-F', 'vermagic', module, capture=True)
+ actual = run('arch-chroot', root, 'modinfo', '-k', kernel, '-F', 'version', module, capture=True)
+ if magic.split()[0] != kernel or actual != version:
+ raise ValueError('NVIDIA kernel modules do not match.')
+ modules[module] = {'version': actual, 'vermagic': magic}
+ if run('arch-chroot', root, 'modinfo', '-k', kernel, '-F', 'license', 'nvidia', capture=True) != 'Dual MIT/GPL':
+ raise ValueError('Expected the open NVIDIA kernel driver.')
+ files = run('arch-chroot', root, 'pacman', '-Qlq', 'nvidia-utils', capture=True).splitlines()
+ support = next(root / path.lstrip('/') for path in files if path.endswith('/html/supportedchips.html'))
+ devices = supported_devices(support.read_text(), version)
+ targets = ['GeForce RTX 4090', 'GeForce RTX 5090', 'RTX 6000 Ada Generation', 'RTX PRO 6000 Blackwell']
+ if not all(any(target in name for names in devices.values() for name in names) for target in targets):
+ raise ValueError('A target GPU is absent from the current support table.')
+ shutil.copyfile(support, output / 'supportedchips.html')
+ package_dir = output / 'packages'
+ package_dir.mkdir()
+ descriptions = builder.descriptions(database)
+ packages = {}
+ for name, release in sorted(extra.items()):
+ fields = descriptions[name]
+ if fields['%VERSION%'] != [release]:
+ raise ValueError('Package changed during NVIDIA preparation: ' + name)
+ filename = fields['%FILENAME%'][0]
+ if not re.fullmatch(r'[a-zA-Z0-9_+.:\-]+\.pkg\.tar\.zst', filename):
+ raise ValueError('Invalid NVIDIA package filename.')
+ archive = cache / filename
+ if identity(archive)['sha256'] != fields['%SHA256SUM%'][0]:
+ raise ValueError('NVIDIA package checksum mismatch: ' + filename)
+ target = package_dir / filename
+ shutil.copyfile(archive, target)
+ signature = target.with_name(target.name + '.sig')
+ signature.write_bytes(base64.b64decode(fields['%PGPSIG%'][0], validate=True))
+ run('pacman-key', '--verify', signature, target)
+ packages[filename] = {'name': name, 'version': release}
+ manifest = {'schema': 1, 'driver': 'nvidia-open', 'architecture': 'x86_64',
+ 'arch_snapshot': lock['arch_snapshot'], 'kernel': kernel, 'driver_version': version,
+ 'modules': modules, 'supported_devices': devices, 'base_packages': shared, 'packages': packages,
+ 'files': {str(path.relative_to(output)): identity(path) for path in sorted(output.rglob('*')) if path.is_file()}}
+ (output / 'manifest.json').write_text(json.dumps(manifest, indent=2) + '\n')
+ print(json.dumps({'driver': version, 'kernel': kernel, 'supported_ids': len(devices),
+ 'offline_package_bytes': sum(path.stat().st_size for path in package_dir.glob('*.pkg.tar.zst'))}, indent=2))
+ shutil.rmtree(root)
+ shutil.rmtree(cache)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/os/tools/inspect_image.py b/os/tools/inspect_image.py
index e3249fa36..7ce4b836a 100644
--- a/os/tools/inspect_image.py
+++ b/os/tools/inspect_image.py
@@ -80,7 +80,7 @@ def inspect(iso):
expected_version = re.escape(version.replace('-preview.', 'pre')) + r'\.r\d+\.g' + manifest['source_commit'][:10] + '-1'
assert re.fullmatch(expected_version, package_version), 'OS package version differs from the image source'
assert package_version == manifest['package_version'], 'OS package version differs from the manifest'
- assert set(manifest['capabilities']) == {'runtime-updates', 'system-updates', 'single-action-updates', 'broadcom-offline', 'install-first'}, 'Image capabilities differ from the manifest'
+ assert set(manifest['capabilities']) == {'runtime-updates', 'system-updates', 'single-action-updates', 'broadcom-offline', 'nvidia-offline', 'install-first'}, 'Image capabilities differ from the manifest'
hardware_root = 'usr/share/harness-os/hardware/broadcom/'
hardware = json.loads(read(hardware_root + 'manifest.json'))
assert hardware == manifest['hardware']['broadcom'], 'Hardware manifest differs from the payload'
@@ -94,6 +94,19 @@ def inspect(iso):
data = read(path)
assert len(data) == expected['bytes'] and hashlib.sha256(data).hexdigest() == expected['sha256'], f'Hardware bundle mismatch: {name}'
assert owners.get(path) == '0/0', f'Hardware file is not root-owned: {name}'
+ nvidia_root = 'usr/share/harness-os/hardware/nvidia/'
+ nvidia = json.loads(read(nvidia_root + 'manifest.json'))
+ assert nvidia == manifest['hardware']['nvidia']
+ assert nvidia['kernel'] == Path(kernel['path']).parent.name
+ assert nvidia['arch_snapshot'] == manifest['arch_snapshot']
+ assert all(inventory.get(name) == version for name, version in nvidia['base_packages'].items())
+ assert not names & {'nvidia-utils', 'nvidia-open-lts'}, 'Optional GPU packages entered the generic image'
+ for name, expected in nvidia['files'].items():
+ assert not Path(name).is_absolute() and '..' not in Path(name).parts
+ path = nvidia_root + name
+ data = read(path)
+ assert len(data) == expected['bytes'] and hashlib.sha256(data).hexdigest() == expected['sha256'], f'NVIDIA bundle mismatch: {name}'
+ assert owners.get(path) == '0/0', f'NVIDIA file is not root-owned: {name}'
wanted = {row.strip() for row in (source / 'packages.x86_64').read_text().splitlines() if row.strip() and not row.startswith('#')}
assert wanted.issubset(names), f'Missing packages: {wanted - names}'
config = read('etc/pacman.conf').decode()
diff --git a/os/tools/manifest.py b/os/tools/manifest.py
index 565a12e10..a56ff5be1 100644
--- a/os/tools/manifest.py
+++ b/os/tools/manifest.py
@@ -29,9 +29,12 @@ if (root / 'usr/lib/harness-os/release_update.py').is_file():
capabilities.append('system-updates')
if (root / 'etc/sudoers.d/30-harness-updates').is_file():
capabilities.append('single-action-updates')
-hardware = root / 'usr/share/harness-os/hardware/broadcom/manifest.json'
-if hardware.is_file():
- capabilities.append('broadcom-offline')
+hardware = {}
+for driver in ['broadcom', 'nvidia']:
+ path = root / f'usr/share/harness-os/hardware/{driver}/manifest.json'
+ if path.is_file():
+ capabilities.append(driver + '-offline')
+ hardware[driver] = json.loads(path.read_text())
manifest = {
'version': lock['version'], 'architecture': 'x86_64',
'source_commit': os.environ.get('HARNESS_OS_SOURCE_SHA') or subprocess.check_output(['git', 'rev-parse', 'HEAD'], text=True).strip(),
@@ -40,6 +43,6 @@ manifest = {
'capabilities': capabilities,
'package_version': dict(row.split(maxsplit=1) for row in packages.splitlines())['harness-os'],
'harness_inputs': json.loads((root / 'usr/share/harness-os/runtime.json').read_text()), 'validation': 'pending',
- 'hardware': {'broadcom': json.loads(hardware.read_text())} if hardware.is_file() else {},
+ 'hardware': hardware,
}
(out / 'manifest.json').write_text(json.dumps(manifest, indent=2) + '\n')
diff --git a/os/tools/publish.py b/os/tools/publish.py
index 4c44bf59c..9073dca50 100644
--- a/os/tools/publish.py
+++ b/os/tools/publish.py
@@ -74,6 +74,32 @@ def validate_hardware(manifest, receipt):
raise ValueError('Installed driver dependencies have not passed an offline rebuild.')
+def validate_nvidia(manifest, receipt):
+ if (receipt.get('status') != 'passed' or receipt.get('iso_sha256') != manifest['iso']['sha256'] or
+ receipt.get('image_source_commit') != manifest['source_commit'] or
+ receipt.get('test_source_commit') != manifest['source_commit'] or
+ receipt.get('candidate_injected') is not False):
+ raise ValueError('NVIDIA evidence must pass against the exact unmodified image.')
+ bundle = manifest['hardware']['nvidia']
+ installed = receipt.get('installation', {})
+ if (installed.get('status') != 'passed' or installed.get('kernel') != bundle['kernel'] or
+ installed.get('driver_version') != bundle['driver_version']):
+ raise ValueError('The NVIDIA installation does not match the bundled kernel and driver.')
+ for check in ['cache_extraction_excluded', 'corrupted_archive_rejected', 'invalid_signature_rejected',
+ 'negative_selections_unchanged', 'cache_absent', 'base_packages_unchanged']:
+ if installed.get(check) is not True:
+ raise ValueError('Missing NVIDIA installation check: ' + check)
+ expected = {value['name']: value['version'] for value in bundle['packages'].values()}
+ if installed.get('optional_packages') != expected:
+ raise ValueError('Installed NVIDIA packages differ from the image manifest.')
+ for check in ['keyboard', 'return_keyboard']:
+ if not isinstance(receipt.get(check), dict) or receipt[check].get('confirmed_seconds_since_boot', 0) <= 0:
+ raise ValueError('NVIDIA package acceptance has not passed actual keyboard input.')
+ for check in ['early_display_modules_and_firmware', 'generic_browser_after_driver_reboot']:
+ if receipt.get(check) != 'passed':
+ raise ValueError('Missing NVIDIA boot or browser acceptance: ' + check)
+
+
def validate_receipts(manifest, receipts):
rows = {(r['firmware'], r['encrypted']): r for r in receipts}
if set(rows) != {('bios', False), ('uefi', True)} or len(receipts) != 2:
@@ -90,6 +116,9 @@ def validate_receipts(manifest, receipts):
if 'broadcom-offline' in manifest.get('capabilities', []) and not any(
check.startswith('Unrelated hardware receives no optional Wi-Fi packages') for check in checks):
raise ValueError('The generic installation has not passed optional-driver exclusion.')
+ if 'nvidia-offline' in manifest.get('capabilities', []) and not any(
+ check.startswith('Unrelated hardware receives no NVIDIA packages, boot configuration or USB GPU cache') for check in checks):
+ raise ValueError('The generic installation has not passed NVIDIA-driver exclusion.')
if not any(check.startswith('Harness unlock screen renders, masks input, accepts a retry') for check in rows[('uefi', True)]['checks']):
raise ValueError('The encrypted graphical unlock and retry checks have not passed.')
if not any(check.startswith('Claude Code, Codex and pi install on demand; bundled OpenCode') for check in rows[('bios', False)]['checks']):
@@ -158,6 +187,13 @@ def main():
gh('run', 'download', args.image, '--repo', args.repo, '--name', 'harness-os-hardware', '--dir', root / 'hardware')
hardware = read(root / 'hardware/receipt.json')
validate_hardware(manifest, hardware)
+ nvidia = None
+ if 'nvidia-offline' in manifest.get('capabilities', []):
+ if not any(j['name'] == 'nvidia' and j['conclusion'] == 'success' for j in jobs['jobs']):
+ raise ValueError('The image build has no successful NVIDIA installation job.')
+ gh('run', 'download', args.image, '--repo', args.repo, '--name', 'harness-os-nvidia-install', '--dir', root / 'nvidia')
+ nvidia = read(root / 'nvidia/receipt.json')
+ validate_nvidia(manifest, nvidia)
examples = {}
if list((root / 'machines').rglob('workloads/reports')):
examples['workloads'] = {'run': run['html_url'], 'browser_checks': validate_examples(root / 'machines', 'workloads')}
@@ -176,6 +212,8 @@ def main():
'machines': receipts, 'examples': examples, 'limitations': limitations}
if hardware is not None:
validation['hardware'] = hardware
+ if nvidia is not None:
+ validation['nvidia'] = nvidia
(folder / 'validation.json').write_text(json.dumps(validation, indent=2) + '\n')
manifest['validation'] = {'status': 'passed', 'receipt': 'validation.json', 'machine_run': run['html_url'], 'limitations': limitations}
(folder / 'manifest.json').write_text(json.dumps(manifest, indent=2) + '\n')
@@ -183,7 +221,7 @@ def main():
validate_install_guide(manifest, guide)
(folder / 'INSTALL.md').write_text(guide)
with zipfile.ZipFile(folder / 'machine-evidence.zip', 'w', compression=zipfile.ZIP_DEFLATED) as archive:
- for directory in ['machines', 'dsh-machines', 'hardware']:
+ for directory in ['machines', 'dsh-machines', 'hardware', 'nvidia']:
for path in sorted((root / directory).rglob('*')):
include = path.suffix in {'.png', '.json', '.txt', '.jsonl'} or path.name.endswith('-boot-journal.log')
if path.is_file() and include and not {'Projects', 'projects'} & set(path.relative_to(root / directory).parts):
@@ -225,6 +263,8 @@ BIOS/plain and UEFI/encrypted VM boot, clipboard, browser switching, offline ins
{'The USB carries an optional Broadcom Wi-Fi module and signed offline dependencies for selected BCM4331/BCM4360 radios. Fresh installations retain those packages only when needed; other computers receive no additional compiler or driver packages. The exact module and offline installation/rebuild path passed native VM checks with synthetic PCI selection. Physical Mac radio association and sleep/wake remain unverified.' if hardware is not None else ''}
+{'Supported NVIDIA machines install a snapshot-matched open kernel driver and userspace offline. The installer uses the bundled driver support table and leaves mixed legacy GPUs and passthrough assignments unchanged. Other computers receive no NVIDIA packages or package cache. Signed package installation, early display modules and firmware, encrypted reboot and a browser on a virtual GPU passed; physical NVIDIA rendering and inference remain unverified.' if nvidia is not None else ''}
+
{'Real free OpenCode agents built a Python CLI, a conference website, a keyboard game and a Fastify/SQLite application. Their unit tests and independent browser/API checks passed. The retained projects are in `harness-examples.zip`, separate from the minimal ISO.' if 'workloads' in examples else ''}
{reuse_note}