LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-12-2019, 03:36 PM   #1
pointer2null
Member
 
Registered: Mar 2012
Location: Bristol, UK
Distribution: CentOS, Debian
Posts: 32

Rep: Reputation: Disabled
after upgrade to deb10 mysql is playing up


I upgraded from Debian 8 to 9 then to 10. Now I'm getting problems with mysql. I've tried completly removing it at reinstalling, but I'm getting the same problem. Any suggestions what could be wrong would be welcome (I've tried the obvious and I can use google so tried the to 20 on there as well)

Code:
root@gdserver:/etc/systemd/system# systemctl start mysqld.service
Failed to start mysqld.service: Unit mysqld.service not found.
root@gdserver:/etc/systemd/system# systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
* *Loaded: loaded (/etc/init.d/mysql; generated)
* *Active: failed (Result: exit-code) since Tue 2019-11-12 20:24:42 GMT; 1min 2s ago
* * *Docs: man:systemd-sysv-generator(8)
* Process: 13932 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Nov 12 20:24:42 gdserver mysql[13932]: Fatal error in defaults handling. Program aborted
Nov 12 20:24:42 gdserver /etc/init.d/mysql[25629]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Nov 12 20:24:42 gdserver /etc/init.d/mysql[25629]: [61B blob data]
Nov 12 20:24:42 gdserver /etc/init.d/mysql[25629]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Nov 12 20:24:42 gdserver /etc/init.d/mysql[25629]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Nov 12 20:24:42 gdserver /etc/init.d/mysql[25629]:
Nov 12 20:24:42 gdserver mysql[13932]: *failed!
Nov 12 20:24:42 gdserver systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
Nov 12 20:24:42 gdserver systemd[1]: mysql.service: Failed with result 'exit-code'.
Nov 12 20:24:42 gdserver systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
The defaults bit is new - something I seem to have introduced, before that I was just getting the
Code:
'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
 
Old 11-12-2019, 04:46 PM   #2
pointer2null
Member
 
Registered: Mar 2012
Location: Bristol, UK
Distribution: CentOS, Debian
Posts: 32

Original Poster
Rep: Reputation: Disabled
Also should add this was all working fine until I did a reboot.
 
Old 11-13-2019, 02:52 PM   #3
pointer2null
Member
 
Registered: Mar 2012
Location: Bristol, UK
Distribution: CentOS, Debian
Posts: 32

Original Poster
Rep: Reputation: Disabled
even running as root I get

Code:
root@gdserver:~# mysqld --help --verbose
mysqld: Can't read dir of '/etc/mysql/mariadb.conf.d/' (Errcode: 13 "Permission denied")
Fatal error in defaults handling. Program aborted
 
Old 11-13-2019, 11:05 PM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
you upgraded from 8 to 9 to 10
you do not mention over what timespan

can I assume it was 8 and is now 10 in a very short timespan?
or is this something that has happened over years?

is there anything in the 8 and 10 release documentation that points out that configuration for mysql has changed?

your initial error has been truncated

Quote:
...ql/debian.cnf ping' resulted in ?????????????
the missing part may be an exit code, which could help diagnose the problem


anyone can use a web search, but
garbage in garbage out
it's a law

And blindly following "destructions" the top 20 search results is asking for trouble.
Also, not telling us what you did to further break things is not going to help matters.
 
Old 11-14-2019, 03:31 AM   #5
pointer2null
Member
 
Registered: Mar 2012
Location: Bristol, UK
Distribution: CentOS, Debian
Posts: 32

Original Poster
Rep: Reputation: Disabled
So the full(er) story. Server had be languishing at Debian 8 for far too long and for various reasons needed an update. So it went from Debian 8 at around 5pm to Debian 10 by around 9pm with a brief stop at Debian 9 along the way.

There was an old mysql installation, but when I cam to install NextCloud, I removed the mysql and reinstalled with MariaDb. Initially the DB started but after the recent reboot it's now failing to start. I din't notice the log line was truncated - I'll post the untruncated version later when I get home.

From what I can see at the moment, it's failing to start as it can read the config file. I've no idea why and wasn't able to find anything useful.

The /etc/myql folder and everything in it are at the root:root with perms of 755. I have also tried mysql:mysql and mysql:root.

If I set it to 777 I don't get the permission denied error - I get the writable config file error.
 
Old 11-14-2019, 04:30 AM   #6
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
please don't set 777

thankfully the mysql binaries are hardcoded to fail when they see files with stupid permissions, be thankful someone is protecting you from yourself.

set the correct permissions / owner

Code:
find /etc/mysql -type d | sudo xargs -r chmod 755
find /etc/mysql -type f | sudo xargs -r chmod 644 
sudo chmod 600 /etc/mysql/debian.cnf
sudo chmod 755 /etc/mysql/debian-start
sudo chown -R root:root /etc/mysql


#
maybe it will fix things, maybe not
but at least a start.
 
Old 11-14-2019, 04:38 AM   #7
pointer2null
Member
 
Registered: Mar 2012
Location: Bristol, UK
Distribution: CentOS, Debian
Posts: 32

Original Poster
Rep: Reputation: Disabled
I know it shouldn't be 777 - it was an experiment to see if there were something else causing the issue. I found it odd that running
Code:
mysqld --help --verbose
as root got the permission denied error.

The only thing in your suggestion I haven't tried is chmod 755 /etc/mysql/debian-start

Unfortunatly the company firewall prevents me for getting onto the box while as work. Will test this when home this evening.
 
Old 11-14-2019, 01:30 PM   #8
pointer2null
Member
 
Registered: Mar 2012
Location: Bristol, UK
Distribution: CentOS, Debian
Posts: 32

Original Poster
Rep: Reputation: Disabled
Code:
root@gdserver:/etc/mysql# ls -al /etc/mysql
total 40
drwxr-xr-x   4 root root  4096 Nov 13 17:02 .
drwxr-xr-x 157 root root 12288 Nov 13 17:16 ..
drwxr-xr-x   2 root root  4096 Nov  6 18:17 conf.d
-rw-------   1 root root   277 Nov  6 18:18 debian.cnf
-rwxr-xr-x   1 root root  1620 Aug  3 19:44 debian-start
-rw-r--r--   1 root root   878 Nov 12 20:29 mariadb.cnf
drwxr-xr-x   2 root root  4096 Nov 13 17:03 mariadb.conf.d
lrwxrwxrwx   1 root root    24 Nov  6 18:17 my.cnf -> /etc/alternatives/my.cnf
-rw-r--r--   1 root root   839 Aug  3  2016 my.cnf.fallback
root@gdserver:/etc/mysql# –mysqld --help --verbose
mysqld: Can't read dir of '/etc/mysql/mariadb.conf.d/' (Errcode: 13 "Permission denied")
Fatal error in defaults handling. Program aborted
root@gdserver:/etc/mysql# ls -al /etc/mysql/mariadb.conf.d/
total 40
drwxr-xr-x 2 root root  4096 Nov 13 17:03 .
drwxr-xr-x 4 root root  4096 Nov 13 17:02 ..
-rw-r--r-- 1 root root   733 Aug  3 19:44 50-client.cnf
-rw-r--r-- 1 root root   336 Aug  3 19:44 50-mysql-clients.cnf
-rw-r--r-- 1 root root  1032 Aug  3 19:44 50-mysqld_safe.cnf
-rw-r--r-- 1 root root  3940 Aug  3 19:44 50-server.cnf
-rw-r--r-- 1 root root 16384 Nov 13 17:03 .50-server.cnf.swp




Nov 14 18:22:32 gdserver serviio.sh[985]: Could not lock User prefs.  Unix error code 2.
Nov 14 18:22:32 gdserver serviio.sh[985]: Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
Nov 14 18:22:33 gdserver audit[9255]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9255 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0
Nov 14 18:22:33 gdserver kernel: audit: type=1400 audit(1573755753.194:191): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9255 comm="mysqld" requeste
Nov 14 18:22:33 gdserver mysql[8849]: [101B blob data]
Nov 14 18:22:33 gdserver mysql[8849]: Fatal error in defaults handling. Program aborted
Nov 14 18:22:34 gdserver audit[9295]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9295 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0
Nov 14 18:22:34 gdserver mysql[8849]: [101B blob data]
Nov 14 18:22:34 gdserver mysql[8849]: Fatal error in defaults handling. Program aborted
Nov 14 18:22:34 gdserver kernel: audit: type=1400 audit(1573755754.234:192): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9295 comm="mysqld" requeste
Nov 14 18:22:35 gdserver audit[9305]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9305 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0
Nov 14 18:22:35 gdserver mysql[8849]: [101B blob data]
Nov 14 18:22:35 gdserver kernel: audit: type=1400 audit(1573755755.270:193): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9305 comm="mysqld" requeste
Nov 14 18:22:35 gdserver mysql[8849]: Fatal error in defaults handling. Program aborted
Nov 14 18:22:36 gdserver audit[9314]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9314 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0
Nov 14 18:22:36 gdserver kernel: audit: type=1400 audit(1573755756.306:194): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9314 comm="mysqld" requeste
Nov 14 18:22:36 gdserver mysql[8849]: [101B blob data]
Nov 14 18:22:36 gdserver mysql[8849]: Fatal error in defaults handling. Program aborted
Nov 14 18:22:36 gdserver audit[9322]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9322 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0
Nov 14 18:22:36 gdserver kernel: audit: type=1400 audit(1573755756.338:195): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9322 comm="mysqld" requeste
Nov 14 18:22:36 gdserver mysql[8849]: [101B blob data]
Nov 14 18:22:36 gdserver mysql[8849]: Fatal error in defaults handling. Program aborted
Nov 14 18:22:36 gdserver /etc/init.d/mysql[9328]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Nov 14 18:22:36 gdserver /etc/init.d/mysql[9328]: [61B blob data]
Nov 14 18:22:36 gdserver /etc/init.d/mysql[9328]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Nov 14 18:22:36 gdserver /etc/init.d/mysql[9328]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Nov 14 18:22:36 gdserver /etc/init.d/mysql[9328]:
Nov 14 18:22:36 gdserver mysql[8849]:  failed!
Nov 14 18:22:36 gdserver systemd[1]: mysql.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStart= process belonging to unit mysql.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Nov 14 18:22:36 gdserver systemd[1]: mysql.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit mysql.service has entered the 'failed' state with result 'exit-code'.
Nov 14 18:22:36 gdserver systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
-- Subject: A start job for unit mysql.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A start job for unit mysql.service has finished with a failure.
I notice a lot of

Code:
Nov 14 18:22:36 gdserver audit[9322]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/mariadb.conf.d/" pid=9322 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0
But the apparmor file

Code:
root@gdserver:/etc/mysql# cat /etc/apparmor.d/usr.sbin.mysqld
# This file is intensionally empty to disable apparmor by default for newer
# versions of MariaDB, while providing seamless upgrade from older versions
# and from mysql, where apparmor is used.
#
# By default, we do not want to have any apparmor profile for the MariaDB
# server. It does not provide much useful functionality/security, and causes
# several problems for users who often are not even aware that apparmor
# exists and runs on their system.
#
# Users can modify and maintain their own profile, and in this case it will
# be used.
#
# When upgrading from previous version, users who modified the profile
# will be promptet to keep or discard it, while for default installs
# we will automatically disable the profile.
 
Old 11-19-2019, 01:00 PM   #9
pointer2null
Member
 
Registered: Mar 2012
Location: Bristol, UK
Distribution: CentOS, Debian
Posts: 32

Original Poster
Rep: Reputation: Disabled
This appears to be an issue with AppArmor and the MariaDb

see this thread for the solution. Theonly thing it doesn't say explicitly is you need to reboot.

For those in too much of a rush to click...

Code:
$ sudo systemctl stop apparmor.service
$ sudo update-rc.d -f apparmor remove

$ sudo apt-get remove --purge mysql-server mysql-client mysql-common
$ sudo apt-get autoremove
$ sudo apt-get autoclean
$ sudo apt-get install mariadb-server

$ sudo systemctl start apparmor.service
$ sudo update-rc.d apparmor defaults
And then REBOOT
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can MySQL log on via SSH/bash? mysql:x:27:101:MySQL Server:/var/lib/mysql:/bin/bash Ujjain Linux - Newbie 2 04-24-2009 03:21 PM
yum install php-mysql fails with mysql 5.1 - "Error: mysql conflicts with MySQL" rebelde Linux - Software 2 03-13-2009 11:32 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 04:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration