[debian-mysql] Bug#972382: Bug#972382: mariadb-server-10.5: logrotate service error at system startup

Antonio antdev66 at gmail.com
Tue Oct 20 10:43:58 BST 2020


*$ dpkg -S /etc/logrotate.d/mysql-server*

mariadb-server-10.5: /etc/logrotate.d/mysql-server



*$ find /etc/logrotate.d/m* -ls*

  4857005      4 -rw-r--r--   1 root     root         1751 ott 16 07:32
/etc/logrotate.d/mariadb
  4851922      4 -rw-r--r--   1 root     root          800 ott 20 11:34
/etc/logrotate.d/mysql-server



*$ cat /etc/logrotate.d/mariadb*

# This is the MariaDB configuration for the logrotate utility
#
# Note that on most Linux systems logs are written to journald, which has
its
# own rotation scheme.
#
# Read https://mariadb.com/kb/en/error-log/ to learn more about logging and
# https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/ about rotating
logs.

/var/lib/mysql/mysqld.log /mysql.log /var/lib/mysql/mariadb.log
/mysql-slow.log /mariadb-slow.log /error.log {

  # If any of the files listed above is missing, skip them silently without
  # emitting any errors
  missingok

  # If file exists but is empty, don't rotate it
  notifempty

  # Run daily
  daily

  # Keep one week of logs
  rotate 7

  # If file is growing too big, rotate immediately
  maxsize 100M

  # Compress logs, as they are text and compression will save a lot of disk
space
  compress

  # Don't compress the log immediately to avoid errors about "file size
changed while zipping"
  delaycompress

  # Don't run the postrotate script for each file configured in this file,
but
  # run it only once if one or more files were rotated
  sharedscripts

  # After each rotation, run this custom script to flush the logs. Note that
  # this assumes that the mariadb-admin command has database access, which
it
  # has thanks to the default use of Unix socket authentication for the
'root'
  # account used everywhere since MariaDB 10.4.
  postrotate
    if test -x /etc/mysql/debian.cnf
    then
      EXTRAPARAM='--defaults-file=/etc/mysql/debian.cnf'
    fi

    if test -x /usr/bin/mariadb-admin && \
        /usr/bin/mariadb-admin ping &>/dev/null
    then
      /usr/bin/mariadb-admin $EXTRAPARAM --local flush-error-log \
        flush-engine-log flush-general-log flush-slow-log
    fi
  endscript
}



*$ cat /etc/logrotate.d/mysql-server*

# - I put everything in one block and added sharedscripts, so that mysql
gets
#   flush-logs'd only once.
#   Else the binary logs would automatically increase by n times every day.
# - The error log is obsolete, messages go to syslog now.
/var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log
/var/log/mysql/mariadb-slow.log /var/log/mysql/error.log {
    daily
    rotate 7
    missingok
    create 640 mysql adm
    compress
    sharedscripts
    postrotate
          test -x /usr/bin/mysqladmin || exit 0
          if [ -f `*my_print_defaults --mariadb* | grep -oP
"pid-file=\K[^$]+"` ]; then
            # If this fails, check debian.conf!
            mysqladmin --defaults-file=/etc/mysql/debian.cnf --local
flush-error-log \
              flush-engine-log flush-general-log flush-slow-log
          fi
    endscript
}


*$ my_print_defaults --mariadb*

my_print_defaults: unknown option '--mariadb'


but if I change with --mysqld it would seem ok:

*$ my_print_defaults --mysqld *

--socket=/run/mysqld/mysqld.sock
--user=mysql
--pid-file=/run/mysqld/mysqld.pid
--basedir=/usr
--datadir=/var/lib/mysql
--tmpdir=/tmp
--lc-messages-dir=/usr/share/mysql
--lc-messages=en_US
--skip-external-locking
--bind-address=127.0.0.1
--expire_logs_days=10
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci



*$ my_print_defaults *

my_print_defaults  Ver 1.7 for debian-linux-gnu at x86_64
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Prints all arguments that is give to some program using the default files
Usage: my_print_defaults [OPTIONS] [groups]
 -#, --debug[=#]     This is a non-debug version. Catch this and exit
 -c, --defaults-file=name
                     Read this file only, do not read global or per-user
                     config files; should be the first option
 -e, --defaults-extra-file=name
                     Read this file after the global config file and before
                     the config file in the users home directory; should be
                     the first option
 -g, --defaults-group-suffix=name
                     In addition to the given groups, read also groups with
                     this suffix
 *--mysqld            Read the same set of groups that the mysqld binary
does. *
 -n, --no-defaults   Return an empty string (useful for scripts).
 -?, --help          Display this help message and exit.
 -v, --verbose       Increase the output level
 -V, --version       Output version information and exit.

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

Variables (--variable-name=value)
and boolean options {FALSE|TRUE}  Value (after reading options)
--------------------------------- ----------------------------------------
defaults-file                     my
defaults-extra-file               (No default value)
defaults-group-suffix             (No default value)
mysqld                            FALSE

Example usage:
my_print_defaults --defaults-file=example.cnf client client-server mysql


Il giorno mar 20 ott 2020 alle ore 10:39 Otto Kekäläinen <otto at debian.org>
ha scritto:

> Hello!
>
> Just to make sure, what does this say on your system?
>
> dpkg -S /etc/logrotate.d/mysql-server
>
> and
>
> find /etc/logrotate.d/m* -ls
>
>
> Maybe the problem is not the contents of the file, but that the file
> is there at all after an upgrade.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-mysql-maint/attachments/20201020/6b0d3686/attachment.html>


More information about the pkg-mysql-maint mailing list