26.0.1 Upgrade error: Missing indices, OCC not working, memcache(d) is installed

(Note: I have read the other “upgraded to 26.0.1 and got an error”-posts but they weren’t of any help to my particular issue)

Upgrading to 26.0.1 left me with a warning that the database has missing indices, specifically fs_parent and oc_filecache:

  • Databasen mangler nogle indekser. Da tilføjelse af indekser kan tage noget tid, blev de ikke tilføjet automatisk. Kør “occ db:add-missing-indices” for manuelt at tilføje disse indekser mens forekomsten forbliver aktiv. Når indekserne er tilføjet, er forespørgsler til disse tabeller normalt meget hurtigere.
  • Mangler index “fs_parent” i tabel “oc_filecache”.

For the record: OCC has never worked for me. Ever. So I didn’t expect it to work this time either.

$ sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
An unhandled exception has been thrown:
OCP\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)

I can’t see what “the matching PHP module” should be?

$ sudo apt install php8.1-memcache
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
php8.1-memcache is already the newest version (8.0+4.0.5.2+3.0.9~20170802.e702b5f9±7).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt install php8.1-memcached
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
php8.1-memcached is already the newest version (3.1.5+2.2.0-14.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Also for the record:
In config.php the entry: 'memcache.local' => '\OC\Memcache\APCu',

was actually formatted like this: 'memcache.local' => '\\OC\\Memcache\\APCu',

After referring to the page below, I removed the escaping \ and it made no difference
https://docs.nextcloud.com/server/22/admin_manual/configuration_server/caching_configuration.html


It may be a mix of issues - I don’t know - but I’m not sure where to start, so any help is appreciated. I may not be able to get back to you right away, but I will respond asap.


Nextcloud version (eg, 20.0.5): 26.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu Server 22.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.52
PHP version (eg, 7.4): 8.1

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

Steps to replicate it:

  1. upgrade to 26.0.1 from 25.x.x
  2. Log in as administrator
  3. Go to Overview (or equiv)
  4. Notice error message
  5. Spend working hours to fix said error message

I have nothing in the Nextcloud log.

Output of your config.php file:

$CONFIG = array (
'instanceid' => 'something',
'memcache.local' => '\OC\Memcache\APCu',
'default_phone_region' => 'DK',
'passwordsalt' => 'something',
'secret' => 'something',
'trusted_domains' =>
array (
0 => '10.0.0.10',
1 => 'something',
),
'datadirectory' => '/var/www/nextcloud/data',
'dbtype' => 'mysql',
'version' => '26.0.1.1',
'overwrite.cli.url' => 'http://10.0.0.10',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'oc_lmss',
'dbpassword' => 'something',
'installed' => true,
'twofactor_enforced' => 'false',
'twofactor_enforced_groups' =>
array (
),
'twofactor_enforced_excluded_groups' =>
array (
),
'maintenance' => false,
'theme' => '',
'loglevel' => 2,
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_smtpauth' => 1,
'mail_smtpname' => '',
'mail_smtppassword' => '',
'mail_smtpauthtype' => 'LOGIN',
'updater.secret' => 'something',
);

apt install php8.1-apcu

Thanks for a quick reply.

$ sudo apt install php8.1-apcu
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
php8.1-apcu is already the newest version (5.1.21+4.0.11-7ubuntu1).
php8.1-apcu set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ ps ax | grep apcu
1896 pts/0 S+ 0:00 grep --color=auto apcu

Try the following command:

sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/occ db:add-missing-indices

If that worked, and you don’t want to pass the extra parameter every time you run occ, you can add the following line to: /etc/php/8.1/mods-available/apcu.ini

apc.enable_cli=1

$ sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/occ db:add-missing-indices

Worked!

Thank you so much and have a nice weekend!

2 Likes