/etc/cron.daily/mysql-server not removed during upgrade

Bug #40705 reported by Alan Tam
42
Affects Status Importance Assigned to Milestone
mysql-dfsg-5.0 (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

binlog rotation is now integrated into mysql server, configurable in /etc/mysql/my.cnf
/etc/cron.daily/mysql-server should be deleted during upgrade, but it isn't.
The script fails to run, hence generates one e-mail per day.

Known workaround: delete it manually

=== Original Text ===

/etc/cron.daily/mysql-server has the following problem:

> echo 'SHOW MASTER LOGS;' | $M --skip-column-names >$tmp 2>&1

> filename=`tail -n $KEEP_BINARY_LOGS $tmp | head -n 1`
> echo "PURGE MASTER LOGS TO '$filename';" | $M

It aims at listing all binlog "file names" into $tmp
and then send the (e.g.) 7-th last line in the file to "PURGE MASTER".

However, "SHOW MASTER LOGS" prints 2 entries in a line, hence you also sent the file size to "PURGE MASTER", which fails it.

mysql> show master logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin.000158 | 6333 |
| mysql-bin.000159 | 482630 |
| mysql-bin.000160 | 272 |
| mysql-bin.000161 | 538 |
| mysql-bin.000162 | 695 |
| mysql-bin.000163 | 117 |
| mysql-bin.000164 | 117 |
| mysql-bin.000165 | 141 |
| mysql-bin.000166 | 98 |
+------------------+-----------+

# cat $tmp
mysql-bin.000160 272

Version: 5.0.19-3

Revision history for this message
Dennis Kaarsemaker (dennis) wrote :

Adam, I thought you were the Ubuntu mysql guy - don't get mad if I'm wrong :)

Changed in mysql-dfsg-5.0:
assignee: nobody → adconrad
Revision history for this message
Tim Miller Dyck (timmillerdyck) wrote : Fix for Re: Fail to rotate binlogs

Here is one possible fix:

Edit line 49 of /etc/cron.daily/mysql-server from:
    filename=`tail -n $KEEP_BINARY_LOGS $tmp | head -n 1`
to:
    filename=`tail -n $KEEP_BINARY_LOGS $tmp | awk 'NR>1{exit};{print $1}'`

This removes the extra file size information from the line.

Revision history for this message
Alan Tam (at) wrote : Re: Fail to rotate binlogs

Something strange. The newer MySQL seems can rotate binlog itself, as there is "expire-logs-days" in /etc/mysql/my.cnf .

I've just make a new dapper install (epsilon), and found something strange against the computer upgrading from breezy (omega). It seems the files should have disappeared!

sltam@epsilon:~$ cat /var/lib/dpkg/info/mysql-server.list
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/mysql-server
/usr/share/doc/mysql-server/copyright
/usr/share/doc/mysql-server/changelog.Debian.gz

sltam@omega:~$ cat /var/lib/dpkg/info/mysql-server.list
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/mysql-server
/usr/share/doc/mysql-server/copyright
/usr/share/doc/mysql-server/changelog.Debian.gz
/etc/logcheck/ignore.d.paranoid/mysql-server
/etc/logcheck/ignore.d.server/mysql-server
/etc/logcheck/ignore.d.workstation/mysql-server
/etc/cron.daily/mysql-server
/etc/mysql/debian-log-rotate.conf

Revision history for this message
Chris Edwards (caedwa) wrote :

I've also been affected by this, I get this error from cron.daily:

/etc/cron.daily/mysql-server:
ERROR 1373 (HY000) at line 1: Target log not found in binlog index
run-parts: /etc/cron.daily/mysql-server exited with return code 1

This is an amd64 machine upgraded from breezy to dapper?

I ge tthe same results for the mysql-server.list as omega above.

Revision history for this message
Tim Miller Dyck (timmillerdyck) wrote :

According to /usr/share/doc/mysql-server-5.0/NEWS.Debian.gz,
/etc/mysql/debian-log-rotate.conf and /etc/cron.daily/mysql-server are obsolete and should just be deleted. Doing so cleared up this binary log rotate problem for me.
-Tim

--

  Rotation of the binary logs is now configured in /etc/mysql/my.cnf with
  "expire-logs-days" which defaults to 20 days. The old file
  /etc/mysql/debian-log-rotate.conf should be removed together with
  /etc/cron.daily/mysql-server after this value has been adjusted. Note that
  the old variable defined the number of files whereas the new one defines
  a time span in days.

Revision history for this message
Alan Tam (at) wrote :

The problem is why they are not removed after an upgrade, and hence generates one e-mail per day.

Revision history for this message
Simon Wong (wongy) wrote :

I have also been affected by this problem after an upgrade from Breezy to dapper. I guess the newer package scripts should detect and remove any old files that should no longer be installed.

Thanks.

Alan Tam (at)
description: updated
Revision history for this message
Mathias Gug (mathiaz) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. However, I am closing it because the bug has been fixed as of 5.0.27-1 (see debian bug #390889).

Changed in mysql-dfsg-5.0:
assignee: adconrad → nobody
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.