Upgrade fails when /var/lib/mysql is a soft link
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mariadb-10.0 (Debian) |
Fix Released
|
Unknown
|
|||
mariadb-10.0 (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Confirmed
|
Undecided
|
Unassigned | ||
mysql-5.7 (Ubuntu) |
Fix Released
|
Medium
|
Lars Tangvald | ||
Xenial |
Fix Released
|
Medium
|
Lars Tangvald |
Bug Description
Upgrade fails if datadir is a symlink and the server has previously been upgraded with datadir as a symlink
[Impact]
When upgrading, postinst makes a copy (with -d) of the datadir link to ensure it's preserved. This copy operation can fail in some situations if the destination already exists (because the package was previously upgraded with a similar situation), causing d/preinst to fail every time the user tries to upgrade the package unless they manually remove the old link every time.
The fix adds a -T to the copy operation, treating the destination as a regular file to be overwritten
[Test case]
* Create a /var/lib/mysql that is a symlink to some other location
* Install an older version of mysql-server
* Upgrade to a newer version of mysql-server
[Regression potential]
This change has been in Yakkety for some time (5.7.15-0ubuntu2).
The change only affects user with datadirs that are symlinks, and only a file copy operation for a file that's generally not used (it's backed up just in case)
[Original Description]
Not sure if it's relevant, by my mariadb data dir is on a secondary hard drive. /var/lib/
This is the terminal output for apt-get dist-upgrade:
Selecting previously unselected package mariadb-
(Reading database ... 274672 files and directories currently installed.)
Preparing to unpack .../mariadb-
cp: cannot overwrite directory ‘/var/lib/
dpkg: error processing archive /var/cache/
subprocess new pre-installation script returned error exit status 1
+ . /usr/share/
++ '[' '!' '' ']'
++ PERL_DL_NONLAZY=1
++ export PERL_DL_NONLAZY
++ '[' '' ']'
++ exec /usr/share/
+ . /usr/share/
++ '[' '!' 1 ']'
++ '[' -z '' ']'
++ exec
++ '[' '' ']'
++ exec
++ DEBCONF_REDIR=1
++ export DEBCONF_REDIR
+ '[' -n '' ']'
+ export PATH=/usr/
+ PATH=/usr/
+ ERR_LOGGER='logger -p daemon.err -t mysqld_safe -i'
+ set -o pipefail
+ MYSQL_BOOTSTRAP
+ set +e
+ invoke stop
+ '[' -x /usr/sbin/
+ invoke-rc.d mysql stop
+ set -e
+ case "$1" in
+ '[' abort-upgrade = configure ']'
+ db_stop
+ echo STOP
+ '[' -x /etc/init.d/mysql ']'
+ update-rc.d mysql defaults 19 21
+ '[' -x /etc/init.d/mysql ']'
+ echo 'Invoking mysql start'
+ logger -p daemon.err -t mysqld_safe -i
+ invoke-rc.d mysql start
+ exit 0
Preparing to unpack .../mariadb-
Unpacking mariadb-server (10.0.20-
Errors were encountered while processing:
/var/cache/
E: Sub-process /usr/bin/dpkg returned an error code (1)
ProblemType: Package
DistroRelease: Ubuntu 15.04
Package: mariadb-server-10.0 10.0.17-0ubuntu1
ProcVersionSign
Uname: Linux 3.19.0-22-generic x86_64
ApportVersion: 2.17.2-0ubuntu1.1
Architecture: amd64
Date: Tue Jul 14 08:07:15 2015
DpkgTerminalLog:
Preparing to unpack .../mariadb-
cp: cannot overwrite directory ‘/var/lib/
dpkg: error processing archive /var/cache/
subprocess new pre-installation script returned error exit status 1
DuplicateSignature: package:
ErrorMessage: subprocess new pre-installation script returned error exit status 1
InstallationDate: Installed on 2015-01-15 (180 days ago)
InstallationMedia: Ubuntu 14.10 "Utopic Unicorn" - Release amd64 (20141022.1)
RelatedPackageV
dpkg 1.17.25ubuntu1
apt 1.0.9.7ubuntu4
SourcePackage: mariadb-10.0
Title: package mariadb-server-10.0 10.0.17-0ubuntu1 failed to install/upgrade: subprocess new pre-installation script returned error exit status 1
UpgradeStatus: Upgraded to vivid on 2015-05-27 (47 days ago)
CVE References
tags: | removed: need-duplicate-check |
Changed in mariadb-10.0 (Ubuntu): | |
status: | New → Confirmed |
summary: |
- package mariadb-server-10.0 10.0.17-0ubuntu1 failed to install/upgrade: - subprocess new pre-installation script returned error exit status 1 + Upgrade fails when /var/lib/mysql is a soft link |
Changed in mariadb-10.0 (Debian): | |
status: | Unknown → New |
Changed in mariadb-10.0 (Debian): | |
status: | New → Fix Released |
Changed in mariadb-10.0 (Ubuntu): | |
importance: | Undecided → Medium |
Changed in mysql-5.7 (Ubuntu): | |
importance: | Undecided → Medium |
Changed in mysql-5.7 (Ubuntu): | |
milestone: | none → ubuntu-16.06 |
tags: | added: mysql-alternate-datadir |
Changed in mysql-5.7 (Ubuntu): | |
milestone: | ubuntu-16.06 → ubuntu-16.09 |
Changed in mysql-5.7 (Ubuntu): | |
status: | In Progress → Fix Committed |
tags: | added: xenial-candidate |
description: | updated |
Changed in mysql-5.7 (Ubuntu Xenial): | |
assignee: | nobody → Lars Tangvald (lars-tangvald) |
status: | Triaged → Fix Committed |
Changed in mysql-5.7 (Ubuntu Xenial): | |
status: | Fix Committed → In Progress |
Changed in mysql-5.7 (Ubuntu Xenial): | |
milestone: | none → xenial-updates |
Changed in mariadb-10.0 (Ubuntu): | |
status: | Fix Committed → Fix Released |
The problem was an existing /var/lib/ mysql-upgrade/ DATADIR. link file, which caused the soft link backup mechanism to fail.
This can be fixed manually be deleting /var/lib/ mysql-upgrade/ DATADIR. link and running apt-get -f install.
To fix the preinst script, just change the line
cp -d "$checkdir" "$UPGRADEDIR/ $dir.link"
to
cp -dT "$checkdir" "$UPGRADEDIR/ $dir.link"