Failures installing MariaDB 10.2 on Xenial

I’m filing this as a new issue because the symptoms and cause both appear to be completely different from the old one reported here: MariaDB 10.1 fails to install on Xenial

The first part of the problem is that apt-get is giving an error when trying to install the mariadb server. See this job’s log from lines 194 through 209:

$ PACKAGES='mariadb-server-10.1'
$ if [[ $(lsb_release -cs) = 'precise' ]]; then PACKAGES="${PACKAGES} libmariadbclient-dev"; fi
0.69s$ sudo apt-get install -y -o Dpkg::Options::='--force-confnew' $PACKAGES
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mariadb-server-10.1 : Depends: mariadb-client-10.1 (>= 10.1.41+maria-1~xenial) but it is not going to be installed
                       Depends: mariadb-server-core-10.1 (>= 10.1.41+maria-1~xenial) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

The second part of the problem is that the above apt-get failure did not cause travis-ci to flag the job as “error”. Instead, it continued, hiding the error messages behind a foldup/dropdown. Naturally, this led to further errors later on in the job which led to us wasting time barking up the wrong tree, looking in the wrong place.

Trusty appears not to be affected. I restarted the following job today (which, despite being a different commit, contains a project tree that’s file-for-file identical) only on this one it stuck to the old trusty (appropriate name :wink: ) and it still installed mariadb 10.1 succesfully, before running to succesful completion:

The cause is conflicting MySQL packages are installed. But if I run the same command locally, they are just uninstalled in the process. I don’t know the reason for this discrepancy.

Okay, I found the cause of the discrepancy. In Xenial, all 4 MySQL packages are marked as manually installed.
So I’d have to supply all the 4 corresponding MariaDB packages on the command line manually, too, for them to override the MySQL ones.

@BanzaiMan I could make a workaround PR so that MariaDB addon starts working in Xenial+ before is deployed.
But I would rather help you resolve whatever problem you are having with updating VM images – it has prevented a timely apply of quite a few bugfixes already.