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

Hello,

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"
image

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

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:
image

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:
image

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ā€¦

https://www.neelc.org/posts/freebsd-azure-pkg/

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.
base-os

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?
image

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!
image

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

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

Sudo version shows as:
image

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.

2 Likes

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.