Real-world NetBox Upgrade and Migration experience outlining root causes, permission corrections, service user verification, and operational takeaways. Bobcares Infrastructure Services supports secure migrations, permission audits, and production validation to keep your environment stable and reliable.
One of our engineers recently completed a NetBox upgrade and migration in a client’s production environment. This blog takes us through issues during execution, identifies the root causes, and explains the applicable corrective actions.
The objective of documenting this case is to create a reliable reference for future NetBox upgrades, help operations and platform teams troubleshoot faster, and reduce risk during similar migrations or rebuilds.
Environment Summary
The client environment was running NetBox version 4.4.4 on Python 3.13.7. The application was installed at /opt/netbox. Gunicorn served as the application server, while Apache handled media serving as the web server and reverse proxy. NetBox services were configured to run under the netbox user.

This setup formed the baseline for the upgrade and migration activity.
Upgrade and Migration Scope
The engagement involved upgrading NetBox to a newer major release while migrating an existing production instance along with its data. Device inventory, attachments, and images had to be preserved without data loss.
After completing the upgrade, our engineer validated overall application functionality to confirm that the production environment was stable and usable. Although the migration was ultimately successful, several permission-related issues surfaced during validation.
Issues Identified During Execution
Service User and Ownership Mismatch
After the migration, our engineer confirmed that NetBox services were running as the netbox user. However, several directories were owned by root or apache. This condition typically occurs when file restores are executed as root, directories are created manually during migration, or ownership settings are retained from older environments.
The mismatch caused write operations to fail. Media uploads and attachments were not functioning, and permission-related exceptions appeared in the NetBox UI.
The resolution involved realigning directory ownership. All writable NetBox directories were reassigned to the netbox user, and group ownership was aligned with the web server where required. Once ownership was corrected, the application regained proper write access.
Media Directory Write Failure
During validation testing, the following error appeared:
PermissionError: [Errno 13] Permission denied
/opt/netbox/netbox/media/image-attachments/<file>.jpg
The error occurred when uploading device images or attachments through the NetBox interface.
Investigation revealed inconsistent ownership across media subdirectories. The devicetype-images directory was owned by root:root, while image-attachments was owned by root:apache. Since Gunicorn runs under the netbox user, write access to these directories was denied.
Our engineer standardized ownership and permissions using:
chown -R netbox:apache /opt/netbox/netbox/media
chmod -R 775 /opt/netbox/netbox/media
These changes restored NetBox’s ability to write uploaded files and ensured that Apache could continue serving media content correctly.
Runtime User Verification
Before applying permission corrections, the execution context was verified using:
ps -ef | grep gunicorn
The output confirmed that Gunicorn and the NetBox application were running under the expected netbox user. This step ensured that permission changes were aligned with the actual runtime user and prevented unnecessary configuration adjustments.
Post-Upgrade Validation Gaps
During initial validation, some checks were not performed immediately, delaying issue identification. Media upload testing was not executed at the outset. Directory ownership was not audited after restoration, and runtime user verification was initially assumed instead of explicitly confirmed.
These gaps highlighted the need for a standardized validation approach after every upgrade or migration.
Post-Upgrade Validation Checklist
Based on this engagement, a structured checklist was formalized. After every NetBox upgrade or migration, the following steps should be completed:
- Verify the Gunicorn runtime user
- Audit directory ownership and permissions
- Test media uploads and attachments
- Confirm Apache can serve media files
- Validate overall application functionality
Executing these steps early helps detect permission inconsistencies before they impact production users.
This case reinforced several important points. NetBox enforces strict filesystem permissions and fails quickly when access is restricted. Ownership mismatches are common during migrations, particularly after file restores. Early verification of the runtime user significantly reduces debugging time. Media directories must always remain writable by the NetBox service user to avoid application errors.
Conclusion
The NetBox upgrade and migration were successfully completed for the client, though filesystem ownership and permission inconsistencies introduced avoidable delays during validation.
Clear documentation of the issues encountered and the corrective actions taken now serves as a practical reference for future engagements. A structured post-upgrade validation process will reduce operational risk, shorten troubleshooting cycles, and improve consistency in subsequent NetBox migrations.
