Upgrade to NextCloud11 interrupted -- app uninstalled?

Hi all,

My Yunohost is on a dedicated server. I connect to it through ssh.
I had a Nextcloud 10.0.1 on it, itself upgraded from Owncloud. I manually upgraded to Nextcloud 11 following these instructions:

I’ve seen that the Yunohost package was also upgraded, so in order to come back to “normal”, I tried to upgrade it using the classic command:
sudo yunohost app upgrade -u GitHub - YunoHost-Apps/nextcloud_ynh: Nextcloud package for YunoHost

It started, but I lost the connection, apparently during the database backup.
I reconnected and relaunched the command, but it failed.

I got a lot of warnings about existing backup file, ending with "Unable to back up the app “nextcloud”, but then it got worse:

Warning: Unable to back up the app 'nextcloud'
Warning: There is nothing to save
Warning: cat: /var/www/nextcloud/config/config.php: No such file or directory
Warning: cat: /var/www/nextcloud/config/config.php: No such file or directory
Warning: mysqldump: Got error: 1045: Access denied for user 'matian'@'localhost' (using password: YES) when trying to connect
Warning: E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)
Warning: E: Unable to lock directory /var/cache/apt/archives/
Warning: Unknown local backup archive named 'nextcloud-before-upgrade'
Warning: Upgrade failed. The app was restored to the way it was before the failed upgrade.
Error: Unable to upgrade nextcloud
Error: No app to upgrade

And now, the app is simply gone!

What do I do to get it back??

Thanks very much!

EDIT:
Both the /var/www/ contents and the mysql databases are GONE.
So I guess I have 2 options on hand:

  1. The data directory is intact.
    I do a fresh install and copy back the data as if nothing ever happened.
    I will need to redo all the sharing things.
    What will happen to my contacts and calendar? Are they going to be sync from my devices back to the server or are they going to be sync from the server (empty) and so delete all on the devices?

  2. I have a 10 days old backup of the whole yunohost
    There must be a way to restore only nextcloud, if I copy the right files in the right place and if there is a mysql database part for NC only, right? Then I will only have to deal with a “delta” of 10 days.
    Can that be done?

Which of the 2 solutions sound better? (in terms of minimizing the loss and in terms of workload…)

@matlag: did you finally answer your own questions? I am in an almost similar situation and I would be interested to know how you did fix it…

@aoz
I went with solution 2. You can actually restore only one app even if you did a full backup. Check the command options carefully (don’t miss the one to leave alone the hooks). I did a copy of my existing data directory first and another full backup just in case, so that I could just quickly identify the “delta” with the copy of the data and re-enter it.
It went fine.

Thank you for you feedback.