[MDEV-9176] dist-upgrade from 10.1 to 10.2 fails Created: 2015-11-24  Updated: 2016-11-25  Resolved: 2016-11-25

Status: Closed
Project: MariaDB Server
Component/s: Platform Debian
Affects Version/s: 10.2
Fix Version/s: 10.2.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Otto Kekäläinen
Resolution: Fixed Votes: 0
Labels: foundation

Attachments: Zip Archive compile.zip     Text File dist-upgrade.txt    
Sprint: 10.2.2-2, 10.2.4-1

 Description   

Preparing to unpack .../mariadb-server-10.2_10.2.1+maria-1~jessie_amd64.deb ...
Failed to stop mysql.service: Unit mysql.service not loaded.                                                                                                          
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.2_10.2.1+maria-1~jessie_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mariadb-server-10.2_10.2.1+maria-1~jessie_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I'm not even sure that major upgrade (10.0=>10.1, 10.1=>10.2 and such) is supposed to happen upon dist-upgrade, I would prefer it not to, but it does now.
It works for 10.0=>10.1, at least on Jessie, but fails for 10.1=>10.2, I guess it has something to do with systemd.



 Comments   
Comment by Sergey Vojtovich [ 2016-09-08 ]

otto, will you be interested to take over this task? I won't be able to fix it in reasonable time.

The problem here is that "invoke-rc.d mysql stop" in preinst gets unexpected error becasue mariadb.service was removed, while broken mysql.service symlink is still there.

I believe postrm should have something like:

# Automatically added by dh_systemd_enable
if [ "$1" = "remove" ]; then
        if [ -x "/usr/bin/deb-systemd-helper" ]; then
                deb-systemd-helper mask mysql.service >/dev/null
        fi
fi
 
if [ "$1" = "purge" ]; then
        if [ -x "/usr/bin/deb-systemd-helper" ]; then
                deb-systemd-helper purge mysql.service >/dev/null
                deb-systemd-helper unmask mysql.service >/dev/null
        fi
fi
# End automatically added section

We already call dh_systemd_enable in rules, but I believe these lines aren't emitted for some reason.

Comment by Otto Kekäläinen [ 2016-11-02 ]

Do we have a buildbot step that tests this? Does the bug actually still exist or was it already fixed in 10.2 head?

Comment by Andrii Nikitin (Inactive) [ 2016-11-04 ]

No, buildbot doesn't run step with dist-upgrade currently. I can test that manually - But I fully agree with Elena that upgrade of mariadb-server should never happen as part of dist-upgrade
Otto Kekäläinen, could you confirm if anything may be done to disable such upgrade and make sure that mariadb-server is only upgraded explicitly ? (at least for major upgrade like 10.1 - > 10.2)

Comment by Otto Kekäläinen [ 2016-11-04 ]

The intention is, that if you have 'mariadb-server' installed, then you will always have the latest version. If you have 'mariadb-server-10.1' installed (and not the mariadb-server package) then you will not update to the latest. The semantics of apt upgrade and apt dist-upgrade do not matter here.

Comment by Andrii Nikitin (Inactive) [ 2016-11-04 ]

Thank you for clarification (Side note: so it looks we should recommend installing package with version number to avoid roll upgrades to next major version).

I've tried manually upgrade recent 10.1 to recent 10.2 on Ubuntu 16.04 and no issues were observed:

Preparing to unpack .../mariadb-server_10.2.2+maria-1~xenial_all.deb ...
Unpacking mariadb-server (10.2.2+maria-1~xenial) over (10.1.18+maria-1~xenial) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
(Reading database ... 207297 files and directories currently installed.)
Removing mariadb-server-10.1 (10.1.18+maria-1~xenial) ...
<skipped>
Selecting previously unselected package mariadb-server-10.2.
(Reading database ... 207187 files and directories currently installed.)
Preparing to unpack .../mariadb-server-10.2_10.2.2+maria-1~xenial_amd64.deb ...
Unpacking mariadb-server-10.2 (10.2.2+maria-1~xenial) ...
Preparing to unpack .../libpython3.5_3.5.2-2~16.04_amd64.deb ...
<skipped>
$ systemctl status mysql
mariadb.service - MariaDB database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset:
Nov 04 19:57:26 a-VirtualBox mysqld[30615]: Version: '10.2.2-MariaDB-1~xenial-lo

Comment by Andrii Nikitin (Inactive) [ 2016-11-05 ]

Problem occurs on Jessie with current official latest 10.1.18 and 10.2.2 . Not sure about easy way to try dist-upgrade to latest internal build.

root@d86:/home/a# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
...
Removing mariadb-server-core-10.1 (10.1.18+maria-1~jessie) ...
Processing triggers for man-db (2.7.0.2-5) ...
Selecting previously unselected package mariadb-server-core-10.2.
(Reading database ... 151470 files and directories currently installed.)
Preparing to unpack .../mariadb-server-core-10.2_10.2.2+maria-1~jessie_amd64.deb ...
Unpacking mariadb-server-core-10.2 (10.2.2+maria-1~jessie) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up mysql-common (10.2.2+maria-1~jessie) ...
Setting up mariadb-common (10.2.2+maria-1~jessie) ...
Selecting previously unselected package mariadb-server-10.2.
(Reading database ... 151549 files and directories currently installed.)
Preparing to unpack .../mariadb-server-10.2_10.2.2+maria-1~jessie_amd64.deb ...
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
invoke-rc.d returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!
dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.2_10.2.2+maria-1~jessie_amd64.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mariadb-server-10.2_10.2.2+maria-1~jessie_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

So I rebooted, made sure that no mysqld process was started, but dist-upgrade still complains the same error "invoke-rc.d returned 5. There is a MySQL server running".

Comment by Andrii Nikitin (Inactive) [ 2016-11-07 ]

Problem didn't happen on jessie with upgrade to internal 10.2.3 http://hasky.askmonty.org/archive/10.2/build-11855/kvm-deb-jessie-amd64/debs/binary/
(I downloaded the packages, generated new Packages.gz and add directory with them to sources.list )

(Reading database ... 151662 files and directories currently installed.)
Preparing to unpack .../libmariadbclient18_10.2.3+maria~jessie_amd64.deb ...
Unpacking libmariadbclient18 (10.2.3+maria~jessie) over (10.1.18+maria-1~jessie) ...
Preparing to unpack .../libmysqlclient18_10.2.3+maria~jessie_amd64.deb ...
Unpacking libmysqlclient18 (10.2.3+maria~jessie) over (10.1.18+maria-1~jessie) ...
Setting up libmariadbclient18 (10.2.3+maria~jessie) ...
Setting up libmysqlclient18 (10.2.3+maria~jessie) ...
Processing triggers for libc-bin (2.19-18+deb8u6) ...

Comment by Otto Kekäläinen [ 2016-11-08 ]

anikitin If you've confirmed this is not an issue anymore with latest 10.2 dev tree, then please go ahead and close this issue so we can focus on the ones that are really still unsolved. Thanks!

PS. Why don't we have in buildbot a test that updates from 10.1 to 10.2 so that this would be automatically tested?

Comment by Otto Kekäläinen [ 2016-11-25 ]

This was fixed in https://github.com/MariaDB/server/commit/89236a8ad93bbfa39b935afc8eabdaab5a1e2474

Generated at Thu Feb 08 07:32:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.