Reinstallation of Nextcloud fails

My YunoHost server

Hardware: Raspberry Pi 4 at home
YunoHost version: 11.2.12
I have access to my server : Through SSH & through the webadmin (if needed also direct access via keyboard / screen)
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes
If yes, please explain: I was trying to expand the storage by adding one new SSD. Since I needed to enter maintaince mode, I was asked to have php8.0 (current version is 7. 4.33). I installed it from CLI with sudo apt install php8.0
If your request is related to an app, specify its name and version: Nextcloud v28.0.6~ynh1

Description of my issue

Hi all.
First of all, thanks for Yunohost, that’s such a cool project that helped me a lot into being more confident with self hosting. Keep it up!

I encountered an error while trying to reinstall Nextcloud app in my yunohost server. I previously used several months Nextcloud, having some users in it and something like 80GB of media and other stuff.

I was trying to expand the storage by adding one new SSD. Since I needed to enter maintaince mode, I followed the instructions in the Yunohost docs and I was prompted to an error that basically said that I was required to have php8.0 (current version is 7. 4.33). I installed it from CLI with sudo apt install php8.0.
If I remember correctly, I may have also removed the php7.4 package with sudo apt remove php7.4.

After that step, the Nextcloud instance started to not work anymore, thus I decided to reinstall it the Nextcloud app, having all the backups just in case.
When I uninstalled the app, I did not delete all the user data (basically I didn’t tick the option that the interface provides).

Now I’m not able to reinstall the app anymore, because the installation process always fails. At this link you can find the logs for that failed installation process.

This lines seem to be pretty informative about the situation

...
2024-05-29 23:04:45,414: DEBUG - + sudo -u nextcloud php8.2 --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:install --database mysql --database-name nextcloud --database-user nextcloud --database-pass 9b0ee0336d340ca8c630345d --admin-user admin --admin-pass ********** --data-dir /home/yunohost.app/nextcloud/data
2024-05-29 23:04:47,041: DEBUG - Username is invalid because files already exist for this user
2024-05-29 23:04:47,074: DEBUG - + ynh_die '--message=Unable to install nextcloud'
2024-05-29 23:04:47,122: DEBUG - + ynh_exit_properly
2024-05-29 23:04:47,123: DEBUG - + [[ install =~ ^install$|^upgrade$|^restore$ ]]
2024-05-29 23:04:47,123: WARNING - Unable to install nextcloud
2024-05-29 23:04:48,632: ERROR - Unable to install nextcloud: An error occurred inside the app installation script

and I cannot understand how to overcome the issue.

What suggestions do you have? How can I deal with it?

Thanks to you all!

waouw !! you are doing unexpected process !!

You better not use apt to do updates but better always use yunohost tools update and yunohost tools upgrade system

The app did not used the current php, but the system debian bullseye need php7.4 and if you remove this dependency it should broke all your Yunohost debian !!

The apps use differents php versions with a repository surry, the repository must be edited in this file/etc/apt/sources.list.d/extra_php_version.list

# cat /etc/apt/sources.list.d/extra_php_version.list 
deb https://packages.sury.org/php/ bullseye main

First can you do a

apt install -f

I am not sure or reinstall php7.4, perhaps just doing

apt install php

You can’t use debian bullseye correctly without this dependency…

You may not want to install another php as you have done by yourself, the install script may do the necessary stuff…

Normally the last nextcloud app will download for the app the necessary dependencies and php8.2, but just for the app… You can see it on the logs, but your system use the php7.4 from the repository of your distribution…

I think you first you need repair your yunohost and debian bullseye

Ok I found the mistake

In the doc when it say

sudo -u nextcloud /var/www/nextcloud/occ maintenance:mode --on

you have got the mistake, you should have use this command

cd /var/www/nextcloud
sudo -u nextcloud php8.2 --define apc.enable_cli=1 occ maintenance:mode --on

You haven’t a backup of the precedent nextcloud ?? Why not use them ? example

yunohost backup restore pre-upgrade-nextcloud-1

Username is invalid because files already exist for this user

Try moving the folder /home/yunohost.app/nextcloud elsewhere and retry.

Hi rodinux,

thanks for your answer!
I proceded instaling php with the apt install php and everything went smoothly.
I’ll use the manteinance command you provided once I manage to reinstall Nextcloud, so that I’ll be able to move the nextcloud folders to the secondary SSD as I wanted at the beginning of this.

With regards to the Nextcloud reinstallation, I tried again after php7.4 was installed but logs show the same error. I may try to move the Nextcloud folder and install again Nextcloud then.

With regards to your other answers: I have only full backup of Yunohost, that I carry on every day and move it to an external disk. I guess there’s a way to retrieve the Nextcloud folder from the full backup and put it into the newly created Nextcloud installation. Am I wrong? Can I do it in an another way?

Thanks a lot

Hi jarod5001,

I’m certainly going to try that.
I also have the full Yunohost backup in my hands, is there a way then to extract the Nextcloud files that I had previously and then move them into the new Nextcloud installation?

Thanks a lot!

If you move a backup in the folder /home/yunohost.backup/archives/ then in the webadmin, you will see the app nextcloud in the backup, I think is possible to check what you need restore from the backup… don’t forget in the folder you need have the backup.tar and the backup.info.json files. They need be chown by root

But the restore is not compatible with a new installation ! I mean if you want restore, first remove a new install if exist.

Hi rodinux,

I’ve managed to successfully restore the nextcloud backup following your suggestions. Thanks a lot!

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