Skip to content

systemvm: keep /var/www owned by www-data after patching the SSVM - #14727

Open
RosiKyu wants to merge 1 commit into
apache:mainfrom
shapeblue:fix-ssvm-patch-userdata-owner
Open

RosiKyu wants to merge 1 commit into
apache:mainfrom
shapeblue:fix-ssvm-patch-userdata-owner

Conversation

@RosiKyu

@RosiKyu RosiKyu commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Description

After patchSystemVm on the secondary storage VM, creating a new download link (volume, template, ISO) fails with "mkdir: cannot create directory '/var/www/html/userdata/{id}/': Permission denied" until the SSVM is rebooted.

The patch extracts cloud-scripts.tgz as root, and the archive also carries /var/www/html/userdata, so the folder ends up owned by root. The SSVM creates the download folders there as www-data. On boot, setup_apache2 runs chown www-data:www-data -R /var/www, which is why a reboot fixes it.

This PR does the same chown in patch-sysvms.sh right after the extract, for the secondary storage VM only.

Fixes #14726

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

KVM lab on a main nightly (one SSVM, NFS secondary storage). The changed patch-sysvms.sh was put on the KVM host that runs the SSVM, in place of the packaged one.

  • Without the fix: patch the SSVM, then download template T1. It fails with "Permission denied".
  • With the fix: patch the SSVM, then download template T2. The link is created and the file is served (HTTP 206 for a range request). /var/www, /var/www/html and /var/www/html/userdata are owned by www-data after the patch.

How did you try to break this feature and the system with this change?

  • The SSVM agent comes back Up after the patch with the fix.
  • Only the secondary storage VM is changed. The console proxy and routers are patched as before.

Patching the secondary storage VM extracts cloud-scripts.tgz as root,
which also carries /var/www/html/userdata. The folder then belongs to
root and new download links (volumes, templates, ISOs) fail with
"mkdir: cannot create directory ... Permission denied" until the SSVM
is rebooted. Give /var/www back to www-data after the extract, the same
as the boot setup does.

Fixes apache#14726
Copilot AI balanced review requested due to automatic review settings November 18, 2026 11:24
@RosiKyu RosiKyu added this to the 24.0 milestone Nov 18, 2026
@RosiKyu

RosiKyu commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

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.

🟢 Approval recommended

No active review issues are reported for the SSVM web-root ownership fix.

No open issues 🎉

What changed in this PR

Fixes download-link creation after patching a secondary storage VM (SSVM), addressing #14726 without requiring a reboot.

Changes:

  • Restores www-data:www-data ownership recursively under /var/www immediately after extracting the patch archive, matching boot-time setup.
  • Limits the ownership correction to SSVMs, leaving console proxy and router patching unchanged.
File Description
systemvm/​patch-sysvms.sh Restores SSVM web-root ownership after archive extraction so new download directories remain writable.

Review effort: Balanced

@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.86%. Comparing base (6a0fcd6) to head (7ba2db8).

Additional details and impacted files
@@          Coverage Diff           @@
##            main   #14727   +/-   ##
======================================
  Coverage   3.86%    3.86%           
======================================
  Files        494      494           
  Lines      42888    42888           
  Branches    8141     8141           
======================================
  Hits        1657     1657           
  Misses     40999    40999           
  Partials     232      232           
Flag Coverage Δ
uitests 3.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Volume download fails with Permission denied after patching the SSVM

3 participants