Nextcloud upgrade failed because /var/www/nextcloud/ doesn't exist

My YunoHost server

Hardware: Virtual machine in a data center
YunoHost version: 11.2.3
I have access to my server : Through SSH and through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

I tried to upgrade Nextcloud. The first time I had not space left. I cleaned some big log file and I retried, but I got another error:

Upgrading Nextcloud...
{"reqId":"SF9XrdZsWqFjpxjgP4pF","level":3,"time":"2023-08-27T14:16:59+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fopen(/mnt/data/nextcloud/data/data_dir_writability_test_64eb5adb8f173.tmp): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/legacy/OC_Util.php#579","userAgent":"--","version":"26.0.3.2","data":{"app":"PHP"}}
{"reqId":"SF9XrdZsWqFjpxjgP4pF","level":3,"time":"2023-08-27T14:16:59+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fopen(/mnt/data/nextcloud/data/nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#84","userAgent":"--","version":"26.0.3.2","data":{"app":"PHP"}}
[Error] Upgrade failed.

The directory /var/www/nextcloud didn’t exist. After a few minutes the upgrade operation finished and the directory was restored.

Now, Nextcloud don’t work. When I access to it, there is this error message (in French):

Votre répertoire des données n'est pas valide. Assurez-vous que le répertoire de données contient un fichier ".ocdata" à sa racine. Votre répertoire des données n'est pas accessible en écriture. Le problème de permissions peut généralement être résolu en donnant au serveur web un accès en écriture au répertoire racine. Voir https://docs.nextcloud.com/server/26/go.php?to=admin-dir_permissions.

The data directory is not valid. It seems to be a permission issue:

sudo ls -ld /mnt/data/nextcloud/
drwxr-xr-x 3 997 997 3 Jun 19  2019 /mnt/data/nextcloud/

The user is 997. What is the right user?

How can I find the reason of the upgrade failure?

The two log file from the last failed operations:

Thanks in advance,
Bruno

In the log file, I see:

chown -R nextcloud: /var/www/nextcloud /home/yunohost.app/nextcloud/data

My Nextcloud data are in another disk and I created a symbolic link.

ls -l /home/yunohost.app/nextcloud/data
lrwxrwxrwx 1 nextcloud nextcloud 24 Jun 19  2019 /home/yunohost.app/nextcloud/data -> /mnt/data/nextcloud/data

According to the chmod man, it doesn’t traverse the symbolic links. So I run the chown to the target directory:

chown -R nextcloud: /mnt/data/nextcloud/data

Now, Nextcloud works!
I will retry the upgrade later.

I rebooted the machine because it was not using the last installed kernel, and I removed old kernel with apt autoremove. So, I get more free space.
Then, I upgraded Nextcloud successfully.

To summarize, I fixed the permission issue with the data directory of Nextcloud and I freed up disk space. The upgrade worked and this topic is closed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.