Open ndj888 opened 1 year ago
Hello nextcloud team,
I have this problem as well. When I update from 27.0.2
to 27.1.2
I get the following output from the occ upgrade
command:
Turned on maintenance mode
Updating database schema
Exception: Database error when running migration 28000Date20230803221055 for app core
An index with name 'tp_tasks_uid_appid_ident' was already defined on table 'oc_textprocessing_tasks'.
Update failed
Maintenance mode is kept active
Resetting log level
Best regards Imker
@imker25 The upgrade process caused a user data directory error, which I successfully fixed using the following two commands. cd to your nextcloud root dir then
php occ maintenance:repair
php occ files:scan-app-data
Community Docker image
Which Docker image? What was the Docker log output from the upgrade when you recreated the container? Can you provide your Compose file?
The upgrade process caused a user data directory error
This one from your original report or some other one?
file_get_contents(/var/www/html/data/appdata_oczcy358mcjy/js/core/merged-template-prepend.js.deps): Failed to open stream: No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#305
I successfully fixed using the following two commands...
Am I to understand from your most recent comment that you resolved the reported situation in this issue entirely by running occ files:scan-app-data
?
@imker25 Other than being an issue with upgrading, unless I'm missing something your matter has nothing to do with this one (at least based on the output your provided). Please create a dedicated issue for it.
@joshtrichards I'm using the nextcloud:fpm-alpine image from hub.docker.com, and the database is PostgreSQL 15.4. In fact, to fix this issue, I tried the following steps:
Executed 'php occ files:cleanup.' Ran 'php occ files:scan --all.' Executed 'php occ files:app-scan.
@joshtrichards As you suggested I created a new issue for my problem #41227
Thanks for your help imker
EDIT: It seems that the following issue I had is resolved now. There was a bigger issue with my reverse proxy, and I pruned my docker and redeployed my stack. Now everything works fine. I don't know whether the repair steps (maintenance:repair + files:scan-app-data) helped with resolving this, I did those before the prune.
It seems to me that I have a similar if not the same issue after my upgrade to 27.1.3.2 (maybe I missed the 27.1.2.1):
Error no app in context JSCombiner: unable 2023-11-01T22:53:17+01:00
to cache:
merged-template-prepend.js
Error PHP file_put_contents(/var/www/html/data/appdata_[...]/js/core/merged-template-prepend.js): 2023-11-01T22:53:17+01:00
Failed to open
stream: No such
file or directory
at
/var/www/html/lib/private/Files/Storage/Local.php#313
I tried the cleanup, scan-app-data and repair, but if at all it only fixed it temporarily. File system permissions are set to www-data, though only for the directory (js/core) as there is no merged-template-prepend.js (since JSCompiler is unable to create it). I will run a files:scan --all tonight, but I have no hopes for that, because I don't see the connection to the issue there. Before the update everything worked like a charm, I guess the maintenance cleanup of the update resulted in whatever this is. I honestly have no idea where this symptom stems from, so any help on the OPs issue would be highly appreciated.
I had the same problem when upgrading to 27.1.5.1 yesterday. Not sure from which version, but I've started using Nextcloud about a month ago and this was my very first upgrade. I applied the steps mentioned by ndj888 and it seems to work again.
Just to add more info, hope it will help at least a bit: I am using reverse proxy, which I misconfigured a bit and it started to show after the upgrade (probably because I or the upgrade recreated the master container with a bit modified setting that wasn't applied before, see https://help.nextcloud.com/t/getting-503-service-unavailable-after-upgrade-to-27-1-5-1/178928 for details). Anyway when trying to figure out the reverse proxy bug I restarted the containers and tried restoring older version of docker volumes a few times, which might have had an impact.
I had the same problem after upgrading stepwise from Nextcloud 23 to 28 None of the mentioned occ commands helped.
I used phpmyadmin and removed the entry containing "merged-template-prepend.js.deps" from the oc_filecache table.
I had the same problem after upgrading stepwise from Nextcloud 23 to 28 None of the mentioned occ commands helped.
I used phpmyadmin and removed the entry containing "merged-template-prepend.js.deps" from the oc_filecache table.
I ran into this problem when updating from 27.1.6 to 27.1.7. This solution worked for me after the others in this thread did not.
Related: #44576 and possibly #44128
@ndj888 Can you share your Docker Compose file? The equivalent to php occ maintenance:repair
is already triggered during the occ upgrade
run used by the Docker image when the main code update finishes. There is one scenario where occ upgrade
may not be triggered: if you're using either a custom iteration of the image or override the CMD in the entrypoint.
@ndj888 Can you share your Docker Compose file? The equivalent to
php occ maintenance:repair
is already triggered during theocc upgrade
run used by the Docker image when the main code update finishes. There is one scenario whereocc upgrade
may not be triggered: if you're using either a custom iteration of the image or override the CMD in the entrypoint.
The docker compose yaml such as this:
version: '3.7'
services:
pg:
image: bitnami/postgresql:16.2.0-debian-12-r10
restart: always
environment:
POSTGRESQL_PASSWORD:
POSTGRES_USERNAME: nextcloud
POSTGRES_DATABASE: nextcloud
POSTGRESQL_POSTGRES_PASSWORD:
# POSTGRESQL_MAX_CONNECTIONS: 20
volumes:
- /data/nextcloud/pg-data:/bitnami/postgresql
#- ./postgresql.conf:/var/lib/postgresql/data/postgresql.conf
# ports:
# - 5432:5432
app:
#image: nextcloud:fpm-local-jit
# image: nextcloud:fpm-alpine
build: ./nextcloud-app-image
restart: always
links:
- redis
- pg
volumes:
- /data/nextcloud/www:/var/www/html
- /var/cache/nc-nginx:/var/cache/nginx
- /data:/data
- /downloads:/download
- /ssd-data/downloads:/ssd-data/download
- ./php/opcache-recommended.ini:/usr/local/etc/php/conf.d/opcache-recommended.ini
- ./php:/usr/local/etc/php-fpm.d
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro
environment:
- MYSQL_DATABASE=nextcloud
- MYSQL_PASSWORD=
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
- LANG=en_US.UTF-8
- LANGUAGE=en_US.UTF-8
- LC_ALL=en_US.UTF-8
#user: "www-data:www-data"
user: "33:33"
labels:
- com.centurylinklabs.watchtower.enable=false
#mem_limit: 1.5G
#deploy:
# resources:
# limits:
# cpus: 3
# memory: "2G"
web:
#image: modsecurity-crs-docker:nginx-v1.25.3
image: owasp/modsecurity-crs:nginx
#image: owasp/modsecurity:nginx-alpine
#image: nginx:alpine
restart: always
user: 0:0
ports:
- 443:443
links:
- app
#entrypoint:
# - sh
# - -c
# - "cp -rf /etc/modsecurity.d/my/crs-setup.conf /etc/modsecurity.d/owasp-crs/crs-setup.conf \ && /docker-entrypoint.sh nginx -g 'daemon off;'"
#- "cp -rf /etc/modsecurity.d/my/crs-setup.conf /etc/modsecurity.d/owasp-crs/crs-setup.conf \ && sh -s /docker-entrypoint.sh"
volumes:
#- $PWD/nginx.conf:/etc/nginx/nginx.conf
- $PWD/mime.types:/etc/nginx/mime.types:ro
- $PWD/nginx.conf:/etc/nginx/templates/nginx.conf.template
- $PWD/waf-rules/setup.conf.template:/etc/nginx/templates/modsecurity.d/setup.conf.template
#- $PWD/nginx.conf.d:/etc/nginx/nginx.conf.d
- $PWD/nginx.conf.d:/etc/nginx/conf.d
#- ./rules/crs-setup.conf:/etc/modsecurity.d/my/crs-setup.conf
- ./waf-rules:/etc/nginx/modsecurity.d
#- ./rules/REQUEST-903.9003-NEXTCLOUD-EXCLUSION-RULES.conf:/etc/modsecurity.d/owasp-crs/rules/REQUEST-903.9003-NEXTCLOUD-EXCLUSION-RULES.conf
- /etc/nginx/ssl:/etc/nginx/ssl
- ./check-in:/app
#- ./logs:/var/log/ng-log
# cache
- /var/cache/nc-nginx:/var/cache/nginx
volumes_from:
- app
logging:
options:
max-size: 512m
redis:
image: redis:latest
restart: always
# ports:
# - 6379:6379`
This is custmer defined Dockerfile extend form the nextcloud:stable-fpm
FROM nextcloud:stable-fpm
RUN apt update \
&& apt install -y ffmpeg`
I had the same problem after upgrading stepwise from Nextcloud 23 to 28 None of the mentioned occ commands helped.
I used phpmyadmin and removed the entry containing "merged-template-prepend.js.deps" from the oc_filecache table.
I use Nextcloud without Docker, upgrade from 28 to 29 failed somehow, this was the only way to resolve it.
@ndj888 Any chance /var/www/html/data
is a symbolic link to /data
in your environment?
php occ maintenance:repair
resolved the issue for me. I was restoring a database and file backup.
@ndj888 Any chance
/var/www/html/data
is a symbolic link to/data
in your environment?
Without using any symbolic links, /data is Wulilu Jin, and it is mounted to /var/www/html in the Docker container. I only encountered this issue during the version 27.1 upgrade. After manually executing the repair command, the problem did not recur. Currently, I am using version 28.0.5 and have not observed this issue.
Affected me as well, upgraded from 27 to 28 and then to 29 Fix with removing the na,e from oc_cache works, but when you run "php occ maintenance:repair --include-expensive" it appears again and fixed same way. Guess next upgrade will cause it again due to this function call.
Every situation this has come up in so far that I'm aware of has turned out to be config related somehow.
Please:
curl -I the_url
.For example: https://github.com/linuxserver/docker-nextcloud/issues/410#issuecomment-2016605565
Every situation this has come up in so far that I'm aware of has turned out to be config related somehow.
Please:
* review your web server configs * check if the js file is accessible and, if so, what the http response code and it's mine type is (via your browser inspector under _Network_ or using `curl -I the_url`.
For example: linuxserver/docker-nextcloud#410 (comment)
I think "php occ maintenance:repair --include-expensive" has nothing to web server set up, but causes the issue to reproduce. I can access any other js file on the same level via curl too.
⚠️ This issue respects the following points: ⚠️
Bug description
All page not working, show This message: Internal Server Error
The server encountered an internal error and was unable to complete your request. Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report. More details can be found in the server log.
Steps to reproduce
Expected behavior
All page and api can working.
Installation method
Community Docker image
Nextcloud Server version
27
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Nginx
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (ex. 22 to 23)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
No response
Nextcloud Logs
Additional info
No response