Skip to content

Incus: read architecture, GPUs and pool space from the target remote - #308

Merged
MickLesk merged 1 commit into
mainfrom
fix/incus-remote-host-assumptions
Nov 26, 2026
Merged

MickLesk merged 1 commit into
mainfrom
fix/incus-remote-host-assumptions

Conversation

@MickLesk

Copy link
Copy Markdown
Member

✍️ Description

This follows #306 and #307. Some host checks still looked at the machine running the script, when they should look at the Incus server the default remote points to.

  • Architecture: arch_check, vm_arch and _vm_import_local_image now use _cs_host_arch, which follows INCUS_SERVER_ARCH, instead of uname -m / dpkg. arch_check moves after pve_check in vm_preflight, so the target is known when it runs.
  • GPU passthrough (CT): on a remote, incus_detect_gpu_devices reads GPUs from incus info --resources (new _incus_target_gpus) instead of local lspci and DRM sysfs. The local /dev/nvidia*, /dev/ttyUSB*/ttyACM0 and /dev/apex_0 probes now run only for local.
  • Pool space: _vm_pool_free_gib falls back to df on the pool source only for local, the same guard as the container path in backend.func:235.
  • Storage fallbacks: the leftover ${STORAGE:-default} in vm-core.func and ct_attach_volume now use the new incus_default_storage_pool. It returns the default profile's root pool, or else the first pool. vm_resolve_storage uses it too.
  • New incus_target_is_local helper.

tests/incus-target.sh covers the GPU parser (NICs are skipped), the local/remote helper and the pool-space guard. The incus-* and vm-* tests pass locally.

A matching PR in the Incus repo switches the image-arch selection in four VM scripts to _cs_host_arch.

πŸ”— Related Issue

Follow-up to #306 / #307.

βœ… Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected (Proxmox VE and/or Incus, as applicable).
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.
  • API.txt regenerated – If a function signature or behavior changed, API.txt was updated to match.

πŸ› οΈ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • ✨ New feature – Adds new, non-breaking functionality.
  • πŸ’₯ Breaking change – Alters existing behavior in a way that may require updates in every downstream script.
  • πŸ”§ Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • πŸ“ Documentation update – Changes to README, docs/, CONTRIBUTING.md, or other docs.

πŸ€– AI Assistance (X in brackets)

  • No AI used – Code was written without AI assistance.
  • AI was used – The output has been reviewed and corrected, and I take responsibility for it matching this repo's conventions.

Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Try this branch

The engine and the scripts resolve independently, so a production script can
be run against the engine from this PR by setting one variable:

COMMUNITY_SCRIPTS_CORE_URL=https://raw.githubusercontent.com/community-scripts/core/fix/incus-remote-host-assumptions \
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"

Swap ct/debian.sh for whatever exercises the change.

This PR touches incus/, so it needs an Incus host.

Run a script from a fork as well
curl -fsSL https://raw.githubusercontent.com/community-scripts/core/fix/incus-remote-host-assumptions/tools/run.sh |
  bash -s -- https://raw.githubusercontent.com/YOU/DevScripts/your-branch ct/debian.sh \
             https://raw.githubusercontent.com/community-scripts/core/fix/incus-remote-host-assumptions

Note that run.sh is reached through a pipe, so the script it starts inherits
an exhausted stdin. Whiptail is fine β€” it opens /dev/tty β€” but a plain read
would see EOF. The single-variable form above does not have that problem.

Useful flags while testing

dev_mode=net logs every engine fetch with status and duration, which is the
quickest way to confirm the branch is really being used. dev_mode=keep stops a
failed build from deleting the container along with the evidence.

@MickLesk MickLesk self-assigned this Nov 26, 2026
@MickLesk MickLesk changed the title fix(incus): read architecture, GPUs and pool space from the target remote Incus: read architecture, GPUs and pool space from the target remote Nov 26, 2026
@MickLesk
MickLesk merged commit 0c6757e into main Nov 26, 2026
4 checks passed
@github-actions
github-actions Bot deleted the fix/incus-remote-host-assumptions branch November 27, 2026 10:41
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