Hansson Nextcloud VM - Update from v24 to v25 failed because terminated SSH session?

Hello,

I use the Nextcloud VM from Hansson IT. I really like it and everything worked good until now. But I am pretty sure its my fault. I started the update script. And few minutes later I closed the connection to my VPN, so I lost the connection to the Nextcloud VM, too. I thought is is no problem and normally the update is full automatic. So I waited 1 hour, but my Nextcloud was still not reachable. Then I slept few hours and it was still not working. Then I connected again via SSH and entered the update command. But then this will happen:

Then I checked apache2:

And then I checked the apach2 site config:

But I do not see any error here.

I think the problem is that the update was still in progress but needed confirmation from me. But instead the SSH session was closed and then at some point the server restarted. So now my Nextcloud VM is in the middle of the update process but cannot continue. Can this be? How can I fix this? :frowning:

No one can help? My full nextcloud is offline since 2 days now and I need my cloud. :frowning:

Is there any special Hansson Nextcloud VM sub section or any better forum to ask? I think I saw a forum or a sub section especially for the VM topic few month ago. But can’t find it now… I really need a helpful answer.

It’s good practice to do a snapshot of the VM before Update!
So Go back and start update again.

Did you start the update again from SSH?
What is the output?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Nextcloud VM - Machine configuration (hanssonit.se)

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

in Your nextcloud-data folder, should be a backup from last working Version
image

Please read the first post. This is what I described already. o.O

And yes, its good to make a snapshot before an upgrade. But I only use the VM backup solution and then it will also backup my data, so it will take around 5-6 hours. :confused:

I just entered the update command, SSH session disconnected and then everything is broken. How can this be? Linux is so exhausting. Everything is broken so fast. Maybe the update process is still anywhere? Maybe I just need to stop it?

Helped me to start update several time each time it got further

In the forum, this is the right place normally.
If you get such errors:

apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 38 of /etc/apache2/sites-enabled/cloud.example.com.con>

I’d check the file and the line what might be wrong there…

For the other logs:

grep: /var/www/nextcloud/config/config.php: No such file or directory

I don’t know what the vm-image is doing internally during upgrades, perhaps it copies first the config-folder somewhere else during the update (and since the process was interrupted or didn’t finish).
From their scripts, they seem to use automatic lvm-snapshots as well. But it needs someone who knows this ecosystem better,
worst case, in the logs they say:

Sorry but something went wrong. Please report this issue to Issues · nextcloud/vm · GitHub and include the output of the error message. Thank you!

Since there are perhaps the lvm-snapshots, I wouldn’t fiddle around too much and wait for someone more experiences. If you are running on a virtual machine, I’d take a backup now that at least it doesn’t get worse than that…

1 Like

This is what I did, please see first post. But I can’t see any error in line 38. I also linked apache file.

Yes, I think I need to buy their premium support.

This is so f*cking bad. I just lost the connection to my SSH session and now everything is broken. Linux is so cool… :melting_face: And no one can help me here, too. So its not just a small problem where everyone can help me with. :frowning:

And I can’t make a new installation, because app data for PhoneTrack is not saved in the ncdata partition, right? So I really need the nextcloud system files back. So bad…

I checked this, but I can’t find any backup. I do not have this folder. Anyone know the real path for the Nextcloud VM from Hansson IT?

root@cloud:/var/www# ls
html  nextcloud  nextcloud-25.0.2.tar.bz2
root@cloud:/var/www# cd nextcloud
root@cloud:/var/www/nextcloud# ls
core        index.php  ocs           remote.php  robots.txt  updater
index.html  lib        ocs-provider  resources   themes
root@cloud:/var/www/nextcloud# cd updater/
root@cloud:/var/www/nextcloud/updater# ls
index.php  updater.phar
root@cloud:/var/www/nextcloud/updater#

Do you have a recent backup of the VM? I mean it’s 4 days now since the incident happened. A restore would have been way faster, even if it takes 5-6 hours.

Not sure, but it seems like it has already downloaded the tar.bz file of new version and deleted the files of the old version. You could try to complete the upgrade of your Nextcloud via OCC command instead of starting the Hansson update script all over again:

sudo -u www-data php /var/www/nextcloud/occ upgrade

If that doesn’t work, try to run the Nextcloud updater again with the following command:

sudo -u www-data php /var/www/nextcloud/updater/updater.phar
1 Like

Oh, this is a great idea! But I am not sure, if I will do this. Because then I will destroy more, when the upgrade is not working. So I will think about it, if I pay for support from Hansson IT or I will use this command. Ok… maybe I can just start a backup, then I can try your command. Thanks!

And I can’t go back to the backup, because then I will lose my location history for 2 weeks I think. I don’t want this. Pictures, Documents, … are no problem, because I always have a better backup. But I have only an old backup of the Nextcloud installation with the PhoneTrack data.

Doesn’t you Hypervisor support snapshots? Taking a snapshot of the VM before an upgrade or when you want to test something, would only take a few seconds, instead of several hours like a full backup of the VM. Snapshots are of course not meant to be a replacement for full backups, but in situations like this, it would be much easier…

1 Like

Both commands are not working. And I see there is no /occ on my server. I checked the web for the error, but everything make no sense, because they are using docker or other things are different. User www-data exists, so command should work. Maybe the updater command will work, but I think I need to change the permission, so that I can execute this file?

Edit: Ok, not working. I changed the permission to 777 and everything is still the same.

root@cloud:/var/www/nextcloud/updater# ls -l
total 840
-rwxrwxrwx 1 nobody nogroup  66939 Dec  8 12:27 index.php
-rwxrwxrwx 1 nobody nogroup 789686 Dec  8 12:27 updater.phar


root@cloud:/var/www/nextcloud/updater# ls -l
total 840
-rw-r--r-- 1 nobody nogroup  66939 Dec  8 12:27 index.php
-rw-r--r-- 1 nobody nogroup 789686 Dec  8 12:27 updater.phar


root@cloud:~# cd /var/www/nextcloud
root@cloud:/var/www/nextcloud# ls
core  index.html  index.php  lib  ocs  ocs-provider  remote.php  resources  robots.txt  themes  updater
root@cloud:/var/www/nextcloud# cd updater/
root@cloud:/var/www/nextcloud/updater# ls
index.php  updater.phar
root@cloud:/var/www/nextcloud/updater# cd
root@cloud:~# sudo -u www-data php /var/www/nextcloud/occ upgrade
Could not open input file: /var/www/nextcloud/occ
root@cloud:~# sudo -u www-data php /var/www/nextcloud/updater/updater.phar
Could not open input file: /var/www/nextcloud/updater/updater.phar
root@cloud:~#

Two things stand out to me:

  1. the files belong to nobody and nogroup, which looks strange and I’m not sure, whether it has to be like this in the VM, I doubt it though.

  2. the OCC script is not present under /var/www/nextcloud. It was probably deleted before the update could be completed.

Unfortunately I can’t give you specific instructions on what to do now. As I see it you have 3 options:

  1. you look through the scripts here and try to understand how the Hansson VM handles things in detail. Maybe this will help you to fix things yourself.

  2. you contact https://hanssonit.se/ and use their support.

  3. you use the last working backup, and lose two weeks of your GPS data.

Or maybe there is still a fourth option and someone else here has some useful tips…

1 Like

I think I will do this. 60€ for 30 minutes support is really expensive for me, but I think there is not other way for me. I’m still surprised that a dissconnect can trigger all this. But I know for the next time, I need to create a backup. I should always create backups, when I do any changes.

If we assume that the data folder and the database are still intact, which I would expect, in theory there would be a fourth option: You could try to set up a new VM from scratch and then migrate the data folder and the database from the old VM to the new one. https://docs.nextcloud.com/server/latest/admin_manual/maintenance/migrating.html

This! Or at least a snapshot, if your Hypervisor can do that.

1 Like

Another good idea, thanks! Maybe I just need to use my old backup and then I can move the data folder and database from the broken VM to the old VM. But I think I can’t handle this easily.

Thank you for your help, I appreciate it very much!

1 Like

This problem was now solved by Daniel from Hansson IT. Everything was done within 5 minutes, lol.

I asked him to tell me what he did to post this here. Maybe this will help other people:

  1. download the same nextcloud version as in your backup
  2. unzip it in /var/www/
  3. rsync the backup to the unzxipped dir
  4. nextcloud_occ upgrade
    maybe 5. set correct permissions

Backup was in /mnt/NCBACKUP

Expensive 5 minutes, but I am happy that my Cloud is working again. I will never start an upgrade without backup anymore, haha.

4 Likes

WE all should consider this for 2023 :slightly_smiling_face:

3 Likes

I don’t know where you are from but over here in Germany that’s like the amount you’d pay for common service in a car branded repair station. At least for german cars like VW, Mercedes, BMW, Audi: roundabout 100-120€/hr.

They need expensive equipment and rent a large facility. And not everybody is from Germany…

But if you consider setting everything up again, restoring files from a backup or redoing some of the work, it’s 60€ for you to learn the importance of backups.

Just reading through the initial post, so if you don’t put the script that it runs in the background and continues to run, if you disconnect, the update process is just stopped at some random point.

Therefore perhaps one more tip: if you do upgrades, do it when you have a bit of time, never run it just 5 minutes before you need to go somewhere else.

4 Likes