Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1061045 - mariadb log file permission issue
Summary: mariadb log file permission issue
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: mariadb
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Honza Horak
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1062054 1063499 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-04 09:58 UTC by Attila Fazekas
Modified: 2018-12-21 22:40 UTC (History)
11 users (show)

Fixed In Version: mariadb-5.5.35-2.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-30 00:53:10 UTC


Attachments (Terms of Use)

Description Attila Fazekas 2014-02-04 09:58:28 UTC
Description of problem:

mariadb fails to start because he does not have permission to write into his log file.

Version-Release number of selected component (if applicable):
mariadb-server.x86_64 1:5.5.34-3.fc20

How reproducible:
always

Steps to Reproduce:

# yum install mariadb-server

Installed:
  mariadb-server.x86_64 1:5.5.34-3.fc20                                                                                                                                                              

Dependency Installed:
  libaio.x86_64 0:0.3.109-8.fc20                    make.x86_64 1:3.82-19.fc20                  mariadb.x86_64 1:5.5.34-3.fc20                     mariadb-libs.x86_64 1:5.5.34-3.fc20               
  openssl.x86_64 1:1.0.1e-37.fc20                   perl.x86_64 4:5.18.2-289.fc20               perl-AnyEvent.x86_64 0:7.05-1.fc20                 perl-AnyEvent-AIO.noarch 0:1.1-13.fc20            
  perl-AnyEvent-BDB.noarch 0:1.1-13.fc20            perl-BDB.x86_64 0:1.90-6.fc20               perl-Carp.noarch 0:1.26-245.fc20                   perl-Compress-Raw-Bzip2.x86_64 0:2.062-2.fc20     
  perl-Compress-Raw-Zlib.x86_64 0:2.062-2.fc20      perl-Coro.x86_64 0:6.33-1.fc20              perl-DBD-MySQL.x86_64 0:4.024-1.fc20               perl-DBI.x86_64 0:1.630-1.fc20                    
  perl-Data-Dumper.x86_64 0:2.145-292.fc20          perl-EV.x86_64 0:4.11-4.fc20                perl-Encode.x86_64 1:2.54-2.fc20                   perl-Event.x86_64 0:1.21-4.fc20                   
  perl-Exporter.noarch 0:5.68-293.fc20              perl-File-Path.noarch 0:2.09-292.fc20       perl-File-Temp.noarch 0:0.23.01-4.fc20             perl-Filter.x86_64 1:1.49-5.fc20                  
  perl-Getopt-Long.noarch 0:2.42-1.fc20             perl-Guard.x86_64 0:1.022-6.fc20            perl-HTTP-Tiny.noarch 0:0.034-4.fc20               perl-IO-AIO.x86_64 0:4.15-6.fc20                  
  perl-IO-Compress.noarch 0:2.062-2.fc20            perl-IO-Socket-IP.noarch 0:0.26-1.fc20      perl-IO-Socket-SSL.noarch 0:1.955-1.fc20           perl-Module-CoreList.noarch 1:3.03-289.fc20       
  perl-Net-Daemon.noarch 0:0.48-7.fc20              perl-Net-HTTP.noarch 0:6.06-4.fc20          perl-Net-LibIDN.x86_64 0:0.12-16.fc20              perl-Net-SSLeay.x86_64 0:1.55-4.fc20              
  perl-PathTools.x86_64 0:3.40-291.fc20             perl-PlRPC.noarch 0:0.2020-15.fc20          perl-Pod-Escapes.noarch 1:1.04-289.fc20            perl-Pod-Perldoc.noarch 0:3.20-7.fc20             
  perl-Pod-Simple.noarch 1:3.28-292.fc20            perl-Pod-Usage.noarch 0:1.63-4.fc20         perl-Scalar-List-Utils.x86_64 0:1.31-293.fc20      perl-Socket.x86_64 1:2.013-1.fc20                 
  perl-Storable.x86_64 0:2.45-2.fc20                perl-Task-Weaken.noarch 0:1.04-8.fc20       perl-Text-ParseWords.noarch 0:3.29-3.fc20          perl-Time-HiRes.x86_64 0:1.9726-1.fc20            
  perl-Time-Local.noarch 0:1.2300-291.fc20          perl-common-sense.noarch 0:3.6-6.fc20       perl-constant.noarch 0:1.27-292.fc20               perl-libs.x86_64 4:5.18.2-289.fc20                
  perl-macros.x86_64 4:5.18.2-289.fc20              perl-parent.noarch 1:0.228-1.fc20           perl-podlators.noarch 0:2.5.1-291.fc20             perl-threads.x86_64 1:1.89-1.fc20                 
  perl-threads-shared.x86_64 0:1.45-1.fc20          perl-version.x86_64 3:0.99.04-2.fc20       

Dependency Updated:
  openssl-libs.x86_64 1:1.0.1e-37.fc20                                                                                                                                                               

Complete!
# systemctl status mariadb
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled)
   Active: inactive (dead)

# ls -l /var/log/mariadb/mariadb.log 
-rw-r--r--. 1 root root 0 Feb  4 09:28 /var/log/mariadb/mariadb.log
# service mariadb start
Redirecting to /bin/systemctl start  mariadb.service
Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.
# journalctl -xn
-- Logs begin at Tue 2014-02-04 09:25:53 UTC, end at Tue 2014-02-04 09:42:12 UTC. --
Feb 04 09:42:11 afazekas-7d1cd7bd2a13194411a01c3e61470933 mysqld_safe[1240]: 140204 09:42:11 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Feb 04 09:42:11 afazekas-7d1cd7bd2a13194411a01c3e61470933 mysqld_safe[1240]: 140204 09:42:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 04 09:42:11 afazekas-7d1cd7bd2a13194411a01c3e61470933 mysqld_safe[1240]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
Feb 04 09:42:11 afazekas-7d1cd7bd2a13194411a01c3e61470933 mysqld_safe[1240]: /usr/bin/mysqld_safe: line 182: /var/log/mariadb/mariadb.log: Permission denied
Feb 04 09:42:11 afazekas-7d1cd7bd2a13194411a01c3e61470933 mysqld_safe[1240]: 140204 09:42:11 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
Feb 04 09:42:11 afazekas-7d1cd7bd2a13194411a01c3e61470933 mysqld_safe[1240]: /usr/bin/mysqld_safe: line 138: /var/log/mariadb/mariadb.log: Permission denied
Feb 04 09:42:11 afazekas-7d1cd7bd2a13194411a01c3e61470933 systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Feb 04 09:42:12 afazekas-7d1cd7bd2a13194411a01c3e61470933 systemd[1]: mariadb.service: control process exited, code=exited status=1
Feb 04 09:42:12 afazekas-7d1cd7bd2a13194411a01c3e61470933 systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mariadb.service has failed.
-- 
-- The result is failed.
Feb 04 09:42:12 afazekas-7d1cd7bd2a13194411a01c3e61470933 systemd[1]: Unit mariadb.service entered failed state.

Comment 2 Honza Horak 2014-02-04 12:03:23 UTC
Attila, thanks for reporting. I see that /var/log/mariadb/mariadb.log has root:root owner in your case, which is simply wrong. Have you changed that manually? Otherwise I cannot understand how this could happen, since all systemd processes from mariadb run as mysql user.

To make it clear -- you installed mariadb-server on a machine where no such package was installed before?

Anyway, these are correct privileges and SELinux context that the log file and its directory should have:

# ls -ldZ /var/log/mariadb/
drwxr-x---. mysql mysql system_u:object_r:mysqld_log_t:s0 /var/log/mariadb/
# ls -ldZ /var/log/mariadb/mariadb.log
-rw-r-----. mysql mysql system_u:object_r:mysqld_log_t:s0 /var/log/mariadb/mariadb.log

Comment 3 Attila Fazekas 2014-02-04 14:46:31 UTC
First I noticed the issue in automated run with the official fedora-20 cloud image  (before the job reaches the mariadb installation part, the job does a yum update and a reboot ).
As you can see in the bug report the file created at yum install time, I even did not tried to start the service. 
It was reproduced on the f20 cloud image manually as you can see above.

The issue introduced by the mariadb-server.x86_64 1:5.5.34-3.fc20, the job was ok with the mariadb-server.x86_64 1:5.5.34-2.fc20.

Another strange issue, the service at start up tries to correct the permission issue, but it does not have enough permission for fixing that.

(Even if the selinux is in a permissive mode.)

NOTE: So if anything/anyone configures a new log file location, the file might not be created automatically and the service will fail to start.

Comment 4 Aaron Richton 2014-02-04 17:15:35 UTC
Just ran into this myself. Starting clean:

# ls -la /var/log/mariadb
ls: cannot access /var/log/mariadb: No such file or directory

and installing the latest spin:
# rpm -ivv mariadb-server-5.5.35-1.fc20.x86_64.rpm

results in the observed:
# ls -l /var/log/mariadb/mariadb.log 
-rw-r--r-- 1 root root 0 Feb  4 11:34 /var/log/mariadb/mariadb.log

because of
%post
+ /bin/touch /var/log/mariadb/mariadb.log

per
http://pkgs.fedoraproject.org/cgit/mariadb.git/tree/mariadb.spec?h=f20#n575


I'm not sure how much of that %post applies now that the logfiles are %ghost. If I emulate that touch not existing with a manual
# rm /var/log/mariadb/mariadb.log

then everything starts fine...

Comment 5 Honza Horak 2014-02-05 09:48:33 UTC
(In reply to Aaron Richton from comment #4)
> %post
> + /bin/touch /var/log/mariadb/mariadb.log

Aaah, good cache. The problem is that for ghost files setting of owner/permissions in %files section doesn't apply actually, so when touching the log in the %post section, it ends really with root:root owner. Will fix soon. Thanks for elaboration.

Comment 6 Fedora Update System 2014-02-06 13:19:02 UTC
mariadb-5.5.35-3.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mariadb-5.5.35-3.fc20

Comment 7 Fedora Update System 2014-02-06 13:19:16 UTC
mariadb-5.5.35-2.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/mariadb-5.5.35-2.fc19

Comment 8 Honza Horak 2014-02-06 13:21:05 UTC
*** Bug 1062054 has been marked as a duplicate of this bug. ***

Comment 9 Fedora Update System 2014-02-07 03:09:50 UTC
Package mariadb-5.5.35-3.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mariadb-5.5.35-3.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-2119/mariadb-5.5.35-3.fc20
then log in and leave karma (feedback).

Comment 10 Honza Horak 2014-02-11 09:47:39 UTC
*** Bug 1063499 has been marked as a duplicate of this bug. ***

Comment 11 Gilboa Davara 2014-02-11 13:46:51 UTC
Please note that at least in my case, the old log file must be manually removed before installing 5.5.35-3 in-order to fix this bug.

- Gilboa

Comment 12 Fedora Update System 2014-02-15 07:01:06 UTC
mariadb-5.5.35-3.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2014-02-15 07:03:19 UTC
mariadb-5.5.35-2.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Pablo Hinojosa 2014-02-15 22:42:21 UTC
I still have the problem on Fedora 20. 

[root@fedorahost pablo]# ls -ldZ /var/log/mariadb/mariadb.log
ls: cannot access /var/log/mariadb/mariadb.log: No such file or directory
[root@fedorahost pablo]# ls -ldZ /var/log/mariadb/
ls: cannot access /var/log/mariadb/: No such file or directory

I install mariadb 

Installed:
  mariadb.x86_64 1:5.5.35-3.fc20                                                                                                                                                                                                             
Complete!

service mariadb status
Redirecting to /bin/systemctl status  mariadb.service
mariadb.service
   Loaded: not-found (Reason: No such file or directory)
   Active: failed (Result: exit-code) since Sat 2014-02-15 22:29:38 GMT; 3min 29s ago
 Main PID: 4126 (code=exited, status=1/FAILURE)

Feb 15 22:29:37 fedorahost.fedoradomain mysqld_safe[4126]: touch: cannot touch ‘/var/log/mysqld.log’: Permission denied
Feb 15 22:29:37 fedorahost.fedoradomain mysqld_safe[4126]: chown: cannot access ‘/var/log/mysqld.log’: No such file or directory
Feb 15 22:29:37 fedorahost.fedoradomain mysqld_safe[4126]: chmod: cannot access ‘/var/log/mysqld.log’: No such file or directory
Feb 15 22:29:37 fedorahost.fedoradomain mysqld_safe[4126]: 140215 22:29:37 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Feb 15 22:29:37 fedorahost.fedoradomain mysqld_safe[4126]: /usr/bin/mysqld_safe: line 138: /var/log/mysqld.log: Permission denied
Feb 15 22:29:37 fedorahost.fedoradomain systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
Feb 15 22:29:38 fedorahost.fedoradomain systemd[1]: mariadb.service: control process exited, code=exited status=1
Feb 15 22:29:38 fedorahost.fedoradomain systemd[1]: Failed to start MariaDB database server.
Feb 15 22:29:38 fedorahost.fedoradomain systemd[1]: Unit mariadb.service entered failed state.
Feb 15 22:30:27 fedorahost.fedoradomain systemd[1]: Stopped MariaDB database server.

[root@fedorahost pablo]# ls -ldZ /var/log/mariadb/mariadb.log
ls: cannot access /var/log/mariadb/mariadb.log: No such file or directory

[root@fedorahost pablo]# service mariadb start 
Redirecting to /bin/systemctl start  mariadb.service
Failed to issue method call: Unit mariadb.service failed to load: No such file or directory.

[root@fedorahost pablo]# ls -ldZ /var/log/mariadb/mariadb.log
ls: cannot access /var/log/mariadb/mariadb.log: No such file or directory

ls -laZ /var/log/mariadb
ls: cannot access /var/log/mariadb: No such file or directory

Comment 15 Pablo Hinojosa 2014-02-15 22:46:41 UTC
Sorry, now the problem is different. Anyway:
ls -laZ /var/log/mysqld.log
ls: cannot access /var/log/mysqld.log: No such file or directory

Comment 16 Pablo Hinojosa 2014-02-15 23:11:59 UTC
I could not reproduce the error again, so maybe was a typo. Do not open the bug again unless somebody else has the same error.

Comment 17 Pablo Hinojosa 2014-02-20 02:39:32 UTC
Just if anybody has the same problem: the reason of Comments 15 and 16 was this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1066112

Comment 18 wes hayutin 2014-03-20 20:10:19 UTC
There are still issues here to be looked at.
Log files are not generated properly for mariadb to start or restart.

Thanks

Comment 19 Fedora End Of Life 2015-05-29 10:48:08 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 20 Fedora End Of Life 2015-06-30 00:53:10 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.