NextCloud Pi not yet initialized - mySQL Problem

Hello,
I know there is another post with the same problem from 2018 and people are still replying to it. But since nobody posted I detailed description of the problem, I want to to this now. Also it seems to be a common problem with Raspi Pi 4 and 8gb RAM (see here)

My raspberry pi is powered with a 3A USB-C and a 32gb SD-Card. I think it isn’t the problem, I got it from rasppishop (sorry I am just allowed to provid 4 links so I had to reduce them)

So I burned Raspberry Pi Os with with Raspberry Pi Imager on the brand new SD-card. To install NCP I ran

curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | sudo bash

At the end of the installation it’s already showing

NextCloudPi updated to version v1.18.0


  There are no commands defined in the "config:system" namespace.


Running nc-init

and

Using 3341182566 memory for the database
Job for mariadb.service failed because a fatal signal was delivered to the control process.
See "systemctl status mariadb.service" and "journalctl -xe" for details.

Using systemctl status mariadb.service, I get:

systemctl status mariadb.service
 mariadb.service - MariaDB 10.3.22 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: signal) since Mon 2020-07-20 07:40:09 BST; 2s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 2468 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
  Process: 2469 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS
  Process: 2471 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [
  Process: 2567 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=killed, signal=
 Main PID: 2567 (code=killed, signal=ABRT)
   Status: "Waiting for page cleaner"
Nextcloud version _(eg, 18.0.2)_: 
Operating system and version _(eg, Ubuntu 20.04)_:
Apache or nginx version _(eg, Apache 2.4.25)_: 
PHP version _(eg, 7.1)_:

So now I follow the instructions of the end at the installation:

First: Visit https://192.168.178.56/  https://nextcloudpi.local/ (also https://nextcloudpi.lan/ or https://nextcloudpi/ on windows and mac)
to activate your instance of NC, and save the auto generated passwords. You may review or reset them
anytime by using nc-admin and nc-passwd.
Second: Type 'sudo ncp-config' to further configure NCP, or access ncp-web on https://192.168.178.56:4443/
Note: You will have to add an exception, to bypass your browser warning when you
first load the activation and :4443 pages. You can run letsencrypt to get rid of
the warning if you have a (sub)domain available.
The issue you are facing:

I go to 192.168.178.56, when I press activate I run into the following problem:

So according to this post, I tried the following

Run
sudo ncp-config
to launch the terminal version of the configuration panel.
install nc-nextcloud
Scrolled down to nc-init and ran it.
you should able to login now .

When I run nc-init I get:

Running nc-init
Setting up a clean Nextcloud instance... wait until message 'NC init done'
Setting up database...
2020-07-20  7:48:39 0 [Note] mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 12375 ...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Setting up Nextcloud...
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory
 ->
Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "background" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


/usr/local/bin/ncp/CONFIG/nc-init.sh: line 14: 12375 Aborted                 mysqld  (wd: /home/pi)
Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


Nextcloud is not installed - only a limited number of commands are available


  There are no commands defined in the "config:system" namespace.


failed to get ID
Done. Press any key...

When I try to install a specific nextcloud version with nc-nextcloud I get:

Running nc-nextcloud
Downloading Nextcloud 18.0.5...
Installing  Nextcloud 18.0.5...
Creating possible missing Directories
chmod Files and Directories
chown Directories
chmod/chown .htaccess
Starting mariaDB
2020-07-20  9:16:37 0 [Note] mysqld (mysqld 10.3.22-MariaDB-0+deb10u1) starting as process 18229 ...
/usr/local/bin/ncp/CONFIG/nc-nextcloud.sh: line 84: 18229 Aborted                 mysqld

Doing some research I found that

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Setting up Nextcloud...
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory

seems to be a common problem with MariaDB,
So I tried the steps from here (caution french :D)

pi@raspberrypi:~ $ sudo apt install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
mariadb-server is already the newest version (1:10.3.22-0+deb10u1).
0 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.
pi@raspberrypi:~ $ systemctl restart mariadb
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'mariadb.service'.
Multiple identities can be used for authentication:
 1.  ,,, (pi)
 2.  root
Choose identity to authenticate as (1-2): 1
Password:
==== AUTHENTICATION COMPLETE ===
Job for mariadb.service failed because a fatal signal was delivered to the control process.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
pi@raspberrypi:~ $ systemctl status mariadb
● mariadb.service - MariaDB 10.3.22 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: signal) since Mon 2020-07-20 09:20:57 BST; 2s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 23465 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS
  Process: 23466 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCES
  Process: 23468 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`;
  Process: 23564 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=killed, signal
 Main PID: 23564 (code=killed, signal=ABRT)
   Status: "Waiting for page cleaner"

pi@raspberrypi:~ $ tail -n50 /var/log/mysql/error.log
200720  9:21:20 [ERROR] mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

Server version: 10.3.22-MariaDB-0+deb10u1
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=0
max_threads=153
thread_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 466218 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x0 thread_stack 0x49000
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /var/lib/mysql
Resource Limits:
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             61664                61664                processes
Max open files            16364                16364                files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       61664                61664                signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us
Core pattern: core

pi@raspberrypi:~ $ systemctl stop mariadb
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to stop 'mariadb.service'.
Multiple identities can be used for authentication:
 1.  ,,, (pi)
 2.  root
Choose identity to authenticate as (1-2): 1
Password:
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to stop mariadb.service: Access denied
See system logs and 'systemctl status mariadb.service' for details.
pi@raspberrypi:~ $ sudo systemctl stop mariadb
pi@raspberrypi:~ $ sudo systemctl start mariadb
Job for mariadb.service failed because a fatal signal was delivered to the control process.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
pi@raspberrypi:~ $ systemctl status mariadb
● mariadb.service - MariaDB 10.3.22 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: activating (start) since Mon 2020-07-20 09:22:26 BST; 1s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 25182 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS
  Process: 25183 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCES
  Process: 25185 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`;
 Main PID: 25281 (mysqld)
    Tasks: 3 (limit: 4915)
   Memory: 77.4M
   CGroup: /system.slice/mariadb.service
           └─25281 /usr/sbin/mysqld

Jul 20 09:22:26 raspberrypi systemd[1]: Starting MariaDB 10.3.22 database server...
Jul 20 09:22:27 raspberrypi mysqld[25281]: 2020-07-20  9:22:27 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10

pi@raspberrypi:~ $ systemctl status mariadb
● mariadb.service - MariaDB 10.3.22 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: activating (start) since Mon 2020-07-20 09:22:42 BST; 2s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 25480 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS
  Process: 25481 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCES
  Process: 25483 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`;
 Main PID: 25579 (mysqld)
   Status: "Waiting for page cleaner"
    Tasks: 3 (limit: 4915)
   Memory: 74.3M
   CGroup: /system.slice/mariadb.service
           └─25579 /usr/sbin/mysqld

Jul 20 09:22:42 raspberrypi systemd[1]: Starting MariaDB 10.3.22 database server...
Jul 20 09:22:43 raspberrypi mysqld[25579]: 2020-07-20  9:22:43 0 [Note] /usr/sbin/mysqld (mysqld 10.3.22-MariaDB-0+deb10

pi@raspberrypi:~ $

So it’s seems like after stopping and starting MariaDb it’s running fine. Is this right? The problem is it doesn’t change something when I try to run nc-init, still same error

There are also recommendations for changing the my.conf file. But I don’t really know what to change there. This is what the my.conf files looks like:

# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.

#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

Please excuse this very long post, if you need more information I will try to provide it.
Thanks for your help in advance :slight_smile:

Iirc there was a fix, or at least a workarround for that raspi 8gig problem somewhere, try using search

thanks for your comment, of course I did a lot of research before this. It tried many ways that worked for others, but could’t get it working for me