Today's article explores some more uses for 'apt-cache'.

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
12,674
Reaction score
11,632
Credits
104,431
The last article was also about apt-cache and that's what prompted me to write this one. Well, that and I'm sometimes going alphabetically with regards to the copious notes I've taken over the years.


If you're unfamiliar with apt-cache, you might find it does some pretty neat things that you were unaware of.

Feel free to comment there or here. Feedback is always appreciated. If you sign up for the newsletter, you'll know when articles are published and you'll still get 'em when I forget to share them here! (I almost forgot today's article.)
 


Why not combine this article with the other one?
 
'Cause I didn't think of it when I wrote the first article. I wrote the first article and then I was pretty sure there was more fun stuff to cover, so I made a second article. I also try to not make the articles very long. I try to keep the reading time to under five minutes.
 
I thought the topics are quite similar since they both cover apt-cache hence the question.
 
The first one definitely inspired the second one. After the first, I was thinking about it and I realized I could share more fun stuff that apt-cache does, so thus the 2nd article.

If I'd thought about it, I probably could have condensed it all into the first article. I'd have just had to be less 'chatty', but I kinda like the chattiness tone that I take.

I've already done tomorrow's article. It is not about apt.
 
As a Slackware user one thing that i'm reading up Debian (and off spring) is about apt preferences i.e priority 100 is already installed, 500 and 1000 . You touch on it with :

Code:
apt-cache policy inxi

but i guess there is always room for elaboration ?

With Slackware its a trade off looking for the most recent version of software but then then looking at what my system has in eg core stuff like Python 2.7 or Python3 and thus what it can support without me pulling my hair out and deps against requirements of latest software. As far as i can see the only way you can make use of the "labels" 100, 500 and 1000 is via /etc/apt/preferences and /etc/apt/preferences.d/. Can you at some point go into package version and preferences ? and what you can actually manually select. The basics of getting latest software for Slackware is simply to tweak the slackbuild and have in the build directory the appropriate latest source. eg Thats how i recently built inxi latest. I know what the slackbuild is going to do, i know the version of the src because i downloaded it and put into build. All i see with Debian is 100, 500 0r 1000 and no sense of how i exactly choose the veersion i want
 
Last edited:
All i see with Debian is 100, 500 0r 1000 and no sense of how i exactly choose the veersion i want

I really don't understand that enough to explain it to others. So, thanks! That'll give me something to learn.
 
I wondered the same as Andy.

You can get the info on the Priorities with

Code:
man apt_preferences

which says in part

priority 1
to the versions coming from archives which in their Release files are marked as "NotAutomatic: yes" but not as "ButAutomaticUpgrades: yes" like the
Debian experimental archive.

priority 100
to the version that is already installed (if any) and to the versions coming from archives which in their Release files are marked as "NotAutomatic:
yes" and "ButAutomaticUpgrades: yes" like the Debian backports archive since squeeze-backports.

priority 500
to the versions that do not belong to the target release.

priority 990
to the versions that belong to the target release.
The highest of those priorities whose description matches the version is assigned to the version.

The section is considerably longer than that, but if Andy cannot access that we can make arrangements.

Good Friday here

Have a safe Easter, all

Wizard
 
Have a safe Easter, all

Don't you tell me what to do!

(I may be sipping a nice single malt whiskey from here in the US, distilled in Virginia and unimaginatively named "Virginia Single Malt".)
 
Another tip for The Viewers (and David after he gets through that malt :)) is that

apt-cache

... supports globbing.

WIZARD'S GLOSSARY

Globbing -


The Bash shell feature that is used for matching or expanding specific types of patterns is called globbing. Globbing is mainly used to match filenames or searching for content in a file. Globbing uses wildcard characters to create the pattern.

Source - https://linuxhint.com/bash_globbing_tutorial/

Supposing you are looking for information on Déjà Dup, aka Duplicity, aka GNOME Backup - which has been mentioned recently in threads on backup solutions.

You can kill 2 birds with 1 stone, then by typing in and entering

Code:
apt-cache policy deja*

... which, where I am currently on Bunsen Labs Helium, a Debian-based Distro, outputs

Code:
chris@helium:~$ apt-cache policy deja*
dejagnu:
  Installed: (none)
  Candidate: 1.6.2-1
  Version table:
     1.6.2-1 500
        500 http://mirror.aarnet.edu.au/debian stable/main amd64 Packages
deja-dup:
  Installed: (none)
  Candidate: 38.3-1
  Version table:
     38.3-1 500
        500 http://mirror.aarnet.edu.au/debian stable/main amd64 Packages

... The second entry is the one I want, so this use of globbing has
  • Found the package, and the syntax of its name - deja-dup
  • Informed me of its installation status - not installed yet but available
  • Given me its assigned Priority - 500 and
  • Told me the location of the Repository source I am currently using - AARNET in Australia
OK I lied - 4 birds with one stone, so sue me.

Happy globbing

Wizard

Hhmm -sun at half an hour past the yardarm - must be beer o'clock. :)
 
If I get a chance to boot a live OS over weekend I can get it; also I will read up a bit more about priorities. probably my thinking was that with Slackware I have to basically manually and mentally make various considerations about software to install . For instance whether the software will integrate seamlessly and function with core Slackware OS software, then take into consideration deps etc. If Ok I download the src of software from github etc; use it with a slackbuild and then actually build the package. With Debian you have packages in the repos, some newer than others. So I think i understand that the priority notation is giving the user of Debian info of say "100" if a package is already installed . What i haven't read up yet is how you manually select (with the syntax) if you have a version installed of 100 but wanted to replace it "manually" with same but newer package with a higher priority ?

With slackware I build an newer version of a package and simply from the command line run:

Code:
# upgrade <samePackageButNewerThanAlreadyINstalledName>
So i need to read how the same is done with Debian. What i've preliminary read is that you influence priorities via editing /etc/apt/preferences. But waht about a direct command to override /etc/apt/preferences ?
Also does the command :

Code:
sudo apt-cache madison

still exist ?
 
Last edited:
Yup. 'madison' still works.
 
The last article was also about apt-cache and that's what prompted me to write this one. Well, that and I'm sometimes going alphabetically with regards to the copious notes I've taken over the years.


If you're unfamiliar with apt-cache, you might find it does some pretty neat things that you were unaware of.

Feel free to comment there or here. Feedback is always appreciated. If you sign up for the newsletter, you'll know when articles are published and you'll still get 'em when I forget to share them here! (I almost forgot today's article.)
KGIII This is a great article. I'm incredibly thankful for the intel. I'm like a sponge absorbing and applying all that I learn.
 
KGIII This is a great article. I'm incredibly thankful for the intel. I'm like a sponge absorbing and applying all that I learn.

I might sound like a broken record but I will continue to post new articles 'soon'.

To do so, I feel I have to elaborate on why I have not done so. That's the part that's causing me consternation.

That said, glad you liked it. There are a ton of other articles there. Quite literally, there are hundreds of them.
 
To do so, I feel I have to elaborate on why I have not done so. That's the part that's causing me consternation.
Anyone who has been around here very long at all has a good idea of the monumental effort you have put into your blog. A well earned vacation was probably long over due. No need to elaborate, IMO.
 


Top