Skip to content

Conversation

@sarika-03
Copy link

Problem

Upload fails on NFSv4 volumes where chown() returns Operation not permitted due to NFSv4 identity mapping restrictions.

Error:

ERROR: chown failed on /srv/fossology/uploads/..., error: Operation not permitted
FATAL: Failed to import ...

This prevents FOSSology deployment in Docker Swarm environments using NFS storage.

Solution

Added optional FOSSOLOGY_SKIP_CHOWN environment variable to allow uploads to continue when chown() fails.

Changes Made

  1. src/wget_agent/agent/wget_agent.c
    Modified 3 chown() call sites in DBLoadGold() function:

  2. docker-compose.yml: Added environment variable to scheduler and web services

Behavior

  • Without FOSSOLOGY_SKIP_CHOWN** (default): Original behavior, backward compatible
  • With FOSSOLOGY_SKIP_CHOWN=true**: chown() failure logs WARNING, upload continues

##Testing
1 . Restart containers
docker-compose down
docker-compose up -d
2 . Verify env variable
docker exec fossology_scheduler_1 env | grep FOSSOLOGY_SKIP_CHOWN
# FOSSOLOGY_SKIP_CHOWN=true
3. Create & upload test file
echo "NFSv4 Fix Test - $(date)" > ~/Desktop/test.txt
4.Check logs after upload
docker logs fossology_scheduler_1 2>&1 | grep -i chown | tail -20
5.Result - Upload succeeds

Fixes #3129

@sarika-03
Copy link
Author

Hey @shaheemazmalmmd
Any update on this ?

@Kaushl2208
Copy link
Member

Kaushl2208 commented Oct 29, 2025

Hey @sarika-03,

This change looks like a pragmatic workaround for environments where mounted volumes disallow chown (NFS, some PVs, bind mounts with UID/GID mismatches), but it’s important to be explicit about what it does and what it does not:

  • This is not a fix: It simply suppresses the error path and downgrades chown failures to a warning when FOSSOLOGY_SKIP_CHOWN=true. Ownership on the filesystem is unchanged, so behavior and permissions still depend on the existing ownership on the mount.
  • This behavior varies by deployment. In environments where containers can and should set correct ownership (host-managed volumes, Docker volumes, privileged init steps), skipping chown hides a real misconfiguration that should be fixed at the platform level.

Risks: silently ignoring chown failures can mask real permission problems later at runtime and can create inconsistent behaviour between deployments.

So if I take this as an workaround: There are better ways to solve this without adding suppressors in the code. If you have such requirement for your deployment, Maybe we can discuss on better solutions?

@sarika-03
Copy link
Author

Hi @Kaushl2208 .

I agree we need a better approach. Would you prefer:

  1. Filesystem detection(automatic NFS detection instead of env var)
  2. Make chown truly optional (bigger refactor, but cleaner)
  3. Document "NFS not supported" for now

Happy to revise based on your preference. What direction would you recommend?

Thanks for the guidance! 🙏

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.

[BUG] Upload fails with "chown failed" on NFSv4 volume, even with no_root_squash and 777 permissions

3 participants