Unable to modify database directory to correct path

Hi everyone, I’m relatively new to Nextcloud (NextcloudPi) and in the process of trying to upgrade my drive to a RAID 1 array for data resilience. Don’t ask why I didn’t just start with it!

I’ve followed the directions for option 2, to create a symlink to my new data directory which has my data copied over. So now my existing data directory points to my new drive, and that all seems to work well.

But I’m getting an internal server error and cannot connect. On the system check, it’s reporting the MariaDB service is down, and that the db directory (/var/lib/mysql) doesn’t exist.

But it does exist. I can navigate to it without issue and ls the contents. Furthermore, unless I’m mistaken, var/lib/mysql is stored on the SD card and shouldn’t have been affected at all my my copying and symlink of the datadir.

NextcloudPi version v1.52.4
NextcloudPi image NextCloudPi_RaspberryPi_v1.52.2.img
OS Debian GNU/Linux 11. 6.1.21-v8+ (aarch64)
automount yes
USB devices sda sdb sdc
datadir /media/myCloudDrive/ncdata/data
data in SD no
data filesystem btrfs
data disk usage 1.3T/3.7T
rootfs usage 11G/118G
swapfile /var/swap
dbdir var/lib/mysql (doesn’t exist)
Nextcloud check error
HTTPD service up
PHP service up
MariaDB service down
Redis service up
HPB service down
Postfix service up
Internet check ok

Hi, there should be a slash at the very beginning:
/var/lib/mysql…
If not, then var/lib/mysql would be located beneath the current directory.

Thanks for pointing that out. I did notice that, and I assume that’s why the folder “doesn’t exist”, but I’m unable to modify it.

In ncp-config > config > nc-database it already reads “/var/lib/mysql”, with the initial slash. But if I then save this, I get a message “database directory var/lib/mysql not found” without the slash.

I have the same results when trying to modify this in the web interface:

I’ve tried changing this, and changing it back, but nothing has been working. There is no dbdir or equivalent database path setting in config.php (which seems strange) so I can’t try changing it there.

I’m also uncertain how to remove this entirely and reset to the default. The way this value is presented originally is somewhat confusing. Instead of the text box being populated with the current, default value (/var/lib/mysql) it is pre-populated with what seems to be a bogus value unrelated to any existing setting (something like /media/myCloudDrive/nc-database" though I forget what it was exactly)

I actually changed it to /var/lib/mysql due to this confusion as I thought it was pointing to a location which didn’t exist, and that that was the reason that MariaDB was down (prior to me changing it it, the path reported in system info did include the initial slash).

I just had a look into the related script /usr/local/bin/ncp/CONFIG/nc-database.sh and the config ist stored in file /etc/mysql/mariadb.conf.d/90-ncp.cnf.
So you can easily change there the location and I assume it will work as expected.
The subdirectories of /usr/local/bin/ncp correspond to the sections in the admin panel.

So everything appears to be in order in /usr/local/bin/ncp/CONFIG/nc-database.sh

However in /etc/mysql/mariadb.conf.d/90-ncp.cnf, the path did indeed lack the initial slash.

I corrected that, saved, and rebooted. That has resolved the “path not found error”, which is good, though unfortunately MariaDB is still reported as “down”.

NextcloudPi version v1.52.4
NextcloudPi image NextCloudPi_RaspberryPi_v1.52.2.img
OS Debian GNU/Linux 11. 6.1.21-v8+ (aarch64)
automount yes
USB devices sda sdb sdc
datadir /media/myCloudDrive/ncdata/data
data in SD no
data filesystem btrfs
data disk usage 1.3T/3.7T
rootfs usage 11G/118G
swapfile /var/swap
dbdir /var/lib/mysql
Nextcloud check error
HTTPD service up
PHP service up
MariaDB service down
Redis service up
HPB service down