Nextcloud on Dietpi v6.34.3

this is the output:

dietpi@NextCloud:~$ ls -la /mnt/XXXXXXXX-8746-493a-8398-XXXXXXXXXXXX/dietpi_userdata/mysql/
total 176212
drwxr-xr-x 5 redis  redis      4096 Jan 20 13:29 .
drwxrwxr-x 8 dietpi dietpi     4096 Jan 20 12:21 ..
-rw-rw---- 1 redis  redis     16384 Jan 20 13:24 aria_log.00000001
-rw-rw---- 1 redis  redis        52 Jan 20 13:24 aria_log_control
-rw-r--r-- 1 root   root          0 Jan 20 12:09 debian-10.3.flag
-rw-rw---- 1 redis  redis      4100 Jan 20 13:23 ib_buffer_pool
-rw-rw---- 1 redis  redis  50331648 Jan 20 13:28 ib_logfile0
-rw-rw---- 1 redis  redis  50331648 Jan 20 12:09 ib_logfile1
-rw-rw---- 1 redis  redis  79691776 Jan 20 13:29 ibdata1
-rw-rw---- 1 redis  redis         0 Jan 20 12:10 multi-master.info
drwx------ 2 redis  redis      4096 Jan 20 12:10 mysql
-rw-rw---- 1 root   root         16 Jan 20 12:10 mysql_upgrade_info
drwx------ 2 redis  redis     12288 Jan 20 12:25 nextcloud
drwx------ 2 redis  redis      4096 Jan 20 12:10 performance_schema
-rw-r----- 1 root   root      24576 Jan 19 18:54 tc.log
dietpi@NextCloud:~$

ok whole database folder is owned by user redis. I guess Redis grepped user ID of Database user mysql during installation of the new system. This could happen as DietPi did not force a specific user id during setup.

let’s change it back

chown -R mysql:mysql /mnt/XXXXXXXX-8746-493a-8398-XXXXXXXXXXXX/dietpi_userdata/mysql/

This should fix the access for the database

Out of curiosity, let’s check user id’s on the original and the new system

id mysql
id redis

Mariadb service starts now however the nextcloud page still does not load.

dietpi@NextCloud:~$ sudo cat /var/log/mysql/error.log
2021-01-22 16:18:32 43 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:18:32 44 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:19:45 45 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:19:45 46 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:20:01 47 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:25:02 48 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:27:24 49 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:27:24 50 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:30:01 51 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:33:32 52 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:33:32 53 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:34:46 54 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:34:46 55 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:35:02 56 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:40:01 57 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:43:28 58 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:43:28 59 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:44:01 0 [Note] /usr/sbin/mysqld (initiated by: unknown): Normal shutdown
2021-01-22 16:44:01 0 [Note] Event Scheduler: Purging the queue. 0 events
2021-01-22 16:44:01 0 [Note] InnoDB: FTS optimize thread exiting.
2021-01-22 16:44:01 0 [Note] InnoDB: Starting shutdown...
2021-01-22 16:44:01 0 [Note] InnoDB: Dumping buffer pool(s) to /mnt/XXXXXXXX-8746-493a-8398-XXXXXXXXXXXX/dietpi_userdata/mysql/ib_buffer_pool
2021-01-22 16:44:01 0 [Note] InnoDB: Buffer pool(s) dump completed at 210122 16:44:01
2021-01-22 16:44:08 0 [Note] InnoDB: Shutdown completed; log sequence number 4313952; transaction id 3096
2021-01-22 16:44:08 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-01-22 16:44:20 0 [Note] /usr/sbin/mysqld: Shutdown complete

2021-01-22 16:44:20 0 [Note] InnoDB: Using Linux native AIO
2021-01-22 16:44:20 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-01-22 16:44:20 0 [Note] InnoDB: Uses event mutexes
2021-01-22 16:44:20 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-01-22 16:44:20 0 [Note] InnoDB: Number of pools: 1
2021-01-22 16:44:20 0 [Note] InnoDB: Using generic crc32 instructions
2021-01-22 16:44:20 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-01-22 16:44:20 0 [Note] InnoDB: Completed initialization of buffer pool
2021-01-22 16:44:20 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-01-22 16:44:23 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2021-01-22 16:44:23 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-01-22 16:44:23 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-01-22 16:44:23 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-01-22 16:44:23 0 [Note] InnoDB: 10.3.27 started; log sequence number 4313952; transaction id 3095
2021-01-22 16:44:23 0 [Note] InnoDB: Loading buffer pool(s) from /mnt/XXXXXXXX-8746-493a-8398-XXXXXXXXXXXX/dietpi_userdata/mysql/ib_buffer_pool
2021-01-22 16:44:23 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-01-22 16:44:23 0 [Note] InnoDB: Buffer pool(s) load completed at 210122 16:44:23
2021-01-22 16:44:25 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-01-22 16:44:25 0 [Note] Reading of all Master_info entries succeeded
2021-01-22 16:44:25 0 [Note] Added new Master_info '' to hash table
2021-01-22 16:44:25 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.27-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Raspbian 10
2021-01-22 16:45:01 36 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:48:32 37 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:48:32 38 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:49:24 39 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:49:24 40 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:49:25 41 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:49:25 42 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:49:51 43 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:49:51 44 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:50:02 45 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:52:13 46 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
2021-01-22 16:52:13 47 [Warning] Access denied for user 'oc_admin'@'localhost' (using password: YES)
dietpi@NextCloud:~$

Still get the same error on nextcloud

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

ok NextCloud is not able to access the database. I guess password did not fit. Probably NextCloud generate random password during setup.

NextCloud is storing db user password inside /var/www/nextcloud/config/config.php

root@DietPi:~# cat /var/www/nextcloud/config/config.php | grep dbpassword
  'dbpassword' => 'topsecret',
root@DietPi:~#

Anyway, let’s change it inside the database. Take your topsecret password from config.php and add it to the database

mysql -u root -e "SET PASSWORD FOR 'oc_admin'@localhost = PASSWORD('topsecret');"
dietpi-services restart

Nextcloud should have access to the database now.

I take advantage of this post.
I have the same version of Dietpi (Stretch)
And nextcloud is warning that it will no longer support Mariadb 10.1
I can’t update to a higher version, how can I do it?
For Buster there are superior versions of mariaDb, for Stretch there?

krtpowa
The version of DietPi has no real relation to the Debian version. There will be no new version for MariaDB as you are on Stretch. You would need to upgrade to Debian Buster to get further updates. Current version of MariaDB on Buster is 10.3.

Even if we did not support Debian version upgrades, you might have a look into this post https://dietpi.com/forum/t/qbittorrent-version-shipping-with-dietpi/2326/9

Thank you, it was what I feared.
I will have to start thinking about starting from 0 with a new installation.

well you could clone/copy your SD card and try to upgrade to Buster.

Joulinar, I ran the commands, after which the NC page launched however it does not let me login with previous created user login, used for backup as well as admin account.

Looks as if it just does not know the previous accounts.

Also, as an alternative, I have moved to the NextCloudPi (custom installation image) as well as the NextCloud install on Raspbian, 2 separate installs and try out the back and restore options.

NextCloud on Dietpi, at this point in time, does not seem to be easy for backup and restore,

Will wait to hear from Joulinar and others, who have helped tremendously so far!!

sorry I overlook your feedback. NextCloud user can be reset as follow

ncc user:resetpassword admin

Thanks for the command,

I was able to reset the password for admin. Once i logged in, not able to see any of the previous data / photos I had uploaded. Also created one other account for testing, that account too is missing in the account list.

any suggestions?

for me it looks like you did not restored the database, therefore it’s all empty. Anyway you could perform a file system scan to load all documents

ncc files:scan --all

This will rescan all files of all known users

I am planning to do a sql backup from original setup and perform a restore, however what is the password I should be using?

Have tried the initial software password used for the Dietpi Installation, password from the config.php?

dietpi@NextCloudPi:~$ sudo mysqldump --single-transaction -h X.X.X.X -u oc_admin -p XXXXXXXXXXXXXXXXXXXXXXXX [nextcloud] >  nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
Enter password:
mysqldump: Got error: 2002: "Can't connect to MySQL server on 'X.X.X.X' (115)" when trying to connect

EDIT - I checked few more, did run a backup using the root account, able to do a sql backup after that (not sure if it is a good idea to use the root account!!)

mysqldump --single-transaction -h 127.0.0.1 -u root nextcloud >  nextcloud-sqlbkp_`date +"%Y%m%d"`.bak

using root is fine as root is the superuser for the database

Just to show how DietPi is doing if you would remove NextCloud. One step during uninstallation is to create a DB backup

mysqldump nextcloud > $datadir/dietpi-nextcloud-database-backup.sql

$datadir is a variable and grep from config files

Fare more simple :slight_smile:

that is a great input, I will try that,

So far, I think the Dietpi-restore does not help much with the nextcloud restore. So my plan now is to do a full backup of nextcloud directory, database backup, and try the restore AFTER dietpi-backup has been restored.

just to avoid misunderstanding, $datadir is set inside dietpi scripts and can’t be simply used. You would need to replace it with the correct path or do your own scripting to have it defined.

sure, acknowledged!

Will keep the updates posted… will be doing this tonight, slowly one thing at a time :slight_smile:

Just want to make sure that If i go with NC, and if the setup crashes, I can re-build it back to where it was, and appreciate all the support and help I have received!!

If you’re storing only files/pictures on Nextcloud, most important is to keep/backup files on the disk. The rest, like database and users can be build manually. As you have seen, we could gain access to database as well we created a new admin user. And in theory you could scan ol files on file system level to get them visible on Nextcloud.

Joulinar Is there any option, where I can simply scan a folder of all the images and import (link) within the NextCloud, without the need to import the Database?

If you’re storing only files/pictures on Nextcloud, most important is to keep/backup files on the disk.