Linux Hmm, apt-get is a lot more clever than I thought....

Him Her

VIP Member
VIP Member
Joined
Dec 23, 2011
Messages
8,137
Reaction score
6,405
Location
North Yorkshire
...for Debian distributions who really gets how it works? I've been doing some digging, would this be of interest? How to get the best out of apt? Given it applies to Debian, Ubuntu and the Rasp?
 
Ok so you are being cryptic... again.

give us all a clue I know what apt is etc but was there meant to be a web link?
 
Ok so you are being cryptic... again.

give us all a clue I know what apt is etc but was there meant to be a web link?

It wasn't meant to be? Anyway, had to nail down a few issues involving APT and repositories and wondered if it was worth relating? If everyone knows all about APT then probably not - but if they don't it may be useful...
 
I know if you type aptitude you get a gui but that is as far as I got as using a windows computer and a putty with a touch pad I found it hard to use
 
It might just be easier to post your findings rather then try solicit an audience ;)
 
Beat me to it.

Worse than my mrs for attention.

To me its more a case of information lost when people dont just post their knowledge of a subject,or some interesting findings,that annoys me,

HH posts in a certain style,which at times pisses me off too,but then again he also posts lots of very useful info,and most times he is good for a laugh,

Plus i think he likes the attention just a little bit ;)
 
To me its more a case of information lost when people dont just post their knowledge of a subject,or some interesting findings,that annoys me,

HH posts in a certain style,which at times pisses me off too,but then again he also posts lots of very useful info,and most times he is good for a laugh,

Plus i think he likes the attention just a little bit ;)

Yeah, yeah, okay. Lots of work to document, yawns (the attention seeker shoite)....I'll put it together over the weekend and see if anyone finds it interesting :)
 
Yeah, yeah, okay. Lots of work to document, yawns (the attention seeker shoite)....I'll put it together over the weekend and see if anyone finds it interesting :)

Hmm I was being nice
 
Hmm I was being nice

Fook off, I know you were lol I just sometimes wonder if the techy stuff is interesting enough. Anyway, I'm gonna post it and bollocks :) Especially the 'how to fix it when it breaks' - cos I love that bit the best ;)
 
I have said this before HH, unless you are going to post something meaningful and for the wider audience please post.

Otherwise don't bother, this is another example of you playing to the crowd and shouting out "hey look at me I am fcuking ace!!" and I want you all to know it.

On another note, I think you should rename yourself Katie Price!
(TT)
 
Last edited:
I have said this before HH, unless you are going to post something meaningful and for the wider audience please post.

Otherwise don't bother, this is another example of you playing to the crowd and shouting out "hey look at me I am fcuking ace!!" and I want you all to know it.

On another note, I think you should rename yourself Katie Price!
(TT)

FFS MH ive just spat tea over my lappy lol
 
I have said this before HH, unless you are going to post something meaningful and for the wider audience please post.

Otherwise don't bother, this is another example of you playing to the crowd and shouting out "hey look at me I am fcuking ace!!" and I want you all to know it.

On another note, I think you should rename yourself Katie Price!
(TT)

Ye of little patience, how you fail to understand...

Moving swiftly back on track, apt-get is a command-line option that those with a Debian-based Linux distribution are usually familiar with. It's how we install stuff as in:

apt-get install samba

It also accepts a list, like:

apt-get install samba apache2

So, you can apt-get a list to install (and remove) like:

apt-get remove samba apache2

But, remember that remove doesn't remove the configuration files so, if you want to do a 'clean install' then do:

apt-get purge samba apache2

To make sure the configuration files get removed too.

With me so far MH?

Now, if Samba was working before and you may want to reinstall it at a later date then 'apt-get remove' may be a good option but if it went badly then 'apt-get purge' may be better because you can start from scratch with basic configuration files.

Interestingly, 'apt-get' will check versions and dependencies as it goes so, for example, you have already installed samba and invoke 'apt-get install samba' and the version you have is current. You get the message 'Samba is already the latest version' (or similar, based on your Debian distribution). If your Samba is NOT current it will be upgraded. However, apt allows 'version-pinning' i.e. you know that the version of an application does what you want and later versions may not be compatible so you prevent an upgrade.

Oh, common upgrade path...

apt-get update
apt-get upgrade

Not ALWAYS the best idea as will be revealed. What the two commands do is...

1 - find the latest software versions
2 - upgrade the installed packages to the latest versions

Still awake MH?

Now, bear in mind that the latest versions are based on the packages held in the repositories and they may not be the best options but apt-get ONLY searches the repositories defined by the distribution you have installed.

You need to check whether the repositories your version searches are appropriate...

...episode two follows tomorrow.
 
Now, bear in mind that the latest versions are based on the packages held in the repositories and they may not be the best options but apt-get ONLY searches the repositories defined by the distribution you have installed.

You need to check whether the repositories your version searches are appropriate...

...episode two follows tomorrow.

But what decides the appropriateness of the repositories?
 
But what decides the appropriateness of the repositories?

More 'whom' - repositories are maintained while a version is current or 'in support' after which it is assumed you would upgrade. After a period the repositories become obsolete and are removed. When you start getting '404' errors when trying an 'apt-get update' you should consider an upgrade.

When you install a version of Ubuntu (or similar distribution) look for LTS (Long Term Support) as these versions have a longer life-span than other versions.

However, you can change the repositories searched and can add/delete as appropriate. Sometimes you would do this to hang onto your installed version and use archived files rather than upgrade. Sometimes you would add applications that are not part of the approved distribution.

To do this in a controlled manner it's best to edit the /etc/apt/sources.list file or use the option to add a repository.
 
Last edited:
More 'whom' - repositories are maintained while a version is current or 'in support' after which it is assumed you would upgrade. After a period the repositories become obsolete and are removed. When you start getting '404' errors when trying an 'apt-get update' you should consider an upgrade.

When you install a version of Ubuntu (or similar distribution) look for LTS (Long Term Support) as these versions have a longer life-span than other versions.

However, you can change the repositories searched and can add/delete as appropriate. Sometimes you would do this to hang onto your installed version and use archived files rather than upgrade. Sometimes you would add applications that are not part of the approved distribution.

To do this in a controlled manner it's best to edit the /etc/apt/sources.list file or use the option to add a repository.

Long past that,I thought you were going to put forward some more technical reason as to why certain repositories are better then others ;)

So far no new insights m8,
C'mon spill :)
 
@HH are you looking for an infraction/ban? As you are going the right way about it.

Please take notice of the previous discussions we have had. Cut the crap and stop massaging your ego.


(TT)
 
Long past that,I thought you were going to put forward some more technical reason as to why certain repositories are better then others ;)

So far no new insights m8,
C'mon spill :)

While there is a technical element, it's more an issue of release management. The content of a given repository is selected based on not just how it works but how the components work together taking into account the supported hardware. Different distribution teams have their own release criteria so, using Ubuntu as an example, one of the criteria is regular, reliable updates to make end-user management easier. This is similar to a well-run IT team testing software in their own environment before releasing it to end-users. The release numbering scheme also helps i.e. x.04 LTS is the long-term support release while x.10 is an interim solution.

Since modern software development makes extensive use of libraries it is inevitable that the latest versions of anything may only be available in later releases - the libraries may not be compatible. In apt-get this is referred to as a dependency.

[Note: if you haven't run 'sudo -s' at the outset then add 'sudo' at the beginning of the following commands]

To see how this works run dpkg:

Code:
You don't have permission to view the code content. Log in or register now.

to discover what's installed. The list will most likely be very long so 'grep' the output:

Code:
You don't have permission to view the code content. Log in or register now.

This is the output I got:

vim-common install
vim-tiny install

Using the pipe operator (vertical bar) sends the output of the dpkg command to grep which searches for occurrences of the string following it i.e. 'vim'. If you're looking for a string with spaces, enclose the string in quotes. Now find out which version of vim-tiny is installed:

Code:
You don't have permission to view the code content. Log in or register now.

This yields

Version: 2:7.3.035+hg~8fdc12103333-1ubuntu7

Install apt-rdepends using:

Code:
You don't have permission to view the code content. Log in or register now.

Now run apt-rdepends against vim-tiny like so:

Code:
You don't have permission to view the code content. Log in or register now.

Again, some long output so I'll show just a portion:

vim-tiny
Depends: libc6 (>= 2.11)
Depends: libncurses5 (>= 5.5-5~)
Depends: libselinux1 (>= 1.32)
Depends: vim-common (= 2:7.3.035+hg~8fdc12103333-1ubuntu7)
libc6
Depends: libc-bin (= 2.13-0ubuntu13)
Depends: libgcc1
Depends: tzdata

The command apt-rdepends works recursively so it not only shows direct dependencies but also the dependencies of the dependencies! If you check the output notice that you get not only the name of the dependency but the version too with backwards/forwards compatibility. So, vim-tiny (Version: 2:7.3.035+hg~8fdc12103333-1ubuntu7) is dependent on vim-common (Version: 2:7.3.035+hg~8fdc12103333-1ubuntu7) The '=' signifies no backwards/forwards compatibility, the versions must match. The dependency on libc6 is a little more flexible being from version 2.11 upwards.

Bearing in mind that there are tens of thousands of applications all potentially interlinked via their dependencies it's important to maintain 'clean' repositories to enable viable support. There's nothing to stop you adding repositories but you should be aware that dependencies may change, different library versions may be required etc. It's possible to run multiple versions of libraries but it can get messy quite quickly and you're more likely to break something.
 
Last edited:
Ok so taking it as given that I knew most of that,as would most people that have messed around with command line linux,

wheres the "lot more clever than I thought..." part :)
 
Ok so taking it as given that I knew most of that,as would most people that have messed around with command line linux,

wheres the "lot more clever than I thought..." part :)

One area worth a look is where (and how) apt-get picks up packages which is controlled mainly by the Sources List file (/etc/apt/sources.list). One of mine looks like this:

Code:
You don't have permission to view the code content. Log in or register now.

The '#' just makes the line a comment so it gets ignored. The line

Code:
You don't have permission to view the code content. Log in or register now.

is commented out because it refers to an obsolete repository that no longer exists so generates a warning when running 'apt-get update'. Understanding the line syntax can change what gets considered for installation, taking an example such as:

Code:
You don't have permission to view the code content. Log in or register now.

This breaks down into:

Package type: deb=binary package, program(s)
URL: the root of the repository=http://archive.ubuntu.com/ubuntu/
Distribution: natty
List of folders: main restricted universe multiverse

The folders refer to main=core programs; restricted=supported but not entirely free (often drivers provided by hardware vendors); universe=community maintained but not officially supported and multiverse=non-free.

If you browse to the URI the directory structure is apparent

Ubuntu-1.png

Drilling down into 'dists' (which apt-get does by default) shows all the available distributions:

Ubuntu-2.png

[...only top lines shown]

Finally drill down into 'natty'

Ubuntu-3.png

Where the folders main, restricted, universe and multiverse can be found. To can drill down further to see the packages.

If you're not interested in, say, non-free packages then remove the reference to multiverse from the relevant sources.list entry:

Code:
You don't have permission to view the code content. Log in or register now.

One of the cleverer bits is that apt-get can read almost any file system, local or remote, provided this structure is followed so valid URIs could be:

CDROM: locally mounted CD
FTP: FTP server
HTTP: Web server
SMB: Mounted SMB share (Windows, Samba etc.)
NFS: Mounted NFS share

If you want to try later packages simply add the relevant repository to sources.list i.e.

Code:
You don't have permission to view the code content. Log in or register now.

which adds the 'precise' distribution but only the core or main packages. You may have to do some dependency resolution manually although apt-get will attempt to resolve across all repositories. If a resolution is not possible a meaningful error message is produced allowing to dig out the packages manually.
 
Last edited:
Back
Top