I can't update because sudo command "not found"


I had an issue where Nextcloud hang in a loop with the message “update in process”. After trying so many things, I decided to update manually.

I should say that Nextcloud runs on a FreeNas jail. When I login via PuTTy (see second picture), I have to use the command iocage console nextcloud for me to update, reinstall, or edit Nextcloud.

I have downloaded, saved data files and folders, and I’m ready to start the actual upgrade. The issue is that I need to do sudo -u www-data php occ upgrade but I get the following"

The thing is, sudo is installed but on a different path:

My question is, how to I point to the sudo command in order to install Nextcloud?

I do not think that sudo is installed on a “different path”.
In the first screenshot it is @nextcloud and on the second screenshot it is @freenas.

In the FreeNas jail sudo is not there.
Perhaps you can use su or you can perhaps install sudo . Read this

FreeNAS wasn’t that based on FreeBSD?

For freeBSD you can use su, make sure before on which user Nextcloud is running. www-data is the default user for Ubuntu/Debian systems. In FreeBSD it is just www, but for FreeNAS it can be different. The owner of the Nextcloud files and more specifically the owner of the files in data is most likely this user.

If the user is www:

su -m www -c ‘php occ upgrade’

I can’t use sudo or su. I get the same error message. I also read the post you directed me to but even when I tried installing sudo with the command pkg install sudo I get an error:

Did you try the command that @devnull posted with the full path to your Nextcloud installation folder? Like this…

su -m www -c 'php /usr/local/www/nextcloud/occ upgrade'

Yes I did:

Bu it told me to update PHP but when I tried to update it, I got his error now:

Now I’m trying to see what this pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2 is all about.

I found this related to your error…



Maybe you can fix it with pkg bootstrap -f or pkg-static bootstrap -f

But I’m not an expert when it comes to FreeBSD and iocgae. I do use TrueNAS, but only for storage.

Btw… The fact that you are talking about FreeNAS, tells me that your jails are still based on FreeBSD 11.x. Maybe it’s time to upgrade to TrueNAS Core…? :wink:

Regarding the pkg issue, I also tried several commands including the ones you suggested but I get the same error. Why is this so hard? :frowning:

Since yesterday, I’ve been trying to update from 11.3 to 12.0 but I get a “base-os” error that I do not know how to solve.

Currently, I can’t update Nextcloud because I need PHP 7.3 or higher but I can’t install php either because the ‘pkg update’ command won’t work either. I want to cry.

I managed to fix the pkg error. Before, it was expecting php to be at least 7.3 (it is now 7.4 after I upgraded it) and when I try to upgrade nextcloud with the same command it says that it could not open the file?

I found that occ is on a different directory:
Should I run the command there?

I assume you have already tried this in the meantime. And yes you should either specify the exact path to the occ file in the command or run the command from inside the directory where it resides. If it still doesn’t work, I don’t know what else it could be. Unfortunately I don’t know FreeBSD very well.

Thank you for helping me! I re-did the guide on how to manually update and right now is in this state… crossing fingers!

After following the guide in which it says to run this command

I don’t know why I get that sudo or that www-data is unknown even though they are there:

Sudo version shows as:

and the data folder is in there as well:

Where am I going wrong?

I don’t know either… Maybe you have to configure it first in order for it to work properly. But you don’t need sudo to execute those commands. Just use su -m www -c 'insert command here'

The example in your screenshot is meant to be used on Ubuntu/Debian based Linux distributions. Other distributions have diffrent names for the Apache user. In RedHat based distributions for example it’s called “httpd”, and in FreeBSD, which isn’t a Linux distribution btw, it’s called “www” apparently.

Yes. but “occ” is missing, among other things that should be there. And honestly, I’m not sure why that is, but you could try to execute the “updater.phar” directly…

su -m www -c 'php /usr/local/www/nextcloud/updater/updater.phar'

Thank you for all your help! I will make a new thread because I have anew error that is not ‘sudo’ anymore.


I just marked one of the solutions where the right command is. Regarding the packet manager and such stuff, that is more related to your operating system.

Perfect. We want to avoid endless threads with different issues mixed together.