Nextcloud failed update 603 to 631

Here is the error from commandline snap refresh nextcloud

2022-11-30 21:49:00,260 - database - INFO - postgres executing: /snap/nextcloud/current/bin/initdb.sh /var/snap/nextcloud/current/database
initdb: invalid locale settings; check LANG and LC_* environment variables
2022-11-30 21:49:01,066 - database - ERROR - postgres error: The files belonging to this database system will be owned by user “nextcloud”.
This user must also own the server process.
Traceback (most recent call last):
File “/snap/nextcloud/631/meta/hooks/post-refresh”, line 7, in
Installer().post_refresh()
File “/snap/nextcloud/631/hooks/installer.py”, line 97, in post_refresh
self.db.init()
File “/snap/nextcloud/631/hooks/postgres.py”, line 33, in init
self.run(‘{0}/bin/initdb.sh {1}’.format(self.app_dir, self.database_dir))
File “/snap/nextcloud/631/hooks/postgres.py”, line 55, in run
raise e
File “/snap/nextcloud/631/hooks/postgres.py”, line 51, in run
output = check_output(cmd, shell=True).decode()
File “/snap/nextcloud/current/python/usr/local/lib/python3.8/subprocess.py”, line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “/snap/nextcloud/current/python/usr/local/lib/python3.8/subprocess.py”, line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command ‘/snap/nextcloud/current/bin/initdb.sh /var/snap/nextcloud/current/database’ returned non-zero exit status 1.

Which command line is that?
Are you trying to use this page to upgrade to v24 first?

Sorry I guess you are running:

snap refresh nextcloud

If you are on Nextcloud 23 you cannot use that command and need to use the above wiki to upgrade to 24 first and then the last command to upgrade to latest (25)

SO I tried the wiki and get roughly the same error remember i am running a legacy syncloud if that helps

root@syncloud:~/snap/nextcloud# rm nextcloud_211101376_amd64.snap
root@syncloud:~/snap/nextcloud# wget apps.syncloud.org/apps/nextcloud_621_$(dpkg --print-architecture).snap
–2022-12-02 07:26:48-- http://apps.syncloud.org/apps/nextcloud_621_amd64.snap
Resolving apps.syncloud.org (apps.syncloud.org)… 52.218.252.130, 52.218.208.219, 52.218.236.186, …
Connecting to apps.syncloud.org (apps.syncloud.org)|52.218.252.130|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 496369664 (473M) [binary/octet-stream]
Saving to: ‘nextcloud_621_amd64.snap’

nextcloud_621_amd64.snap 100%[=================================================>] 473.38M 12.8MB/s in 38s

2022-12-02 07:27:26 (12.5 MB/s) - ‘nextcloud_621_amd64.snap’ saved [496369664/496369664]

root@syncloud:~/snap/nextcloud# snap install nextcloud_621_$(dpkg --print-architecture).snap --devmode
error: cannot perform the following tasks:

  • Run post-refresh hook of “nextcloud” snap if present (run hook “post-refresh”:

2022-12-02 07:30:04,577 - database - INFO - postgres executing: /snap/nextcloud/current/bin/initdb.sh /var/snap/nextcloud/current/database
initdb: invalid locale settings; check LANG and LC_* environment variables
2022-12-02 07:30:05,714 - database - ERROR - postgres error: The files belonging to this database system will be owned by user “nextcloud”.
This user must also own the server process.
Traceback (most recent call last):
File “/snap/nextcloud/621/meta/hooks/post-refresh”, line 7, in
Installer().post_refresh()
File “/snap/nextcloud/621/hooks/installer.py”, line 97, in post_refresh
self.db.init()
File “/snap/nextcloud/621/hooks/postgres.py”, line 33, in init
self.run(‘{0}/bin/initdb.sh {1}’.format(self.app_dir, self.database_dir))
File “/snap/nextcloud/621/hooks/postgres.py”, line 55, in run
raise e
File “/snap/nextcloud/621/hooks/postgres.py”, line 51, in run
output = check_output(cmd, shell=True).decode()
File “/snap/nextcloud/current/python/usr/local/lib/python3.8/subprocess.py”, line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “/snap/nextcloud/current/python/usr/local/lib/python3.8/subprocess.py”, line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command ‘/snap/nextcloud/current/bin/initdb.sh /var/snap/nextcloud/current/database’ returned non-zero exit status 1.
-----)
root@syncloud:~/snap/nextcloud#

Submitting support log now too

Right you are still on jessie, we need to introduce OS upgrade option at some point.
For now can you run this:

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"

and then

snap install nextcloud_621_$(dpkg --print-architecture).snap --devmode

but this may not help as probably the real reason is disk space, only 2G left on root:

/dev/dm-1                       16G   13G  2.2G  86% /

What kind of device is this, I see amd64 but where is small boot partition is coming from as we do not do amd64 Syncloud devices with a separate boot disk.

So I had to take a break and tried again but no luck, however the version I am running is Nextcloud 24 it is confusing. But here is my underlying question, I am setting up a new device at the moment, and if it install 631 and say my instance is on 603 will the data get upgraded correctly?

If by data you mean Nextcloud files then yes, as you will have to copy them to the new device (or reattach external disk) anyway and run occ scan from the wiki.

The only problem would be if you want to migrate Nextcloud settings like contacts, calendar events … for them you need to do a backup and restore but it needs the same version on both devices do you want that?

It is possible to install the same Nextcloud version on the new device restore the backup and then upgrade.

It is always possible to install a specific version for example v603:

wget apps.syncloud.org/apps/nextcloud_603_$(dpkg --print-architecture).snap

snap install nextcloud_603_$(dpkg --print-architecture).snap --devmode

Then try restoring backup and then use the wiki to upgrade to the latest.

Ok so I resolved this in a rather unhelpful for others way if someone runs into this.

I built a new machine and had to re-add the apps separatey. Now on a uefi build that is no longer legacy of Jesse fully on Buster