Repository navigation
Description
Summary
The automatic NCP main update (v1.58.0 → v1.59.0, cron job /etc/cron.daily/ncp-autoupdate)
took my Nextcloud instance completely offline. Apache kept serving requests, but no PHP handler
was left, so index.php was delivered as plain text and /login returned 404. Nextcloud's own
log stayed empty, because no PHP was running to write to it.
Three independent problems combined into a total outage:
ncp-update-nc.d/upgrade-php-trixie-8.5.shremoves allphp8.3-*packages first and only
then tries to installphp8.5. Any failure in between leaves the system with no PHP at all.- The installer targets
-t "$RELEASE", whereRELEASEcomes fromncp.cfg. That file still
contained"release": "bookworm"although the system runs Debian 13 (trixie), so the
install step could never succeed. php_restore()then writes a new/etc/apt/sources.list.d/php.listnext to the existing
php.sources. Both pin differentSigned-Bykeyrings, so apt refuses to read the source list
at all – every lateraptcall fails, including a manual reinstall of PHP 8.3.
On top of that, the rollback trap prints PHP upgrade has been successfully reverted although
nothing was restored. That message is actively misleading: it hides the outage during unattended
runs and sends the operator down the wrong path.
Environment
| Hardware | Raspberry Pi 4 Model B Rev 1.5 (arm64) |
| OS | Armbian 26.8.3, Debian 13 trixie |
| NCP | v1.58.0 → v1.59.0 (pulled automatically at 06:25) |
| PHP before | 8.3.36 from packages.sury.org (debsuryorg-archive-keyring 2025.11.18) |
| PHP after | none (php -v → command not found) |
| Nextcloud | 33.0.10 → auto-update target 34.0.5 |
| Web server | Apache 2.4.68 (mpm_event) + mod_proxy_fcgi → /run/php/php8.3-fpm.sock |
/usr/local/etc/ncp.cfg at the time of the failure:
{ "release": "bookworm", "php_version": "8.3", "nextcloud_version": "34.0.2" }Steps to reproduce
- Install NCP on a trixie system where
ncp.cfgstill carries"release": "bookworm"
(observed after an in-place bookworm → trixie upgrade). - Let NCP v1.59.0 (or later) install itself via
/etc/cron.daily/ncp-autoupdate, or run
sudo ncp-update. ncp-updatere-rolls/usr/local/bin/ncp-update-nc.d/and startsnc-autoupdate-ncin the
same run, soupdate-nc.shpicks the new branch
elif ! is_more_recent_than "33.0.0" "$NCVER" && is_more_recent_than "8.5.0" "$PHPVER.0" && DEBIAN_VERSION -ge 13
and callsupgrade-php-trixie-8.5.sh.- Watch
/var/log/ncp.logand/var/log/apt/history.log.
Expected behaviour
Either the upgrade to PHP 8.5 succeeds, or the system stays on a working PHP 8.3. A failed
upgrade must never leave the web server without a handler.
Actual behaviour
06:25 ncp-autoupdate: Downloading updates … Performing updates
06:25 all files in ncp-update-nc.d/ get the run's timestamp, incl. upgrade-php-trixie-8.5.sh
06:25 Running nc-autoupdate-nc
06:46 apt: php8.3-* removed (--purge), php8.5 never installed
06:46 E: Conflicting values set for option Signed-By regarding source
https://packages.sury.org/php/ trixie:
debsuryorg-archive-keyring.gpg != deb.sury.org-php.gpg
06:46 E: The list of sources could not be read.
06:46 "PHP upgrade has been successfully reverted" <-- nothing was reverted
Aftermath on the box:
systemctl status php8.3-fpm→Unit php8.3-fpm.service could not be found/etc/apache2/conf-available/php8.3-fpm.confgone,a2query -m proxy_fcgi→ not enabledcurl -k -sS https://127.0.0.1/status.php→ HTML source instead of JSON/var/log/nextcloud/nextcloud.logunchanged since the night (nothing runs, nothing logs)apt-cache policy php8.3-cli→E: Conflicting values set for option Signed-By …
Root cause analysis
A. Purge-before-install ordering.
upgrade-php-trixie-8.5.sh runs
apt-get remove --purge -y "${PHP_PACKAGES_OLD[@]}"as the very first action of the main routine. There is no snapshot, no dependency-guarded
replacement, and no check that the target packages are actually installable. A single failure
later in the script is fatal for the whole service.
B. release taken from ncp.cfg without validating it against the running distribution.
/usr/local/etc/library.sh around line 58:
RELEASE=$(jq -r .release < "$NCPCFG")ncp.cfg is not migrated on a distribution upgrade, so bookworm survived into a trixie system.
The install step uses apt-get install -t "$RELEASE" … and fails.
C. Rollback writes a conflicting source file.
The php_restore() trap does roughly
echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ trixie main" \
> /etc/apt/sources.list.d/php.listDebian's deb822 php.sources (created earlier, keyring deb.sury.org-php.gpg) is left in place.
Two files, one URI, two different Signed-By values → apt aborts. This turns a recoverable
situation into a locked package manager, and it happens during the rollback path, i.e. exactly
when the system needs to install packages.
D. Success message without verification.
The trap reports success unconditionally. A rollback path should verify
php -v / systemctl is-active php8.3-fpm before printing "successfully reverted", otherwise the
message is worse than silence.
Impact
Complete unavailability of the Nextcloud instance until manually repaired (in my case ~6 hours,
because it happened during the night and the operator had to diagnose it first). Recovery required
manually restoring the sury source, disabling php.sources, resetting release to trixie,
reinstalling PHP 8.3 and re-enabling the FastCGI configuration.
Proposed fixes
-
Validate
RELEASEagainst the running distribution and refuse to continue on a mismatch:DEBIAN_VERSION=$(lsb_release -sc) if [ "$RELEASE" != "$DEBIAN_VERSION" ]; then echo "ncp.cfg release '$RELEASE' does not match running '$DEBIAN_VERSION' – aborting PHP upgrade" >&2 exit 1 fi
-
Never purge before the new packages are installable. Use
apt-get install -s -t "$RELEASE" php8.5-fpm …as a pre-flight, or install 8.5 alongside 8.3
and only remove 8.3 afterphp8.5-fpmreportsactive. -
Make
php_restore()idempotent and non-conflicting. Either rewrite the existing
php.sources(deb822) instead of creatingphp.list, or move/disablephp.sourcesfirst.
A single source definition per URI is enough. -
Verify the rollback before announcing it:
if php -v >/dev/null 2>&1 && systemctl is-active --quiet php8.3-fpm; then echo "PHP 8.3 restored" else echo "ROLLBACK FAILED – no working PHP, manual intervention required" >&2 fi
-
Do not re-roll
ncp-update-nc.d/and triggernc-autoupdate-ncin the same run, or at
least honour an explicit opt-out. Users who pin a PHP version currently have no way to stay
pinned: the stub is restored on every NCP main update and the same run executes it.
Workaround for affected users
# 1. Unblock apt – keep only one sury source definition
sudo mv /etc/apt/sources.list.d/php.sources /etc/apt/sources.list.d/php.sources.disabled
# 2. Align ncp.cfg with the running distribution (backup first)
sudo cp /usr/local/etc/ncp.cfg /root/ncp.cfg.bak
sudo jq '.release = "trixie"' /usr/local/etc/ncp.cfg > /tmp/ncp.cfg && sudo mv /tmp/ncp.cfg /usr/local/etc/ncp.cfg
# 3. Reinstall PHP 8.3 and restore the Apache handler
sudo apt-get update && sudo apt-get install -y php8.3 php8.3-fpm php8.3-cli php8.3-{curl,gd,imagick,intl,mbstring,mysql,opcache,readline,xml,zip,bcmath,gmp}
sudo a2enmod proxy_fcgi && sudo a2enconf php8.3-fpm && sudo systemctl restart php8.3-fpm apache2
# 4. Prevent the upgrade path from running again
sudo chmod a-x /etc/cron.daily/ncp-autoupdate /etc/cron.daily/ncp-autoupdate-nc
sudo cp /usr/local/bin/ncp-update-nc.d/upgrade-php-trixie-8.5.sh{,.original}
printf '#!/bin/bash\n# UPGRADE DISABLED – see upstream issue\nexit 0\n' | sudo tee /usr/local/bin/ncp-update-nc.d/upgrade-php-trixie-8.5.sh >/dev/null
# 5. Verify
curl -k -sS https://127.0.0.1/status.php # must return JSON with "installed":trueAdditional note
The same run also raised nextcloud_version handling questions on my box, but I could not tell
whether 34.0.5 was expected at that point – the PHP purge is the part I am confident about, and
it is the one that caused the outage.
Happy to test a patched upgrade-php-trixie-8.5.sh on this machine (arm64, trixie, NCP v1.59.0).
Activity
martinwilco commentedon Nov 8, 2026
I had the same problem. ncp.cfg said "bookworm" and PHP 8.4, but "trixie" and PHP 8.4 were installed.
I manually changed it to "trixie" and then ran the update again. This time, it aborted due to an error with PHP 8.5 posix.
Adding the following line to
upgrade-php-trixie-8.5.shafter "apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_NEW[@]}"" made the update finish successfully:chmod 755 "/etc/php/${PHPVER_NEW}" "/etc/php/${PHPVER_NEW}/mods-available"I now have a working NCP 1.59.0 instance with NC 34.0.5 and PHP 8.5.12.
Habrokomes commentedon Nov 8, 2026
Thank you. I'm on an RPI 5 with Armbian Trixie, the automatic update killed my NCP completely. The workaround worked with no problems at all. I needed to run clear-php-opcache to clear up the WebDav connection, and then everything was running again.
schoetju commentedon Nov 9, 2026
Hi all, i am using debian install (on some old thin client) - and the update crashed my instance too.
I am sharing few lines out of /var/log/ncp.log that are showing, where it went wrong.
Steps that i've taken as of now
sudo chmod a-x /etc/cron.daily/ncp-autoupdate /etc/cron.daily/ncp-autoupdate-nc3.1 "Adding the following line to upgrade-php-trixie-8.5.sh after "apt-get install -y --no-install-recommends -t "$RELEASE" "${PHP_PACKAGES_NEW[@]}"" made the update finish successfully:
chmod 755 "/etc/php/${PHPVER_NEW}" "/etc/php/${PHPVER_NEW}/mods-available"
3.2 Started the script upgrade-php-trixie-8.5.sh standalone (to see, that at least the PHP update is working fine --> it does).
Finally i did the nextcloud update (by starting nc-update-nextcloud).
All in all: Reached Nextcloud 34.0.5 and PHP 8.5.12 !
the workaround
armanian commentedon Nov 12, 2026
same here
Glujaz commentedon Nov 13, 2026
Just got impacted today...
Glujaz commentedon Nov 13, 2026
I solved the issue this way :
I modified /usr/local/etc/ncp.cfg and used Trixie instead.
Reinstalled PHP8.3 (commands suggested above)
And simply ran :
/usr/local/bin/ncp-update-nc.d/upgrade-php-trixie-8.5.sh.Nextcloud was in maintenance mode after that, but this is easy to disable
Now it is running perfectly, and I could do some nextcloud and nextcloudpi updates flawlessly.
armanian commentedon Nov 14, 2026
I hope there will be a fix for this soon.
Glujaz commentedon Nov 14, 2026
I mean, I proposed a commit 2 months ago for another bug, and yesterday during the fix, a "updated" nextcloudpi (it juste reinstalled the current version), and replaced my fix with the original problem. #2145
And I know that nextcloudpi is getting deprecated... But it is the easiest solution for bare metal installation without docker.
ApricotFarm commentedon Nov 16, 2026
@Glujaz Wait -- NCP is getting deprecated? Is there some kind of official statement of this?
ApricotFarm commentedon Nov 16, 2026
Same problems as OP. I'm with @armanian ; I really hope there will be a fix for this soon. I've been using NCP for years now, and the upgrades have always gone smoothly for me. I really appreciate the work that folks have put in here on developing a workaround, but it would be great if the official installer/upgrader could handle this smoothly.
Glujaz commentedon Nov 16, 2026
It is supposed to be replaced by Nextcloud atomic, but this project seems to be dead or not very active anymore...
m-breitbach commentedon Nov 18, 2026
Sadly I also need to consider migrating away after many years using NextcloudPi. Probably moving to https://github.com/nextcloud/all-in-one, but the migration will be the funny part (NC versions must match exactly for a full migration, plus database conversion from MariaDB to Postgres).
Knubbel commentedon Nov 18, 2026
I am very grateful for the time the developers invest into this project, so kudos to @theCalcaholic and all others for a great project!
Is there anything I or we can do to help you fix this issue?
garternicht commentedon Nov 22, 2026
I can confirm that simply adding:
chmod 755 "/etc/php/${PHPVER_NEW}" "/etc/php/${PHPVER_NEW}/mods-available"to the last line of
/usr/local/bin/ncp-update-nc.d/upgrade-php-trixie-8.5.shleads to a smooth upgrade from nextcloud 33.0.10 to 33.0.11 and from php 8.3 to 8.5 in one single step. Upgrading to 34.0.6 afterwards was without issues as well.