Closed ozinfotech closed 3 years ago
For the fun of it, I restored from backup and then ran this command sudo apt-get install php-apcu
before I started the script. It still gave me the same error message as shown in the command output above. It was worth a shot.
Restoring from backup once more.
@enoch85 I thought we fixed this already in https://github.com/nextcloud/vm/blob/0ce7f6a4df250f468ea708381ab6eaa4b92d1611/nextcloud_update.sh#L375-L400 or is this maybe an older installation that doesn't have apcu installed via pecl?
@ozinfotech could you please post your config.php file here and the output of the three commands sudo php -m
and sudo apt list --installed | grep php
and sudo pecl list
? Thanks!
I got the same error yesterday, so there's something off with APCu... I don't know if it's Nextcloud or if it's APCu itself.
Workaround: change to Redis
for local cache in config.php
.
Made this commit for now: https://github.com/nextcloud/vm/commit/237871650ae6d046d61e7ed4575bc71c939ddfe4
I am not sure what this shall solve?
The reason for the issue is probably https://github.com/nextcloud/server/pull/25770 but I don't know how to solve it.
Honestly it looks like those lines should fix it https://github.com/nextcloud/vm/blob/0ce7f6a4df250f468ea708381ab6eaa4b92d1611/nextcloud_update.sh#L395-L400 but you've just disabled them.
OK, so we should revert to Redis for cache: https://github.com/nextcloud/server/pull/25770#issuecomment-784449441
but you've just disabled them.
Just tested on an old Nextcloud installation, and as long as APCu isn't updated it still works.
as long as APCu isn't updated it still works.
okay
@szaimen Can you prep a PR to remove APCu in the update script, and change to Redis in config.php?
I can do it n like 30 minutes if you don't have time right now.
Please do it yourself. I am busy currently.
Fix:
If you add apc.enable_cli=1
at the end of your php.ini
the error is not thrown and you can successfully update your db-indeces. Then reload your php-fpm
with whatever method your OS requires.
This is also needed if you use a separate config for php-fpm
(like FreeBSD does).
@MacLemon Thanks, we did that before, but it didn't work: https://github.com/nextcloud/vm/pull/2040/files#diff-b7160473976322a0318d460923cfed06da7b9612b80727132360613492d369b2L668
Fix: If you add
apc.enable_cli=1
at the end of yourphp.ini
Thanks a lot. It works fine on my Debian buster by adding this in /etc/php/7.3/mods-available/apcu.ini (global setting for both php-fpm and php-cli)
@ozinfotech could you please post your config.php file here and the output of the three commands
sudo php -m
andsudo apt list --installed | grep php
andsudo pecl list
? Thanks!
You bet. I wasn't sure if this was fixed or not so I tried to run the script again and still got the same error.
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
imap
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pgsql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
php-common/now 2:76+ubuntu20.04.1+deb.sury.org+9 all [installed,upgradable to: 2:84+ubuntu20.04.1+deb.sury.org+1]
php-imagick/now 3.4.4-5+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 3.4.4+php8.0+3.4.4-7+ubuntu20.04.1+deb.sury.org+1]
php-pear/focal,focal,now 1:1.10.9+submodules+notgz-1 all [installed,upgradable to: 1:1.10.12+submodules+notgz+20210212-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-bcmath/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-bz2/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-cli/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-common/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-curl/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-dev/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-fpm/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-gd/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-gmp/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-imap/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-intl/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-json/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-ldap/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-mbstring/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-mysql/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-opcache/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-pgsql/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-readline/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-soap/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-xml/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3-zip/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.3/now 7.3.20-1+ubuntu20.04.1+deb.sury.org+1 all [installed,upgradable to: 7.3.29-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-bcmath/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-bz2/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-cli/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-common/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-curl/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-dev/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-gd/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-gmp/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-imap/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-intl/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-json/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-ldap/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-mbstring/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-mysql/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-opcache/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-pgsql/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-readline/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-soap/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-xml/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
php7.4-zip/now 7.4.10-1+ubuntu20.04.1+deb.sury.org+1 amd64 [installed,upgradable to: 7.4.21-1+ubuntu20.04.1+deb.sury.org+1]
pkg-php-tools/focal,focal,now 1.38 all [installed,automatic]
Installed packages, channel pecl.php.net:
=========================================
Package Version State
apcu 5.1.18 stable
igbinary 3.1.5 stable
redis 5.3.4 stable
@ozinfotech
I tried to run the script again
Which script?
@enoch85
sudo bash /var/scripts/menu.sh
@ozinfotech Run sudo bash /var/scripts/update.sh
instead.
@enoch85 I'll be doing this in about an hour. Is that the script I want to run in the future as well? (As in, I need to forget about the menu.sh script?)
Either one works.
The update.sh
script always gets the latest nextcloud_update.sh
script and runs it, and the menu.sh
scipt makes it possible to get the latest update.sh
script.
Unfortunately I am still getting the same error message. I'm sorry I'm such a problem child.
Yes, the issue is now fixed: https://github.com/nextcloud/vm/pull/2040
@enoch85 I just ran it again after I saw your message from a few minutes ago. Still getting the same errors. I'm not seeing any changes from the screenshot above. Maybe I need to pay for a one-on-one session?
Just upgraded to the latest "stable" release and got the same error. Now stuck in the maintenance mode :(
I used to upgrade using web UI, but it started timing out on me about 6 months ago, and I switched to using updater.phar
. updater.phar
never failed until today with this error. The fix was to follow the advises above:
php-apcu
moduleapc.enable_cli=1
in /etc/php/7.x/mods-available/apcu.ini
php-fpm
sudo -u www-data php updater/updater.phar
to finish the update to the latest versionThank you so much @MacLemon @bruno666!
Maybe I need to pay for a one-on-one session?
@ozinfotech Do as you please. :)
@enoch85 30 minutes or 1 hour? I'm not sure how long it will take. Hopefully mine is an edge case, but if you get it figured out you'll be able to merge it into this fix for any other edge cases out there.
For those who run NC on a shared hosting provider (that isn't installed through Softiculous or other auto-install/update program):
Took me a while to figure out how Redis worked in these environments. On the one we use (HawkHost), the Redis socket is found at ~/.applicationmanager/redis.sock (ps ax | grep redis ---> redis-server 127.0.0.1:0
)
This is how I configured it to work in NC's config/config.php:
'memcache.local' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => '/home/XXX/.applicationmanager/redis.sock',
'port' => 0,
),
'memcache.locking' => '\\OC\\Memcache\\Redis',
Hope this helps people who faced the same problem.
The mentioned fix also works great on PHP 8.0, i.e., by adding apc.enable_cli=1
to /etc/php/8.0/mods-available/apcu.ini
after installing php8.0-apcu
.
The mentioned fix also works great on PHP 8.0, i.e., by adding
apc.enable_cli=1
to/etc/php/8.0/mods-available/apcu.ini
after installingphp8.0-apcu
.
Also worked for me after an upgrade from NC 21.0.2.1 to 21.0.3.1 which caused occ and cron to fail, now working again. Thanks!
I ran yesterday into this issue, and could not fix it. There is also a forum topic describing this problem: https://help.nextcloud.com/t/upgrade-failed-because-of-apcu-now-disabled/120092 I added my specific situation there as a comment.
Did you restart PHP or the server? That was required for me.
Did you restart PHP or the server? That was required for me.
Yes, I did.
I used to upgrade using web UI, but it started timing out on me about 6 months ago, and I switched to using
updater.phar
.updater.phar
never failed until today with this error. The fix was to follow the advises above:
- install
php-apcu
module- set
apc.enable_cli=1
in/etc/php/7.x/mods-available/apcu.ini
- restart
php-fpm
- re-run
sudo -u www-data php updater/updater.phar
to finish the update to the latest versionThank you so much @MacLemon @bruno666!
This worked like a charm on Ubuntu server 20.04 running php 7.4
. Thanks for posting!
Well, I tried again using some of the previous suggestions from a backup and ended up with this error now. It's gone all circular. Memcache \OC\Memcache\Redis not available for local cache
These are the steps I had taken. I determined my php version:
php -v
I had version 7.4 so I then installed apcu.
sudo apt-get install php7.4-apcu
I had to modify the following files that were created from the php apcu install: /etc/php/7.4/mods-available/apcu_bc.ini
; extension=apc.so
apc.enable_cli=1
/etc/php/7.4/mods-available/apcu.ini
; extension=apc.so
apc.enable_cli=1
I restarted apache.
sudo service apache2 restart
I ran the update script again.
sudo bash /var/scripts/update.sh
Boom, got the new error message:
Memcache \OC\Memcache\Redis not available for local cache
@ozinfotech
Strange. We actually purge APCu from the system since it's unreliable.
Please post the contents of
Thanks!
and could not fix it
Finally, I managed to finalize the upgrade. This is what I did:
In the file config/config.php
I out-commented this line:
'memcache.local' => '\OC\Memcache\APCu',
Then I ran:
sudo -u http /usr/local/bin/php73 /volume1/web/nextcloud/occ upgrade
sudo -u http /usr/local/bin/php73 /volume1/web/nextcloud/occ maintenance:mode --off
And then I added to the file config/config.php
this line again (the outcommented line was complety gone):
'memcache.local' => '\OC\Memcache\APCu',
With that line added occ
does not work any more on the command line (cli), but I can make it work by applying the above mentioned procedure.
The issue here is that you're not on the current version of PHP.
I will fix that in another PR.
No need to make another PR for that since the first thing that happens in the update script is that it's changed to Redis: https://github.com/nextcloud/vm/blob/master/nextcloud_update.sh#L58-L69
So even if APCu is installed, it won't be activated in Nextcloud.
Run sudo bash /var/scripts/menu.sh
and choose "Update minor", then everything should be sorted. We implemented the fix several weeks ago.
@enoch85 here you go!
@ozinfotech Thanks!
Just run sudo bash /var/scripts/menu.sh
--> Update minor/major, and everything should be sorted.
Steps to reproduce
sudo bash /var/scripts/menu.sh
Expected behavior
The update usually completes without any hiccups.
Actual behavior
The script errors out with the following message:
Server configuration
Nextcloud server version: 21.0.2
Server OS 20.04.2 LTS
PHP Version 7.4
How did you install the VM? (Scripted install from master OR Released version) Purchased from TechAndMe.se
Network
Do you use DHCP? No
Is port 80 and/or 443 open? Yes to both
Logs / Screenshots
Log file (/var/log/nextcloud/nextcloud.log)
Installation log (command output)