SOLVED [CPANEL-22282] No MySQL for clients on MariaDB 10.2

Clud7

Member
Jun 16, 2018
8
2
3
GREECE
cPanel Access Level
Root Administrator
Hello! i just upgraded from mysql 5.6 --> mysql 5.7 --> MariaDB 10.2

Everything works fine except mysql command in terminal for users.

Code:
[root@data ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.2.15-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> exit
Bye
[root@data ~]# su veto
[veto@data ~]$ mysql
mysql: Can't read dir of '/etc/my.cnf.d' (Errcode: 2 "No such file or directory")
Fatal error in defaults handling. Program aborted

Also: /etc/my.cnf

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

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

[mysqld]
log-error=/var/lib/mysql/data.lunaserver.gr.err
performance-schema=0
innodb_file_per_table=1
default-storage-engine=MyISAM
max_allowed_packet=268435456
open_files_limit=14000
2018-06-17 01_41_47-Window.png
2018-06-17 01_44_56-Window.png
 

24x7server

Well-Known Member
Apr 17, 2013
1,912
99
78
India
cPanel Access Level
Root Administrator
Twitter
Hi,
mysql: Can't read dir of '/etc/my.cnf.d' (Errcode: 2 "No such file or directory")
I am not sure what you are doing but when you login into the user, you have to give the -u and -p paramter and enter the appropriate username and password to connect to the database..
Also, from the error you reported, it appears that the user has no read access to the mentioned file to login. Check if it does..
 
  • Like
Reactions: Clud7

Clud7

Member
Jun 16, 2018
8
2
3
GREECE
cPanel Access Level
Root Administrator
Hi,

I am not sure what you are doing but when you login into the user, you have to give the -u and -p paramter and enter the appropriate username and password to connect to the database..
Also, from the error you reported, it appears that the user has no read access to the mentioned file to login. Check if it does..
Hello and thank you for your prompt reply!

In mysql 5.6 i was able to open the mysql terminal via root and user profile.
Now after the upgrade, (MariaDB 10.2) i am able to open the mysql terminal only via root user.

The result is:

Code:
[veto@data ~]$ mysql -u veto --password='PASSWORD' veto_products<mysqlupdate.sql
mysql: Can't read dir of '/etc/my.cnf.d' (Errcode: 2 "No such file or directory")
Fatal error in defaults handling. Program aborted
With --no-defaults WORKS FINE!!!
Code:
 mysql --no-defaults -u veto --password='PASSWORD' veto_products<mysqlupdate.sql
Thinking that the problem is my.cnf file. Any idea how i should fix it to work correctly?

I want to be able to run my mysql cron jobs again via clients cpanel.

About the permissions:
upload_2018-6-18_0-53-31.png

upload_2018-6-18_0-53-50.png

And this is my.cnf file:

upload_2018-6-18_0-56-2.png

upload_2018-6-18_0-56-24.png
 

Attachments

Last edited:

Clud7

Member
Jun 16, 2018
8
2
3
GREECE
cPanel Access Level
Root Administrator
The problem is the /etc/my.cnf file!

After the Upgrade from Mysql to MariaDB you should change the
upload_2018-6-18_19-55-20.png

Steps:
• I renamed the my.cnf to my.cnf.old
• I restarted the Mysql
• New my.cnf file re-created automatically
• I edit the file with my personal mysqld configurations.

Now it works.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @Clud7

I'm happy to hear you found the solution to this issue though I wonder if there was some further customization done to your /etc/my.cnf file as I haven't needed to do this on a mysql -> MariaDB switch or upgrade.

Thanks for letting us know what fixed the issue!
 
  • Like
Reactions: Clud7

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @Clud7

Thank you for that, what were the permissions and ownership of it?
The default provided by cPanel looks like:
Code:
[root@server php-fpm]# cat /etc/my.cnf
[mysqld]
innodb_file_per_table=1
default-storage-engine=MyISAM
performance-schema=0
max_allowed_packet=268435456
open_files_limit=2048
general-log
general-log-file=queries.log
log-output=file
Not much involved nor does it specify the log dir. It does look like yours is also specifically including the dir you were experiencing issues with on line 10 which isn't present in the default my.cnf file.



Thanks!
 
  • Like
Reactions: Clud7

Clud7

Member
Jun 16, 2018
8
2
3
GREECE
cPanel Access Level
Root Administrator
Hi @Clud7

Thank you for that, what were the permissions and ownership of it?
The default provided by cPanel looks like:
Code:
[root@server php-fpm]# cat /etc/my.cnf
[mysqld]
innodb_file_per_table=1
default-storage-engine=MyISAM
performance-schema=0
max_allowed_packet=268435456
open_files_limit=2048
general-log
general-log-file=queries.log
log-output=file
Not much involved nor does it specify the log dir. It does look like yours is also specifically including the dir you were experiencing issues with on line 10 which isn't present in the default my.cnf file.



Thanks!
Unfortunately i have the new /etc/my.cnf but i can confirm that the permissions and ownership for the old file my.cnf was the same as the new.
We had to update the mysql 5.6 to MariaDB 10.2 because of the GDPR so the file was untouched from May 2017 till now

upload_2018-6-19_2-43-51.png

Also some info about our Server:
upload_2018-6-19_2-49-52.png
 

Attachments

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @Clud7

I believe the issue was due to the specified inclusion of the directory in the old my.cnf

From my previous post:
It does look like yours is also specifically including the dir you were experiencing issues with on line 10 which isn't present in the default my.cnf file.
While that directory exists it's not specifically included in the my.cnf file on default installations. Is it present on the current new my.cnf file?

Thanks!
 

Clud7

Member
Jun 16, 2018
8
2
3
GREECE
cPanel Access Level
Root Administrator
Hi @Clud7

I believe the issue was due to the specified inclusion of the directory in the old my.cnf

From my previous post:


While that directory exists it's not specifically included in the my.cnf file on default installations. Is it present on the current new my.cnf file?

Thanks!
The new auto-created my.cnf file was exactly like the image below:
upload_2018-6-21_19-14-38.png

After i added everything from my old my.cnf like below (except the !includedir /etc/my.cnf.d)
upload_2018-6-21_19-15-44.png

After that:
All the cronjobs started and my users have full access to mysql command like:
mysql -u USERNAME --password='PASSWORD'

100% Success.
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
HI @Clud7

I wanted to mention here as it was brought to my attention today that MariaDB is adding this directive automatically:

Code:
$ grep include /etc/my.cnf
# include all files from the config directory
!includedir /etc/my.cnf.d
The issue being that libvirtfs.c does not include /etc/my.cnf.d as a virtual mount which in turn causes accounts with jailshell to experience the above issue. To rectify this we've got an internal case open CPANEL-22282

I'll update here when the case has been implemented or if any new important information becomes available.


Thanks!
 
  • Like
Reactions: Clud7

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @sparek-3

It would work I did tested it on my test server though and confirmed I no longer get the error:

Code:
# cat /var/cpanel/jailshell-additional-mounts
/etc/my.cnf.d
Then accessing the user and mysql:

Code:
[root@server ~]# su lauren
[lauren@server ~]$ mysql -ulauren -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 78
Server version: 10.2.17-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> exit
Bye
For those unaware we have documentation on this here:
How to Create Custom Jailed Shell Mounts - cPanel Knowledge Base - cPanel Documentation

Thanks!
 
Last edited:

sparek-3

Well-Known Member
Aug 10, 2002
2,174
281
388
cPanel Access Level
Root Administrator
I thought you could just put the directory name in that file and it would apply to all users?

Perhaps you have to unmount all of the virtfs mounts in order to get jailshell to remount everything?

cat /proc/mounts | awk '{print $2}' | grep /home/virtfs | xargs -n1 umount

(you may have to run this several times to force all virtfs to unmount)

Then when you initiate a new jailshell does it mount everything, including the directories listed in
/var/cpanel/jailshell-additional-mounts?

I've never appended the username to additional mount points in
/var/cpanel/jailshell-additional-mounts
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @sparek-3

You're correct, I just tested without the username and it does continue to work - I've edited my post accordingly. Thanks for the correction.

For my testing I didn't have to manually mount/umount anything that was added to /var/cpanel/jailshell-additional-mounts was automatically mounted to /home/virtfs/
 
  • Like
Reactions: Clud7

Clud7

Member
Jun 16, 2018
8
2
3
GREECE
cPanel Access Level
Root Administrator
HI @Clud7

I wanted to mention here as it was brought to my attention today that MariaDB is adding this directive automatically:

Code:
$ grep include /etc/my.cnf
# include all files from the config directory
!includedir /etc/my.cnf.d
The issue being that libvirtfs.c does not include /etc/my.cnf.d as a virtual mount which in turn causes accounts with jailshell to experience the above issue. To rectify this we've got an internal case open CPANEL-22282

I'll update here when the case has been implemented or if any new important information becomes available.


Thanks!
Great news! So the MySQL upgrade works fine and you only have to update the /var/cpanel/jailshell-additional-mounts.

Thanks a lot!
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
To add to that @Clud7 while yes this is a viable workaround for now, we're also going to keep it from occurring in the first place so you don't have to implement a workaround.