Can't update from CLI (updater doesn't find the update)

Nextcloud version (eg, 20.0.5): 20.0.14
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.29
PHP version (eg, 7.4): 7.4

The issue you are facing: I can’t update. Channel stable.

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it (please, note I haven’t been able to upgrade through the web, since it usually gets stuck, so I use cli)

# sudo -u www php /updater/updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 20.0.14.

**No update available.**

Nothing to do.
# sudo -u www php occ update:check
Nextcloud 21.0.7 is available. Get more information on how to update at https://docs.nextcloud.com/server/21/admin_manual/maintenance/upgrade.html.
**1 update available**
# sudo -u www php  ./occ upgrade
**Nextcloud is already latest version**

The output of your Nextcloud log in Admin > Logging:

Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Template/Base.php#68	
2022-02-05T12:41:37+0100
Warning	files_antivirus	Failed to write a chunk. Check if Stream Length matches StreamMaxLength in anti virus daemon settings	
2022-02-05T12:05:20+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Template/Base.php#68	
2022-02-05T11:59:41+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Template/Base.php#68	
2022-02-05T11:59:31+0100
Error	PHP	Error: Uninitialized string offset: 0 at NextcloudDir/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php#40	
2022-02-05T11:59:00+0100
Error	PHP	Error: Trying to access array offset on value of type null at NextcloudDir/apps/onlyoffice/lib/Migration/MimeRepair.php#92	
2022-02-05T11:59:00+0100
Error	PHP	Error: Undefined index: oform at NextcloudDir/apps/onlyoffice/lib/Migration/MimeRepair.php#92	
2022-02-05T11:59:00+0100
Error	PHP	Error: Trying to access array offset on value of type null at NextcloudDir/apps/onlyoffice/lib/Migration/MimeRepair.php#91	
2022-02-05T11:59:00+0100
Error	PHP	Error: Undefined index: docxf at NextcloudDir/apps/onlyoffice/lib/Migration/MimeRepair.php#91	
2022-02-05T11:59:00+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Template/Base.php#68	
2022-02-05T11:58:48+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:58:23+0100
Error	PHP	Error: proc_close() has been disabled for security reasons at NextcloudDir/apps/files_antivirus/lib/Scanner/LocalClam.php#69	
2022-02-05T11:58:22+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:44+0100
Error	PHP	Error: proc_close() has been disabled for security reasons at NextcloudDir/apps/files_antivirus/lib/Scanner/LocalClam.php#69	
2022-02-05T11:57:35+0100
Error	PHP	Error: proc_close() has been disabled for security reasons at NextcloudDir/apps/files_antivirus/lib/Scanner/LocalClam.php#69	
2022-02-05T11:57:35+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:29+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:28+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:28+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:26+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:26+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:26+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:25+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Template/Base.php#68	
2022-02-05T11:57:22+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:18+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:18+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:18+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:18+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:18+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/appinfo/routes.php) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Route/Router.php#134	
2022-02-05T11:57:18+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Template/Base.php#68	
2022-02-05T11:57:11+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Template/Base.php#68	
2022-02-05T11:53:18+0100
Error	PHP	Error: file_exists(): open_basedir restriction in effect. File(/templates/) is not within the allowed path(s): (user/www:user/files:user/tmp:/usr/bin/clamscan) at NextcloudDir/lib/private/Template/Base.php#68

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

PASTE HERE

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

The first command

sudo -u www php /updater/updater.phar

seams to be wrong, missing at least a .

So it should be:
# sudo -u www php ./updater/updater.phar

Or similar. With a leading / you would probably have something like /var/www/…

If this is just a typo from the post, then look at your clamav installation and the owner and permissions of the nextcloud folders.

Best, Bernd

Hi lebernd. As you can see, the command runs correctly and returns

Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 20.0.14.

**No update available.**

Thanks anyway.

Hi @lmarcos

I almost thought so when writing - maybe you find something usefull here:

Best, Bernd

The patch didn’t work :frowning:

Well, the problem I’m having is that when it runs, it returns a Nextcloud installation up to date.

But thanks, anyway.

Anyone has any idea why I can’t update either manually or with occ upgrade? If I tried manually, the version it downloads is the last one, so it won’t update. If I try the command line, it says it’s up to the latest version. I’ve tried with several php versions, but there’s some incompatibilities among different Nextcloud and php versions.

Ok, I’m downloading from the log the older versions one by one. Let’s see how far I can go.

After updating manually to 22.2.6 or something, I was finally able to use the updater to continue and now I’m finally updated.

To go from 20 to 21 I had to use php 7.4 and to get rid of one of the errors in 25 I had to switch to php 8.1. Latest php 8.2 also returns an error.

I’m now basically trying to fix permissions on data folder, which I moved during the update process, and the cron.php.

Edit: cron was fix by appending --define apc.enable_cli=1 to the php call.