4

I have Debian Jessie (amd64 with i386 multiarch) installed on my system. But there are some packages not available for installation, although they should.

I am trying to install mysql-client, but I get this error:

$ apt-get install mysql-client
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package mysql-client is a virtual package provided by:
mysql-client-5.5 5.5.57-0+deb8u1 [Not candidate version]
mysql-client-5.5 5.5.55-0+deb8u1 [Not candidate version]

E: Package 'mysql-client' has no installation candidate

Trying to install mysql-client-5.5 tells a bit more:

$ apt-get install mysql-client-5.5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package mysql-client-5.5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

My sources.list looks like this:

deb http://ftp.de.debian.org/debian/ jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.de.debian.org/debian/ jessie-updates main contrib non-free
deb https://dl.winehq.org/wine-builds/debian/ jessie main

How can I fix this strange behaviour?

UPDATE

Doing a apt-cache search mysql only prints these few packages. That does not seem correct to me.

akonadi-backend-mysql - MySQL storage backend for Akonadi
libreoffice-base-drivers - Database connectivity drivers for LibreOffice
libmysqlclient18 - MySQL database client library
mysql-common - MySQL database common files, e.g. /etc/mysql/my.cnf
mysql-server-core-5.5 - MySQL database server binaries
php5-sqlite - SQLite module for php5
libqt4-sql-mysql - Qt 4 MySQL database driver
librdf0 - Redland Resource Description Framework (RDF) library
rsyslog - reliable system and kernel logging daemon
  • 1
    What does apt-get update says? – xhienne Aug 4 '17 at 18:33
  • 1
    Nothing uncommon. It fetches all package information and says Done when finished. – naitsirch Aug 4 '17 at 18:35
  • 1
    not an answer to your question (because mysql should still be available in jessie) but it's worth noting that debian has been transitioning from mysql to mariadb for several years now. mariadb is in jessie, and is apparently the only mysql variant in stretch. so switching to mariadb is a good idea if you want regular updates. see wiki.debian.org/Teams/MySQL/MariaDB. also seravo.fi/2015/… and softwareengineering.stackexchange.com/questions/120178/…. google for many more. – cas Aug 5 '17 at 1:51
  • 1
    Yes, I would have migrated to mariadb, but those package aren't available, too. Searching for "mariadb" with apt-cache search does not find anything. – naitsirch Aug 7 '17 at 20:51
4
+50

[Note: the solution was discovered in the Update 2 data, and explained at the bottom, apt pinning.]

Diagnosing this issue requires determining where the failure is happening.

First, try this, it appears that something is wrong in terms of your sources, so just replace them with these, then debug backwards once you have a working setup again:

https://packages.debian.org/search?keywords=mysql-client&searchon=names&suite=oldstable&section=all

Exact hits Package mysql-client

jessie (oldstable) (database): MySQL database client (metapackage depending on the latest version)
5.5.57-0+deb8u1 [security]: all
also provided by: mysql-client-5.5

Other hits Package mysql-client-5.5

jessie (oldstable) (database): MySQL database client binaries
5.5.57-0+deb8u1 [security]: amd64 arm64 armel armhf i386 mips mipsel powerpc ppc64el s390x

This shows the packages in question are in old stable. Change your sources.list to this:

#deb http://ftp.de.debian.org/debian/ jessie main contrib non-free
#deb http://security.debian.org/ jessie/updates main contrib non-free
#deb http://ftp.de.debian.org/debian/ jessie-updates main contrib non-free
# try these instead:
deb http://mirrors.kernel.org/debian jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
# and your wine repo
deb https://dl.winehq.org/wine-builds/debian/ jessie main

Save, then: apt-get update

Then: apt-cache search mysql

If this does not now show your mysql-client, I believe something very difficult to debug is corrupted in your system.

Also, show in the full results of: apt-get update not just the last line, the entire thing, that may show errors you are missing.

You can also always check what your local apt knows, with something like this:

apt-cache show mysql-client

and carefully examine the output.

also: apt-cache policy mysql-client

It's clear that your apt update is failing to update for whatever reason, I suggest the above change of repos to remove some variables from the question.

[Updated] Note, I corrected a line in sources.list update yours, but your paste shows that was the only item failing, which means your primary jessie main contrib non-free local database is not for some reason updating correctly.

Modify the sources.list, run apt-get update again, and look for errors again. It's clear your apt package database is failing to update.

[Update 2] If apt-get update is working and not showing errors, and if you see the end result: 18.9 MB updated which your paste does show in the end, this strongly suggests that the issue is a failure to write the data to disk, in a way that apt itself is not able to be aware of in order to show error messages due to that failure.

Check: dmesg | grep apt-get for any error messages as well. Check the system with df -hT to make sure the /var partition apt is writing the update data to is not full. Run a fsck on the partition that contains /var.

Note that reinstalling will not fix hardware failures, so it's probably a better idea to figure out why it's failing than to reinstall hoping that will resolve the issues.

Did anything or anyone change the permissions of the apt database?

Check the following (note in particular the size of the files):

ls -l /var/cache/apt
# the results should look like this:
drwxr-xr-x 3 root root   147456 Jul 22 16:50 archives
-rw-r--r-- 1 root root 32808269 Aug 13 16:15 pkgcache.bin
-rw-r--r-- 1 root root 32088021 Aug 13 16:15 srcpkgcache.bin

Further, the last modified date should change every time you run apt-get update.

Further checks:

ls -l /var/lib/apt/lists/

should show all your repos and their associated data that was grabbed from apt-get update, or in your case, apparently grabbed but not updated.

Repeat the search: apt-cache search mysql-client which should either show nothing, as was your case until now, or it should show something.

Next: check that you have not set apt preferences to use a previous distribution or some other unremembered event in /etc/apt:

cd /etc/apt
cat apt.conf apt.conf.d/* preferences preferences.d/*

This should return any configurations set in those files (for example):

APT::Default-Release "buster";
APT::Get::AutomaticRemove "0";
APT::Get::HideAutoRemove "1";

[UPDATE 3 - Solved?]

And the user configurations from the /etc/apt cat above show the problem, which was obvious as soon as I saw it, but not obvious to guess, though the hint of running Jessie, old stable, after new stable, Stretch, was released should have been enough to check the pinning without the other tests:

// Use apt bandwidth limit feature, this example limits the download
// speed to 70kb/sec
//Acquire::http::Dl-Limit "70";
// Pre-configure all packages with debconf before they are installed.
// If you don't like it, comment it out.
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};
Package: *
Pin: release a=stable [***** my emphasis]
Pin-Priority: 900

Package: *
Pin: release o=Debian
Pin-Priority: -10
cat: preferences.d/*: No such file or directory

Now it makes sense, no technical issues, no hardware issues, yet apt is showing no packages. Why? Because your system is pinned to stable, which is stretch, not jessie.

Change the pinning, first locate the file that has that pinning in it:

grep -snR 'Pin: release a=stable' /etc/apt

Then change 'stable' to 'jessie' and everything should work again.

Except I believe you need to change it to (note the n instead of a, n is the name of the release):

Pin: release n=jessie

And maybe add in /etc/apt/apt.conf this line, though I don't believe it's necessary in your case.

APT::Default-Release "jessie";

https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html

Note that jessie I don't believe had all the .d directories yet, so it's hard to remember where its files should go, probably in the .d/ directories will work fine.

The Default-Release is set in: /etc/apt/apt.conf.d/80Basics The Pinning is in: /etc/apt/preferences.d/80Basics In your case, the pinnning is in /etc/apt/preferences

Basically you told apt to pin to stable, and it dutifully is doing what you told it to do, only you don't have stable in your sources, you have what is now old stable. So apt when you ask it about packages, dutifully informs, after you update jessie sources, that there are basically no packages to be found. No errors are reported because no error occurred, the update worked fine, the package database was updated fine, the package lists all updated, but sadly, none of them contain stretch (stable) data. That's the risk of using 'stable' instead of the actual distribution name in that, it's very easy to forget you did it, and even more confusing when stable changes to old stable, or EOL stable. Note that generally you can use sid/testing/stable in your sources, but I've found that those can fail at times when testing rolls to new testing, and stable becomes old stable, so the actual names are my preferences except of course for sid, which never changes.

I believe this is the solution, as you can see, reinstalling is almost never the solution, and I was increasingly beginning to suspect you had something configured somewhere that you'd forgotten about, since everything is working, apparently.

I believe that pinning is going to be in /etc/apt/preferences (since preferences.d didn't exist in your jessie).

APT PINNING: https://wiki.debian.org/AptPreferences

As a a result, I use a more conservative "only if I say so" approach to a mixed distribution, with a Pin file like this:

Package: * Pin: release a=testing Pin-Priority: 900

Package: * Pin: release o=Debian Pin-Priority: -10

Thus all debian packages are defaulted to priority -10, while testing receives a 900 point bonus. This invokes the behaviors:

From apt_preferences(5)

500 < P <=990 : causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent [...] P < 0 : prevents the version from being installed

[...]

P < 0 : prevents the version from being installed

As you can see, you told apt to basically ignore everything that is not stable (-10), and to only use stable (900), so apt did what you told it to do.

Given this was a stable, not sid or testing installation, I wouldn't in general use that -10 pinning, I'd use something like 100 or 200. But I'd only use pinning if I was actually running various pools, like stretch and jessie, or sid and testing, there's no point beyond confusing yourself to using it if you are only using Jessie, and even then, apt basically ignores the pinning and uses the Default-Release anyway now, for example, I have my testing pinned to 900, but set to default release, so apt-cache policy show this:

apt-cache policy nano
nano:
  Installed: 2.7.4-1
  Candidate: 2.8.6-1
  Version table:
     2.8.6-2 300
        300 http://mirrors.kernel.org/debian unstable/main i386 Packages
     2.8.6-1 990
        990 http://mirrors.kernel.org/debian buster/main i386 Packages
 *** 2.7.4-1 100
        100 /var/lib/dpkg/status

As you can see, the pinning value is 990, which isn't something I did, it's something apt does when you declare the default-release explicitly.

https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html

The stretch man page for preferences is pretty clear.

  • After changing my sources.list I do get some errors on apt-get update see here. – naitsirch Aug 10 '17 at 20:05
  • See corrected sources.list lines, try it again. Your local db is not updating, nor apparently has it updated for quite some time. – Lizardx Aug 12 '17 at 19:36
  • This did not work either, also no error occured anymore :-( seems like I have to reinstall my system... thanks for your help anyway! – naitsirch Aug 13 '17 at 22:46
  • Double check with this command, which may help show a possible internal apt error with the update process: dmesg | grep apt-get – Lizardx Aug 13 '17 at 22:59
  • In general, I would never reinstall Debian since almost all issues are fixable. I would check some basics, for example, is there room in your partitions (df -hT) if / or /var are full this may create failures, since apt-get has nothing to write to then on updates. You may also have disk issues, that may point to hardware failures. So I'd check the partition and disk, I'd do all of those steps before reinstalling, since a reinstall won't fix those issues in general. – Lizardx Aug 13 '17 at 23:01
1

Mysql-client says

This is a transitional MySQL database that depends on default MySQL client metapackage. It can be safely removed.

I think you need either default-mysql-client or default-mysql-client-core

The former says

MySQL is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query language in the world. The main goals of MySQL are speed, robustness and ease of use.

This package depends on the default implementation of the client binaries and the additional tools innotop and mysqlreport.

The latter says

MySQL is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query language in the world. The main goals of MySQL are speed, robustness and ease of use.

This package depends on the default implementation of the core client files, as used by Akonadi.

  • E: Unable to locate package default-mysql-client same output for default-mysql-client-core. – naitsirch Aug 4 '17 at 18:48
0

Replace in /etc/apt/sources.list ftp with http. apt-mirrors Sooner or later you have to to this. Following as root or with sudo. dpkg --clear-avail and rm -f /var/lib/apt/lists/* After that refresh apt update && apt install mysql-client

Your mirror is at time not reachable. Maybe related

    ping -c 4 http://mirrors.kernel.org/
ping: unknown host http://mirrors.kernel.org/

In /etc/apt/sources.list

deb http://http.us.debian.org/debian/ jessie main contrib non-free 
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://http.us.debian.org/debian/ jessie-updates contrib non-free main 

dpkg --clear-avail and rm -f /var/lib/apt/lists/* After that refresh apt update && apt install mysql-client

  • 2
    Only FTP services will be disabled. The DNS names ftp.debian.org and ftp.<CC>.debian.org will remain the same. The mirrors should just be accessed using HTTP instead (see debian.org/News/2017/20170425.en.html) – naitsirch Aug 7 '17 at 20:41
  • After clearing the caches and doing the apt update the package still cannot be found :-( – naitsirch Aug 7 '17 at 20:42
0

Can you run the command apt policy and apt policy mysql-client also run if you want apt policy mysql-client-5.5

You will also need to install pastebinit apt install pastebinit and then run this two commands cat /etc/apt/sources.list | pastebinit -b paste.debian.net

also you might want to pastebin output of apt policy and mysql-client-5.5apt policy mysql-client

You will probably need to do a little apt pinning but we will resolve this. Also don't forget to clean the cache apt clean.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.