Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.54k stars 848 forks source link

Bug: MariaDB 10.4 -> 10.5 upgrade #2525

Closed tomjn closed 2 years ago

tomjn commented 3 years ago

We upgraded to v10.5 but it seems this is not a clean upgrade. If you have v10.4 installed then you need to stop the service and remove it before installing 10.5, which we do not do

tomjn commented 3 years ago

The main roadblock to this is an automated check to identify when 10.4 is installed. Most research shows you can get a version string via an SQL query but there are no clean methods of getting just the version

e.g.

vagrant@vvv:~$ mysql -V
mysql  Ver 15.1 Distrib 10.5.12-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Ideally we would get 10.5.12 as the output

tomjn commented 3 years ago

re-adding the 10.4 mirrors then pinning the 10.5 mirrors at a higher priority might help

ssnepenthe commented 3 years ago

The main roadblock to this is an automated check to identify when 10.4 is installed. Most research shows you can get a version string via an SQL query but there are no clean methods of getting just the version

After a quick look through the mariadb string functions page I wonder if running the version string through the SUBSTRING_INDEX function would be sufficient?

vagrant@vvv:~$ mysql -BN -e "SELECT VERSION();"
10.5.12-MariaDB-1:10.5.12+maria~bionic

vagrant@vvv:~$ mysql -BN -e "SELECT SUBSTRING_INDEX((SELECT VERSION()), '-', 1);"
10.5.12
tomjn commented 3 years ago

This looks promising :)

The pseudocode/steps I envisage:

Pinning the 10.5 mirrors may still be something we want to do, but having a working check also means we can log that it's happening which makes life much easier for everybody

adionditsak commented 2 years ago

When running apt in the provisioning or manually, I get the following error:

default: Reading package lists...
    default: E
    default: : The repository 'http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal Release' does not have a Release file.
    default: E: The repository 'http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal Release' does not have a Release file.
    default: E: The repository 'http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal Release' does not have a Release file. 

Is this connected to the upgrade? It could seem like the sources are not set up properly.

Edit: It could be a general problem with the DO's sources for mariadb: https://www.digitalocean.com/community/questions/how-to-fix-errors-caused-by-digitalocean-s-broken-mariadb-links

Just to let you know that VVV is affected by this.

thomasdebruin commented 2 years ago

I have the same problem as @adionditsak It seemed to occur 'suddenly' after using my fresh vvv install for 2-3 weeks without problems (new machine), provioning many times (adding new projects).

When i do a fresh VVV, and completly destroy the vm/box first provision works, but with the second provision i get into trouble, which makes me think that maybe some updates occur on second provision which add compatibility issues.... but no clue yet. My host system is also Ubuntu 20.04.3 LTS (focal), i run in the same trouble when installing maria-DB 10.5 on my host.

My guess it's not broken links but some compatibility issue.

tomjn commented 2 years ago

@adionditsak @thomasdebruin this issue has nothing to do with that problem, it is unrelated with zero overlap.

This problem is about upgrading from 10.4 to 10.5

Your problem is about Digital Ocean f***ing up their apt mirror servers and taking their time fixing it

tomjn commented 2 years ago

see #2553

Mte90 commented 2 years ago

Any updates for this?

Mte90 commented 2 years ago

I was thinking that one of the solution could be to block the package to be uninstalled using the /etc/apt/apt.conf.d/01autoremove file. As after all mariadb is required anyway like also nginx.

tomjn commented 2 years ago

but we want that package, and we already have a system for listing packages to remove in our main provisioner.

The problem is that both 10.5 and 10.4 have the same package name

Mte90 commented 2 years ago

maybe we can do a command for apt that force the package version as minimum

tomjn commented 2 years ago

that assumes both packages are available and have sources, which they do not.

If you are on VVV, with 10.5 sources, and it sees 10.5 is available for upgrade, it will fail to upgrade. It wants the 10.4 package to be able to uninstall it. Telling it to use at a minimum 10.5 makes no difference because it can already see 10.5 and already wants 10.5 but cannot install it because it is unable to remove 10.4

tomjn commented 2 years ago

@Mte90 I was thinking, do you think adding both 10.4 and 10.5 apt sources but then pinning 10.5 as a higher priority and 10.4 as a lower priority would resolve the issue? It may work great, or not at all, what do you think? This way it can access both the old package it needs to uninstall 10.4, and the new 10.5 package for the upgrade

tomjn commented 2 years ago

We did this with NodeSource's PPA with an apt pin file:

https://github.com/Varying-Vagrant-Vagrants/VVV/blob/develop/provision/core/node-ppa/nodesource-ppa-pin

That got installed during provisioning, something similar to prioritise the 10.5 source and deprioritise the 10.4 source.

We'll want this to be specific to Ubuntu though as MariaDB gets installed from core sources on some OS' e.g. Raspbian, and we'd want separate pins for Ubuntu vs Debian

GitHub
VVV/nodesource-ppa-pin at develop · Varying-Vagrant-Vagrants/VVV
An open source Vagrant configuration for developing with WordPress - VVV/nodesource-ppa-pin at develop · Varying-Vagrant-Vagrants/VVV
Mte90 commented 2 years ago

I think that adding both the source and pin the version should fix, in my life with debian this fixed issue in the past as APT doesn't downgrade without specific commands and in our environment is happening because we execute various command for clean and so on.

Mte90 commented 2 years ago

I think that we can close it.