mysql-server-5.6.postinst fails with: "cp: impossible d'écraser le répertoire «/var/lib/mysql-upgrade/DATADIR.link/mysql» par un non répertoire"

Bug #1607651 reported by g.bonnavenc
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
mysql-5.6 (Ubuntu)
New
Undecided
Unassigned

Bug Description

aucune application en marche, mise à jour des paquets trop importante avec proposition de le faire en plusieurs fois

ProblemType: Package
DistroRelease: Ubuntu 14.04
Package: mysql-server-5.6 5.6.30-0ubuntu0.14.04.1
ProcVersionSignature: Ubuntu 3.19.0-64.72~14.04.1-lowlatency 3.19.8-ckt22
Uname: Linux 3.19.0-64-lowlatency x86_64
ApportVersion: 2.14.1-0ubuntu3.21
Architecture: amd64
Date: Fri Jul 29 08:47:16 2016
DpkgTerminalLog:
 Preparing to unpack .../mysql-server-5.6_5.6.31-0ubuntu0.14.04.2_amd64.deb ...
 mysql stop/waiting
 cp: impossible d'écraser le répertoire «/var/lib/mysql-upgrade/DATADIR.link/mysql» par un non répertoire
 dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.6_5.6.31-0ubuntu0.14.04.2_amd64.deb (--unpack):
  subprocess new pre-installation script returned error exit status 1
DuplicateSignature: package:mysql-server-5.6:5.6.30-0ubuntu0.14.04.1:subprocess new pre-installation script returned error exit status 1
ErrorMessage: subprocess new pre-installation script returned error exit status 1
InstallationDate: Installed on 2016-02-09 (170 days ago)
InstallationMedia: Ubuntu-Studio 14.04.3 LTS "Trusty Tahr" - Beta amd64 (20150805)
RelatedPackageVersions:
 dpkg 1.17.5ubuntu5.7
 apt 1.0.1ubuntu2.14
SourcePackage: mysql-5.6
Title: package mysql-server-5.6 5.6.30-0ubuntu0.14.04.1 failed to install/upgrade: subprocess new pre-installation script returned error exit status 1
UpgradeStatus: No upgrade log present (probably fresh install)
mtime.conffile..etc.apparmor.d.usr.sbin.mysqld: 2016-02-16T11:40:10.080501

Revision history for this message
g.bonnavenc (georges) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I believe this problem comes from the following code in mysql-server-5.6.preinst:

# if there's a symlink, let's store where it's pointing, because otherwise
# it's going to be lost in some situations
for dir in DATADIR LOGDIR; do
    checkdir=`eval echo "$"$dir`
    if [ -L "$checkdir" ]; then
        mkdir -p "$UPGRADEDIR"
        cp -d "$checkdir" "$UPGRADEDIR/$dir.link"
    fi
done

It isn't obvious to me why this would fail in this case, however. Please can you report the output of "stat /var/lib/mysql", "stat /var/lib/mysql-upgrade", "stat /var/lib/mysql-upgrade/DATADIR.link" and "stat /var/lib/mysql-upgrade/DATADIR.link/mysql" and then change the bug status back to New?

Changed in mysql-5.6 (Ubuntu):
status: New → Incomplete
summary: - package mysql-server-5.6 5.6.30-0ubuntu0.14.04.1 failed to
- install/upgrade: subprocess new pre-installation script returned error
- exit status 1
+ mysql-server-5.6.postinst fails with: "cp: impossible d'écraser le
+ répertoire «/var/lib/mysql-upgrade/DATADIR.link/mysql» par un non
+ répertoire"
Robie Basak (racb)
tags: added: triage
Changed in mysql-5.6 (Ubuntu):
status: Incomplete → New
Robie Basak (racb)
tags: added: mysql-alternate-datadir
Revision history for this message
CDuv (d-ubuntuone-accounts) wrote :
Download full text (3.3 KiB)

My MySQL 5.6's datadir is a symbolic link and I've the same issue.
To be honest this server uses using Debian v7.11:
Linux 3.16.0-0.bpo.4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3~bpo70+1 (2016-07-07) x86_64 GNU/Linux

An `aptitude upgrade` fails:

----------8<----------
$ aptitude upgrade
The following packages will be upgraded:
  mysql-server-5.6
The following packages are RECOMMENDED but will NOT be installed:
  mysql-common-5.6
1 packages upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B/14.7 MB of archives. After unpacking 8192 B will be used.
Do you want to continue? [Y/n/?] Y
Reading changelogs... Done
Preconfiguring packages ...
(Reading database ... 93574 files and directories currently installed.)
Preparing to replace mysql-server-5.6 5.6.32-1~dotdeb+7.1 (using .../mysql-server-5.6_5.6.34-1~dotdeb+7.2_amd64.deb) ...
Stopping MySQL database server: mysqld.
Stopping MySQL database server: mysqld.
cp: cannot overwrite directory `/var/lib/mysql-upgrade/DATADIR.link/mysql' with non-directory
dpkg: error processing /var/cache/apt/archives/mysql-server-5.6_5.6.34-1~dotdeb+7.2_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for tables which need an upgrade, are corrupt or were
not closed cleanly..
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.6_5.6.34-1~dotdeb+7.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
----------8<----------

Here are the asked `stat` outputs:
----------8<----------
$ stat /var/lib/mysql
  File: `/var/lib/mysql' -> `/home/.var/lib/mysql'
  Size: 20 Blocks: 0 IO Block: 4096 symbolic link
Device: 901h/2305d Inode: 394478 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 105/ mysql) Gid: ( 0/ root)
Access: 2016-12-06 14:06:27.000000000 +0100
Modify: 2014-05-14 11:03:53.000000000 +0200
Change: 2014-10-01 17:09:49.000000000 +0200
 Birth: -

$ stat /var/lib/mysql-upgrade
  File: `/var/lib/mysql-upgrade'
  Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 901h/2305d Inode: 408247 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2016-12-06 16:32:45.000000000 +0100
Modify: 2016-09-13 14:48:36.000000000 +0200
Change: 2016-09-13 14:48:36.000000000 +0200
 Birth: -

$ stat /var/lib/mysql-upgrade/DATADIR.link
  File: `/var/lib/mysql-upgrade/DATADIR.link' -> `/home/.var/lib/mysql'
  Size: 20 Blocks: 0 IO Block: 4096 symbolic link
Device: 901h/2305d Inode: 397993 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2016-12-06 16:31:58.000000000 +0100
Modify: 2016-09-13 14:48:36.000000000 +0200
Change: 2016-09-13 14:48:36.000000000 +0200
 Birth: -

$ stat /var/lib/mysql-upgrade/DATADIR.link/mysql
  File: `/var/lib/mysql-upgrade/DATADIR.link/mysql'
  Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 902h/2306d Inode: 56754435 Links: 2
Access: (0700/drwx---...

Read more...

Revision history for this message
CDuv (d-ubuntuone-accounts) wrote :

Workaround (found on "https://bugs.launchpad.net/ubuntu/+source/mariadb-10.0/+bug/1474212/comments/2"):

rm /var/lib/mysql-upgrade/DATADIR.link
apt-get -f install

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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