Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
18.9.0
-
Unknown
-
Description
The postrm of xwiki-tomcat10-common restarts Tomcat whatever dpkg calls it for (xwiki-platform-distribution-debian-tomcat10-common/src/deb/control/postrm, same on master):
invoke-rc.d --quiet tomcat[[debian.tomcat.version]] restart || { ... }
During an upgrade dpkg calls it as old-postrm upgrade new-version, right after unpacking the new xwiki-tomcat10-common (Debian Policy 6.6, "Details of unpack phase of installation or upgrade"). apt unpacks xwiki-tomcat10-common before xwiki-common, so Tomcat starts XWiki while dpkg is still replacing the JARs and XARs of xwiki-common. A minute later the postinst of xwiki-tomcat10-<db> restarts Tomcat again, usually while that first instance is still initializing. Both show up as errors.
Measured on Debian 13, xwiki-tomcat10-pgsql, plain apt upgrade (/var/log/dpkg.log and journalctl -u tomcat10):
18.7.0 → 18.8.0 (2026-10-14): the running instance loses its JARs. Tomcat restarted at 02:29:49 by the old postrm, xwiki-common unpacked 02:29:49 - 02:29:59. At 02:30:32, 78 errors for 26 different extensions:
ERROR [Core extension repository updater] ...DefaultExtensionRepositoryManager - Unexpected error when trying to find extension [...] caused by: java.nio.file.NoSuchFileException: /usr/lib/xwiki/WEB-INF/lib/xwiki-platform-crypto-store-wiki-18.7.0.jar
18.8.0 → 18.9.0 (2026-10-28): the instance is stopped in the middle of its start.
| time | event |
|---|---|
| 15:43:41 - 15:43:42 | upgrade xwiki-tomcat10-common 18.8.0 18.9.0; the old postrm stops and starts Tomcat |
| 15:43:42 - 15:43:50 | xwiki-common unpacked, while that Tomcat starts XWiki |
| 15:44:56 | the postinst of xwiki-tomcat10-pgsql stops Tomcat |
| 15:45:32 | still in that instance: the errors below |
| 15:45:41 | Tomcat started again, now on the complete files |
85 x ERROR ...XarInstalledExtensionRepository - Failed to parse extension [...] Error reading Zip content, caused by java.nio.channels.ClosedByInterruptException ISPN000660: Cache lesscss.skinfiles.cache start failed ...DefaultObservationManager - Failed to send event
Later restarts did not show these errors again, so nothing seems to stay broken, but every upgrade fills the log with errors that look like a broken installation.
The same postrm exists in xwiki-platform-distribution-debian-tomcat11-common.
Suggested fix
Restart Tomcat in the postrm only when the package is really removed. On upgrade the postinst of xwiki-tomcat10-<db> already restarts it once everything is configured:
case "$1" in remove|purge) invoke-rc.d --quiet tomcat[[debian.tomcat.version]] restart || { RESULT=$? # Ignore if tomcat[[debian.tomcat.version]] init script does not exist (yet) if [ $RESULT != 100 ]; then exit $RESULT fi } ;; esac
Workaround
Mask Tomcat for the duration of the upgrade; invoke-rc.d then exits 0 without starting it, and the postinst of xwiki-tomcat10-<db> skips it (is-active and is-enabled both fail). Stop it before masking it: a masked unit loses its configuration, so a stop after the mask ignores SuccessExitStatus=143 and leaves tomcat10 "failed".
systemctl stop tomcat10 systemctl mask --runtime tomcat10 apt upgrade systemctl unmask --runtime tomcat10 systemctl start tomcat10
Analysis done with Claude Code Opus 5.5 Max Ultracode