Skip to content

Fix Nexus Ubuntu apt proxy pinned to bionic, breaking package installs on jammy VMs - #5003

Open
marrobi with Copilot wants to merge 12 commits into
mainfrom
copilot/fix-vm-config-sh-failures
Open

Fix Nexus Ubuntu apt proxy pinned to bionic, breaking package installs on jammy VMs#5003
marrobi with Copilot wants to merge 12 commits into
mainfrom
copilot/fix-vm-config-sh-failures

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Resolves #4992

What is being addressed

The Nexus shared service Ubuntu apt proxy repositories were configured with "distribution": "bionic" (Ubuntu 18.04). Guacamole Linux VMs run Ubuntu 22.04 (jammy) and request jammy packages — Nexus couldn't proxy them, returning 502 errors. With set -o errexit in vm_config.sh, the first apt install failure (gnupg2, gdebi-core, debconf-utils) aborts the entire bootstrap, leaving the VM unconfigured and blocking Guacamole connections.

How is this addressed

  • ubuntu_proxy_conf.json: "distribution": "bionic""jammy"
  • ubuntu_security_proxy_conf.json: "distribution": "bionic-security""jammy-security"
  • porter.yaml: version bump 3.10.03.10.1
  • CHANGELOG.md: bug fix entry added

The Nexus configure_nexus_repos run command re-applies all repo configs on upgrade, so existing deployments pick up this fix without VM recreation.

Copilot AI requested review from Copilot and removed request for Copilot July 24, 2026 20:26
Copilot AI requested review from Copilot and removed request for Copilot July 24, 2026 20:30
Copilot AI changed the title [WIP] Fix Guacamole Linux VM vm_config.sh failures for apt packages Fix Nexus Ubuntu apt proxy pinned to bionic, breaking package installs on jammy VMs Jul 24, 2026
Copilot AI requested a review from marrobi July 24, 2026 20:30
@marrobi

marrobi commented Jul 24, 2026

Copy link
Copy Markdown
Member

@copilot we need to leave the old one for older VMs. We need to proxy for multiple releases.

Copilot AI requested review from Copilot and removed request for Copilot July 24, 2026 20:47

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot we need to leave the old one for older VMs. We need to proxy for multiple releases.

Done. I've reverted ubuntu_proxy_conf.json and ubuntu_security_proxy_conf.json back to bionic/bionic-security (preserving support for older VMs) and instead added two new proxy repo configs:

  • ubuntu_jammy_proxy_conf.json (name: ubuntu-jammy, distribution: jammy)
  • ubuntu_security_jammy_proxy_conf.json (name: ubuntu-security-jammy, distribution: jammy-security)

The Guacamole Linux VM's apt_sources_config.yml now points to the new jammy-specific repos. (commit Keep bionic repos, add jammy-specific Nexus apt proxy repos and update linuxvm apt sources)

@marrobi

marrobi commented Jul 24, 2026

Copy link
Copy Markdown
Member

@copilot

Confirmed design: A Nexus apt group repo can front multiple apt proxy members each pinned to a different distribution (bionic/jammy). Clients hit one stable group URL and their own $RELEASE codename routes to the right member — exactly the multi-distro support you want, keeping bionic for backward compat.
Scope: Rework ubuntu, ubuntu-security, and docker into {name}-bionic + {name}-jammy proxy members behind a group that keeps the stable client-facing name, so existing consumers need no edits. Revert PR #5003's jammy-specific apt_sources_config.yml URLs back to the stable group names.
Microsoft apt: flagged for investigation (its remoteUrl is just the host root with per-distro paths), with a documented outcome required.
Loader: no changes needed, but the agent must verify member-before-group create ordering in configure_nexus_repos.sh and match the Nexus REST group.memberNames schema.
Also updates: CHANGELOG, docs/.../nexus.md table, porter.yaml version, and the PR #5003 description rewrite.

Copilot AI requested review from Copilot and removed request for Copilot July 24, 2026 21:33

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

...

Done in commit Rework ubuntu/ubuntu-security/docker into group+member apt repos for multi-distro Nexus proxy support.

What was implemented:

  • ubuntu / ubuntu-security / docker: Each is now a trio of {name}-bionic proxy + {name}-jammy proxy + {name} apt group. Clients hit the stable group URL (/repository/ubuntu/, /repository/ubuntu-security/, /repository/docker/) and Nexus routes to the correct per-distribution member. Existing consumers (VMs, sources lists) require no changes.

  • apt_sources_config.yml: Reverted back to stable group URLs (ubuntu/, ubuntu-security/).

  • configure_nexus_repos.sh: Refactored to a two-pass loop — all non-group repos are created/updated first (Pass 1), then group repos (Pass 2). This guarantees proxy members exist before groups are registered.

  • microsoft-apt investigation: The proxy uses remoteUrl: "https://packages.microsoft.com" (host root) with per-product paths baked into the client's sources list (e.g., /ubuntu/22.04/prod, /repos/edge). Since all current VM images use apt_sku: 22.04 (Ubuntu 22.04/jammy), the distribution was updated bionicjammy. The group/bionic+jammy pattern was not applied here — the apt_sku path already encodes the Ubuntu version, and the stable distribution entries (/repos/edge, /repos/vscode) don't vary by Ubuntu release.

  • nexus.md: Current Repos table updated with group/member rows and a note on microsoft-apt.

Copilot AI removed the request for review from Copilot July 29, 2026 20:47

Copilot AI commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@copilot can you also address #4540 as part of this PR. In the same way it is done for nexus - as in wait for cloud init to finish. Also ensure the changelo...

Done. Addressed in the latest commit:

Copilot AI review requested due to automatic review settings July 30, 2026 13:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (4)

templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh:191

  • Prefer jq -r over piping through sed for repoType extraction; it’s simpler and avoids brittle quote-stripping.
    repo_type=$( jq .repoType "$filename" | sed 's/"//g')

templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh:221

  • Same as Pass 1: use jq -r for repoType instead of jq ... | sed to avoid brittle quote stripping.
    repo_type=$( jq .repoType "$filename" | sed 's/"//g')

templates/shared_services/sonatype-nexus-vm/porter.yaml:4

  • The PR description says the Nexus bundle is bumped to 3.10.1, but this change bumps it to 3.10.2 (and the changelog entry also references 3.10.2). Please align the PR description (or the version/changelog) so they match.
version: 3.10.2

templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh:181

  • Using jq ... | sed 's/"//g' is brittle and duplicates parsing logic. jq -r already outputs raw strings and avoids edge cases with whitespace/escaping. It also lets you build URLs without relying on implicit word splitting.

This issue also appears in the following locations of the same file:

  • line 191
  • line 221
  base_type=$( jq .baseType "$filename" | sed 's/"//g')
  repo_type=$( jq .repoType "$filename" | sed 's/"//g')
  repo_name=$( jq .name "$filename" | sed 's/"//g')
  create_url="http://localhost/service/rest/v1/repositories/$base_type/$repo_type"
  update_url="$create_url/$repo_name"

… APT repos, remove deprecated Bionic and Jammy configurations, and enhance script logic for repo management.
Copilot AI review requested due to automatic review settings July 30, 2026 15:41
@marrobi
marrobi marked this pull request as ready for review July 30, 2026 15:41
@marrobi
marrobi requested a review from a team as a code owner July 30, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

templates/shared_services/sonatype-nexus-vm/scripts/nexus_repos_config/ubuntu_proxy_conf.json:33

  • PR description says the Ubuntu proxy repos are being updated by changing the apt distribution from bionic→jammy, but the actual change here converts the repository format from apt to raw (removing the apt.distribution field entirely) and similar format changes are also applied to other repos (e.g., docker, microsoft-apt) along with a larger version bump. Please update the PR description to match the implemented approach so operators/reviewers understand the migration/upgrade impact.
    "raw": {
        "contentDisposition": "ATTACHMENT"
    },
    "baseType": "raw",
    "repoType": "proxy"

templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh:213

  • delete_if_type_mismatch treats failures to fetch/parse the repositories list as "repo not found" (empty $existing) and returns success. With set -o pipefail, a transient HTTP error or non-JSON response can cause jq to fail and $existing to be empty, which can skip deletion of a conflicting repo and then prevent the intended format/type migration (apt→raw). Make the curl+jq pipeline failure cause a non-zero return so retry_with_backoff can retry.
  existing=$(curl -s -u admin:"$pass" \
    'http://localhost/service/rest/v1/repositories' \
    -H 'accept: application/json' \
    -k | jq -r --arg name "$repo_name" '.[] | select(.name == $name) | "\(.format) \(.type)"')
  if [ -z "$existing" ] || [ "$existing" = "$want_format $want_type" ]; then

@marrobi

marrobi commented Jul 30, 2026

Copy link
Copy Markdown
Member

PR: #5003 (branch copilot/fix-vm-config-sh-failures) — Fix Nexus apt repos for Guacamole Linux VM (#4992, #4540)
Branch: copilot/fix-vm-config-sh-failures (currently checked out)
Scope: sonatype-nexus-vm (3.11.0), guacamole-azure-linuxvm (1.4.4), guacamole service (0.14.2)

Stage summary

Stage Result Detail
Test plan Nexus-layer repo probes + full live jammy VM cloud-init test
Environment baseline Nexus SS 3.11.0 built/deployed; guacamole + linuxvm bundles built/registered
Unit tests 66 Maven guacamole tests passed
Images built guacamole 0.14.2, linuxvm 1.4.4 (sha256:49cc8da8…)
Deploy base workspace + guacamole service + Linux VM (jammy)
Deployed = PR live VM apt sources = raw-proxy URLs from PR branch
Functional cloud-init done, errors: []; #4992 packages installed
Data exfiltration not in scope of this change
API security not in scope of this change

Test results

ID Category Action Expected Actual (evidence) Result
T1 happy Nexus raw proxies resolve jammy/bionic/noble/security/docker/microsoft-apt 200 + PGP intact all 200, signatures intact
T2 happy Deploy real Guacamole Linux VM (jammy), run cloud-init apt cloud-init done, no errors status: done, errors: [] (14 min)
T3 happy #4992 packages install via proxies gnupg2/gdebi-core/debconf-utils present all ii installed
T4 happy docker-ce + azure-cli install via proxies both present, jammy build docker-ce 29.6.2jammy, azure-cli 2.88.0jammy
T5 failure #4992 failure mode absent no 502 / "Unable to locate" for real pkgs zero 502s; only gvfs-bin (removed-in-jammy, || true)

Verdict: PASS — the raw-proxy fix lets a real Guacamole jammy VM complete cloud-init and install every previously-failing package, with no per-distribution config and no 502s.

Copilot AI review requested due to automatic review settings July 30, 2026 16:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh:210

  • In delete_if_type_mismatch, the curl|jq pipeline is run inside a command substitution without checking its exit status. With set -o pipefail but no set -o errexit, a failed curl/jq will leave existing empty and the function will incorrectly return success (treating it as "repo does not exist"), skipping the delete and preventing the intended format/type migration logic from working reliably.
  existing=$(curl -s -u admin:"$pass" \
    'http://localhost/service/rest/v1/repositories' \
    -H 'accept: application/json' \
    -k | jq -r --arg name "$repo_name" '.[] | select(.name == $name) | "\(.format) \(.type)"')

templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/vm_config.sh:34

  • This line used to ignore install failures (|| true), but now it will abort the whole bootstrap due to set -o errexit. If gvfs is non-critical (as implied by the previous || true), consider keeping it non-fatal to avoid reintroducing VM config failures when apt feeds are transiently unavailable.
sudo apt install -y gvfs

templates/shared_services/sonatype-nexus-vm/porter.yaml:4

  • PR description says the Nexus bundle is bumped to 3.10.1 and only the Ubuntu apt distribution is changed, but this PR actually bumps to 3.11.0 and migrates several repos from apt to raw proxies (with an automatic format/type migration). Please update the PR description to match the implemented approach and versioning so reviewers/operators aren’t misled.
version: 3.11.0

Copilot AI review requested due to automatic review settings July 30, 2026 17:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

templates/shared_services/sonatype-nexus-vm/porter.yaml:4

  • The PR description says the Nexus porter bundle is bumped from 3.10.0 → 3.10.1 and that the fix is a bionic→jammy distribution change in the apt proxy JSON. However, the actual changes convert multiple repos (ubuntu, ubuntu-security, docker, microsoft-apt) from apt proxies to raw proxies and bump this bundle to 3.11.0. Please update the PR description bullets to match the implemented approach (or adjust the code/versioning if the intent was only a patch-level distribution change).
version: 3.11.0

templates/shared_services/sonatype-nexus-vm/scripts/configure_nexus_repos.sh:166

  • This warning doesn’t identify which repository is in a failed state, which makes upgrades harder to troubleshoot (especially when multiple repos are configured). Include the repo name (it’s the last path segment of the update URL) in the warning message.
    echo "WARNING - Repository is in a failed state in Nexus and cannot be updated (its proxy remote URL may be unreachable). Skipping."

@marrobi

marrobi commented Jul 31, 2026

Copy link
Copy Markdown
Member

@copilot fix the merge conflicts, low confidence PR comments, and update the PR description.

Copilot AI requested review from Copilot and removed request for Copilot July 31, 2026 10:58

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix the merge conflicts, low confidence PR comments, and update the PR description.

Done in commit aa5dcf35:

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.

Guacamole Linux VM vm_config.sh fails and prevents guacamole connections

3 participants