Bug #93699 mysqld: [ERROR] Could not open required defaults file
Submitted: 20 Dec 2018 10:56 Modified: 24 Dec 2018 15:49
Reporter: Serhiy Ivanov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:7.6.8 OS:Ubuntu (18.04)
Assigned to: Bogdan Kecman CPU Architecture:x86 (x64)
Tags: auto_installer, ndb

[20 Dec 2018 10:56] Serhiy Ivanov
Description:
Tried to install to localhost simple  ndb server by means of auto-installer.
First better sql node (id=53) is refusing to be configured with an error:
Command '[u'/usr/sbin/mysqld', '--defaults-file=/opt/MySQL_Cluster/53/my.cnf', '--initialize-insecure']' returned non-zero exit status 1

details from command line:
/usr/sbin/mysqld --defaults-file=/opt/MySQL_Cluster/53/my.cnf --initialize-insecure
mysqld: [ERROR] Could not open required defaults file: /opt/MySQL_Cluster/53/my.cnf
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!

I see i'm not a first person with the same issue:
https://stackoverflow.com/questions/52250851/unable-to-start-sql-node-in-mysql-cluster

so i wonder what's the status of deb package now?

Auto-generated config file is the almost same as from link:
#
# Configuration file for ice
# Generated by mcc
#
[mysqld]
log-error=mysqld.53.err
datadir="/opt/MySQL_Cluster/53/data"
tmpdir="/opt/MySQL_Cluster/53/tmp"
basedir="/usr/"
port=3306
ndbcluster=on
ndb-nodeid=53
ndb-connectstring=localhost:1186,
socket="/opt/MySQL_Cluster/53/mysql.socket"
ndb-wait-setup=120
ndb-batch-size=32768
ndb-blob-read-batch-bytes=65536
ndb-blob-write-batch-bytes=65536
ndb-deferred-constraints=0
ndb-log-apply-status=0
ndb-log-empty-epochs=0
ndb-log-empty-update=0
ndb-log-exclusive-reads=0

How to repeat:
1) Install deb packages for ubuntu 18.04 from https://dev.mysql.com/downloads/cluster/
2) Run auto-installer and configure for localhost node only all default services. 
3) Try to run configuration
[20 Dec 2018 10:59] Serhiy Ivanov
db_error_report

Attachment: ndb_error_report_20181220123847.tar.bz2 (application/octet-stream, text), 1.42 KiB.

[21 Dec 2018 8:05] Bogdan Kecman
Hi Serhiy,

I never tried to run ndbcluster on ubuntu so while I setup ubuntu test env. to test this report can you tell me if you tried setting up the cluster using the repo binaries? https://dev.mysql.com/downloads/repo/apt/

Thanks
Bogdan
[21 Dec 2018 9:38] Serhiy Ivanov
Hi Bogdan,

no i didn't tried. What i did is changed mysqld image with one from linux_generic installer but it hadn't helped to me. Also tried to change access settings to file accordingly to expectations in code search_default_file_with_ext in mu_default.cc but with no luck i.e. default 644 was OK.
[24 Dec 2018 11:05] Serhiy Ivanov
The problem was in apparmor service. From system logs:

Dec 24 12:56:52 ice-vb kernel: [ 8872.980335] audit: type=1400 audit(1545649012.525:52): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/opt/MySQL_Cluster/53/my.cnf" pid=22465 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=1000
Dec 24 12:57:42 ice-vb kernel: [ 8923.368869] audit: type=1400 audit(1545649062.913:53): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/opt/MySQL_Cluster/53/my.cnf" pid=22835 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
Dec 24 12:58:17 ice-vb kernel: [ 8958.331852] audit: type=1400 audit(1545649097.877:54): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/opt/MySQL_Cluster/53/my.cnf" pid=23001 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

The auto_installer under debian/ubuntu should be able to adjust apparmor settings for mysqld accordingly to manually chosen folder for configurations.
[24 Dec 2018 15:49] Bogdan Kecman
Hi,

You might expect this but we do not handle custom install directory on any platform in the means of app security, neither we do it for selinux systems nor apparmor hence this is not a bug. We assume system administrator will configure security system for custom directories (or any other security system on the box including access to ports being used, file sockets, firewall etc.)

Thanks
Bogdan