Troubleshooting Common Installation Issues

Troubleshooting Common Installation Issues

When setting up Trivy, several common issues may arise. Database download failures often occur due to network restrictions or proxy configurations:

# Configure proxy settings
export HTTP_PROXY=http://proxy.company.com:8080
export HTTPS_PROXY=http://proxy.company.com:8080
export NO_PROXY=localhost,127.0.0.1

# Test database download
trivy image --download-db-only --debug

# Use alternative database source
trivy image --db-repository public.ecr.aws/aquasecurity/trivy-db alpine:latest

Permission issues can prevent Trivy from creating cache directories:

# Fix cache directory permissions
sudo mkdir -p /tmp/trivy-cache
sudo chmod 777 /tmp/trivy-cache
export TRIVY_CACHE_DIR=/tmp/trivy-cache

# Or use user-specific directory
mkdir -p ~/.cache/trivy
export TRIVY_CACHE_DIR=~/.cache/trivy