Content
SOLVED: Cannot run openproject command from cli
Added by John Mink about 1 year ago
I am trying to run OpenProject on a minimal Ubuntu install (so it's possible there's a dependency I'm missing, please ask!), and the installation seems successful. However I am stuck when I try to run the openproject configure
command as it does not want to run. Please see output below:
root@4cf251a71cd3:/etc/openproject# openproject configure
Error: You must be executing as the user 'openproject' or with root privileges to launch commands.
Either log in as 'openproject', root, use sudo, or add sudo privileges for running openproject with your current user.
openproject@4cf251a71cd3:/etc/openproject$ sudo openproject configure
Error: You must be executing as the user 'openproject' or with root privileges to launch commands.
Either log in as 'openproject', root, use sudo, or add sudo privileges for running openproject with your current user.
openproject@4cf251a71cd3:/etc/openproject$ openproject configure
Error: You must be executing as the user 'openproject' or with root privileges to launch commands.
Either log in as 'openproject', root, use sudo, or add sudo privileges for running openproject with your current user.
openproject@4cf251a71cd3:/etc/openproject$ id
uid=999(openproject) gid=999(openproject) groups=999(openproject),27(sudo)
root@4cf251a71cd3:/etc/openproject# which openproject
/usr/bin/openproject
root@4cf251a71cd3:/etc/openproject# ls -al /usr/bin/openproject
-rwxr-xr-x 1 root root 15098 Jul 18 04:56 /usr/bin/openproject
Note: For installation I used the "package manager installation for Ubuntu 22.04" as described on https://www.openproject.org/docs/installation-and-operations/installation/packaged/
Update:
I tried making a change to ./usr/bin/openproject
(the result of which openproject
as it turns out it's just a bash script) by adding the following line echo "You are currently running as $(id -u)"
as shown below
# Some actions require root privileges
ensure_root() {
if [ $(id -u) -ne 0 ]; then
echo "Error: You must be executing with root privileges to use this command."
echo "Either log in as root, use sudo, or add sudo privileges for running ${APP_NAME} with your user."
echo "You are currently running as $(id -u)"
exit 1
fi
}
As a sanity check, I ran this and got 0, as expected.
~~root@004ccc63bdc2:/# id -u~~
~~0~~
I'm confused as to why, when I run ~~openproject configure~~
I don't see the debug line I added despite it being saved in the file. In fact, no changes to the file seem to be taking. Any insight as to why this is would be greatly appreciated!
Update #2:
I missed line 82 has a similar command where it checks for root OR app_user
(hence why it doesn't call the check_root
function). Adding my line there provides the output as expected.
Replies (2)
There are two things you can do that seemingly allow you to continue.
exit 1
command in the check.Obviously these are incomplete solutions that will likely cause errors down the line, but without more insight I'm at a loss for a more robust solution.
Update in case anyone else (including future me) stumbles across this issue.
The problem is I was attempting to automate too much and overwrote the entire /etc/openproject/ folder (except the installer.dat) when moving the installer.dat into that file.