Why are packages listed as "installed", "installed,automatic", or "installed,local"?

I have read What classifies an application as 'installed' in Ubuntu? but it does not address the following issue:

When I runapt list --installed on Kubuntu 16.04, I see that all my listed packages have [installed] or [installed,automatic]. Yet, I've see reports where users have a few or even the majority of their packages being described as [installed,local]. And in this, last, case, their packages seem to be outdated.

Is [installed,local] the equivalent of what the Synaptic Package Manager would describe as "local or obsolete" as discussed in What does “local or obsolete” mean in Synaptic?


Solution 1:

Checking my system using:

apt list --installed | awk -F/ '/local]/{print $1}' | xargs apt-cache policy

Every package marked local has an installed version which is not available in the repositories. For example, I installed folly using checkinstall. In apt list --installed:

folly/now 57.0-1 amd64 [installed,local]

And for apt-cache policy:

folly:
  Installed: 57.0-1
  Candidate: 57.0-1
  Version table:
 *** 57.0-1 100
        100 /var/lib/dpkg/status

You can verify this from the source. apt list calls apt-private/private-list.cc's DoList() function, which in turn ends up calling apt-private/private-output.cc's ListSingleVersion(), where you can see:

 if (state.Upgradable() && state.CandidateVer != NULL)
    strprintf(StatusStr, _("[installed,upgradable to: %s]"),
      CandidateVerStr.c_str());
 else if (V.Downloadable() == false)
    StatusStr = _("[installed,local]");
 else if(V.Automatic() == true && state.Garbage == true)
    StatusStr = _("[installed,auto-removable]");
 else if ((state.Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto)
    StatusStr = _("[installed,automatic]");
 else
    StatusStr = _("[installed]");