consider dropping sudo from upgrade.sh #2129

Closed
opened 2025-12-29 17:22:31 +01:00 by adam · 1 comment
Owner

Originally created by @lukastribus on GitHub (Nov 16, 2018).

Proposed Changes

Dropping sudo from upgrade.sh, instead requiring the user to run upgrade.sh with sudo if needed (please continue reading).

Would contribute this change.

Justification

Automatically using sudo breaks virtualenv environments, pip will unexpectedly install the requirements into the global context as opposed to the virtualenv environment. While virtualenv is not something that the installation docs and scripts will cover and I agree that only a single official installation method should be supported, it is my opinion that not making too many assumption about the environment in upgrade.sh would be overall beneficial.

I do not think asking the user to run upgrade.sh from sudo if needed is too much to ask, when we consider all the other installation steps. As a matter of fact the entire installation requires most commands to be executed with root privileges (yum/apt-get/pip3), yet that entire part (about the actual netbox installation) does not mention sudo or root once (only the hash-sign suggest root privileges are required).

The specific virtualenv use-case could also be solved by making the code more complex just like with the previous root/sudo fix, required because of the sudo usage. Which of course would be the wrong thing to do.

It's fine that upgrade.sh will cover only a single setup type - but the disadvantages of using sudo here seem to outweigh the actual advantages in my honest opinion.

Originally created by @lukastribus on GitHub (Nov 16, 2018). <!-- NOTE: This type of issue should be opened only by those reasonably familiar with NetBox's code base and interested in contributing to its development. Describe the proposed change(s) in detail. --> ### Proposed Changes Dropping sudo from `upgrade.sh`, instead requiring the user to run upgrade.sh with sudo if needed (please continue reading). Would contribute this change. <!-- Provide justification for the proposed change(s). --> ### Justification Automatically using sudo breaks virtualenv environments, pip will unexpectedly install the requirements into the global context as opposed to the virtualenv environment. While virtualenv is not something that the installation docs and scripts will cover and I agree that only a single official installation method should be supported, it is my opinion that not making too many assumption about the environment in `upgrade.sh` would be overall beneficial. I do not think asking the user to run `upgrade.sh` from sudo if needed is too much to ask, when we consider all the other installation steps. As a matter of fact the entire installation requires most commands to be executed with root privileges (yum/apt-get/pip3), yet that entire part (about the actual netbox installation) does not mention sudo or root once (only the hash-sign suggest root privileges are required). The specific virtualenv use-case could also be solved by making the code more complex [just like with the previous root/sudo fix](https://github.com/digitalocean/netbox/commit/49f06cfeb29500b001ddfbada8d4456649ce9659#diff-5ce7b3249e6035414b5ff43296f85d5b), required because of the sudo usage. Which of course would be the wrong thing to do. It's fine that `upgrade.sh` will cover only a single setup type - but the disadvantages of using sudo here seem to outweigh the actual advantages in my honest opinion.
adam added the status: acceptedtype: feature labels 2025-12-29 17:22:31 +01:00
adam closed this issue 2025-12-29 17:22:31 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 30, 2018):

This change will be included in the v2.5 release.

@jeremystretch commented on GitHub (Nov 30, 2018): This change will be included in the v2.5 release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2129