APT : the following packages have been kept back

Après la mise à jour d’Ubuntu Server sur le serveur, j’ai eu cette erreur récurrente après chaque mise à jour apt :

The following packages have been kept back:
  mysql-client mysql-server

Il m’était donc impossible de mettre à jour le serveur et client mysql , ce qui n’est évidemment pas idéal.

Et si l’on essaie de les installer directement avec:

apt install mysql-client mysql-server

On obtient alors ce message:

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:
 mysql-common : Conflicts: mysql-client-8.0 but 8.0.29-0ubuntu0.22.04.2 is to be installed
                Conflicts: mysql-client-core-8.0 but 8.0.29-0ubuntu0.22.04.2 is to be installed
 mysql-server : Depends: mysql-server-8.0 but it is not installable
E: Unable to correct problems, you have held broken packages.Code language: CSS (css)

Réinstaller mysql-apt-config

On commence donc par réinstaller le package mysql-apt-config :

wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.debCode language: JavaScript (javascript)

Et on installe le paquet :

dpkg -i mysql-apt-config_0.8.22-1_all.debCode language: CSS (css)

On relance donc la mise à jour :

apt update && apt upgrade

Les nouvelles versions des paquets peuvent désormais être installées :

9 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: http://repo.mysql.com/apt/ubuntu/dists/bionic/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
Listing... Done
libmysqlclient21/unknown 8.0.29-1ubuntu18.04 amd64 [upgradable from: 8.0.29-0ubuntu0.22.04.2]
mysql-client/unknown 8.0.29-1ubuntu18.04 amd64 [upgradable from: 8.0.28-1ubuntu18.04]
mysql-common/unknown 8.0.29-1ubuntu18.04 amd64 [upgradable from: 8.0.28-1ubuntu18.04]
mysql-community-client-core/unknown 8.0.29-1ubuntu18.04 amd64 [upgradable from: 8.0.28-1ubuntu18.04]
mysql-community-client-plugins/unknown 8.0.29-1ubuntu18.04 amd64 [upgradable from: 8.0.28-1ubuntu18.04]
mysql-community-client/unknown 8.0.29-1ubuntu18.04 amd64 [upgradable from: 8.0.28-1ubuntu18.04]
mysql-community-server-core/unknown 8.0.29-1ubuntu18.04 amd64 [upgradable from: 8.0.28-1ubuntu18.04]
mysql-community-server/unknown 8.0.29-1ubuntu18.04 amd64 [upgradable from: 8.0.28-1ubuntu18.04]
mysql-server/unknown 8.0.29-1ubuntu18.04 amd64 [upgradable from: 8.0.28-1ubuntu18.04]
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  linux-headers-5.15.0-25 linux-headers-5.15.0-25-generic linux-image-5.15.0-25-generic linux-modules-5.15.0-25-generic
  linux-modules-extra-5.15.0-25-generic
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
  libmysqlclient21 mysql-client mysql-common mysql-community-client mysql-community-client-core mysql-community-client-plugins
  mysql-community-server mysql-community-server-core mysql-server
9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Code language: JavaScript (javascript)

J’ai également écrit un script bash qui automatise tout cela : Mettre à jour mysql-client-server-apt-config

Résoudre le message “Key is stored in legacy trusted.gpg keyring”

Dans le message précédent, nous pouvons trouvez ce message d’avertissement:

W: http://repo.mysql.com/apt/ubuntu/dists/bionic/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.Code language: JavaScript (javascript)

Je l’ai résolu en déplaçant le fichier dans le répertoire trusted.gpg.d :

mv trusted.gpg trusted.gpg.d/

Et voilà, plus d’erreur avec apt et notre système met bien tous ses paquets à jour.

Envie d'ajouter des fonctionnalités exceptionnelles à votre site WordPress ou WooCommerce? Je suis là pour vous aider.

Explorons les possibilités ensemble »

Articles conseillés :

Opinions