Bug 1598095

Summary: problem with fuser usage during init
Product: Red Hat Enterprise Linux 7 Reporter: Karel Volný <kvolny>
Component: mariadbAssignee: Michal Schorm <mschorm>
Status: CLOSED ERRATA QA Contact: Anna Khaitovich <akhaitov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: akhaitov, databases-maint, hhorak, mmuzila
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 13:18:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karel Volný 2018-07-04 10:37:59 UTC
Description of problem:
the script
/usr/libexec/mariadb-prepare-db-dir
makes use of the 'fuser' command

there are two problems with that:

a) the package doesn't depend on psmisc, so fuser command doesn't need to be installed
b) the script runs with mysql user privileges, which prevents fuser from functioning correctly

Version-Release number of selected component (if applicable):
mariadb-server-5.5.60-1.el7_5.x86_64

Comment 2 Honza Horak 2018-07-04 10:51:01 UTC
We probably should use a similar check as we're doing in Fedora:

  # some process uses the socket file
  response=`@bindir@/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER --connect-timeout="${CHECKSOCKETTIMEOUT:-10}" ping 2>&1`
  if [ $? -qe 0 ] || echo "$response" | grep -q "Access denied for user" ; then
    echo "Is another MySQL daemon already running with the same unix socket?" >&2
    echo "Please, stop the process using the socket $socketfile or remove the file manually to start the service." >&2
    exit 1
  fi

Taken from https://src.fedoraproject.org/cgit/rpms/mariadb.git/tree/mysql-check-socket.sh#n28

Comment 9 Anna Khaitovich 2019-06-10 07:55:00 UTC
OLD:
$ rpm -qa mariadb-server
mariadb-server-5.5.60-1.el7_5.x86_64
$ grep fuser /usr/libexec/mariadb-prepare-db-dir
if fuser "$socketfile" &>/dev/null ; then

NEW:
$ rpm -qa mariadb-server
mariadb-server-5.5.64-1.el7.x86_64
$ grep fuser /usr/libexec/mariadb-prepare-db-dir
$ echo $?
1

old FAIL. new PASS => FIXED

Comment 11 errata-xmlrpc 2019-08-06 13:18:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2327