Upgrade failed because of APCU, now disabled

Nextcloud version (eg, 20.0.5): 21.0.3
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.x (irrelevant)
PHP version (eg, 7.4): 7.4.21

The issue you are facing:
I upgraded Nextcloud from 20.x to 21.x using the shell upgrade script. It replaced the files fine but the occ part failed with this message:

An unhandled exception has been thrown:
OC\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)

The APCU module is available, according to the output of phpinfo(). I don’t know what else to do.
To try to resolve the error, I edited config.php and commented out a line that looked similar, it contained something with apcu. I cannot quote it now because it was finally deleted by the upgrade. After deleting that line the occ upgrade worked and I can use Nextcloud again. Am I missing something now without that line, besides having back a functional system? Should I care about that deleted line or is it irrelevant and just troublesome?

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

The output of your Nextcloud log in Admin > Logging:

Where is this? Can't find it.

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

<?php
$CONFIG = array (
  'passwordsalt' => '****',
  'secret' => '****',
  'trusted_domains' =>
  array (
    0 => '****',
  ),
  'datadirectory' => '****',
  'overwrite.cli.url' => '****',
  'htaccess.RewriteBase' => '/',
  'dbtype' => 'pgsql',
  'version' => '21.0.3.1',
  'dbname' => '****',
  'dbhost' => '****',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '****',
  'dbpassword' => '****',
  'installed' => true,
  'instanceid' => '****',
  'mail_domain' => '****',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'noreply',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mail_smtpauth' => 1,
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => '****',
  'mail_smtpsecure' => 'tls',
  'mail_smtpport' => '587',
  'mail_smtpname' => '****',
  'mail_smtppassword' => '****',
);

(not much left after masking private data)

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

(empty)

Short update: I found the documentation linked in one of the admin pages. I re-added that line to my config.php and everything still worked, also the warning on that info page disappeared.

But it also said I should update some database indexes. When I tried, with the provided occ command (I had to prefix it with “php”), I got the same error message about APCU again. So I commented the cache line in config.php, ran occ, uncommented it again and the web UI is still there and that warning also disappeared.

Something seems to have changed with the occ program in Nextcloud 21. It still upgraded from 20.x to 20.x but then the next major upgrade failed.

1 Like

I experienced the same error. Setting
apc.enable_cli=1 resolved the error for me. According to Nextcloud documentation this should be set for APCU anyhow.

2 Likes

Where does that setting go? In what file?

Check-out the PHP apcu.ini file, which e.g. exists on my server in

/etc/php7/cli/conf.d/apcu.ini
/etc/php7/fpm/conf.d/apcu.ini
1 Like

I also ran into this problem, and unfortunately, I could not solve it until now. It also happened on an upgrade of nextcloud 20 to nextcloud 21.
I did find this issue that describes the problem as well:

I tried to enable in all php.ini files that I could find:
apc.enable_cli=1
but still I get the error.

I have Nextcloud running on a Synology, which has a bit of an uncommon way of configuring things. This complicates the issue for me.

So, at the moment I’m stuck with a broken Nextcloud. Does anyone have a suggestion on how to finish the upgrade?

This requirement seems like bad design. Google has mostly Nextcloud trouble on page 1 for this PHP setting. And the PHP documentation does not even recommend this configuration:

apc.enable_cli int
Mostly for testing and debugging. Setting this enables APC for the CLI version of PHP. Under normal circumstances, it is not ideal to create, populate and destroy the APC cache on every CLI request, but for various test scenarios it is useful to be able to enable APC for the CLI version of PHP easily.

1 Like

In my case, I managed to work around this problem as described here.

@janvlug That’s exactly what I described in my first post in this topic.