3

I just upgraded several PC to Ubuntu Trusty 14.04. For this, I used to install everything from scratch to get a clean system, keeping only /home (and /etc for reference).

This time however I upgraded using the upgrade tool, and I want to know what differences my PCs have compared to a nominal system. Because I installed many different packages from different sources, and might have edited some files here and there. Of course I know that apt should handle everything auto-magically, but I'm the paranoid type, and I really want to make sure.

Basically, here what I'd like to have:

  1. Get a list of all packages installed and for each of them, the repository it is coming from (if available). This would be basically an apt-cache policy for each package, but summarized in a neat list.

  2. For packages coming from "unofficial sources", an indication whether there is a version available from the official sources (I mean the repo listed in /etc/apt/sources.list).

    Sometime I installed patched packages from some 3rd-party, and this package is not updated because of conflicting version number. I want to have a list telling me whether it makes sense to fall-back to official version.

  3. The list of all files on the file system coming from an installed package (incl. configuration files), but that have been modified afterwards.

  4. The list of all files on the file system (excluding /home, and possibly /etc) that are not coming from an installed package.

Basically I want to know the differences that my system have if I did the upgrade versus a clean install, and decide on a case by case basis whether these differences might cause some instability.

fuujuhi
  • 182
  • You stuffed 4 questions (each of them are themselves big question) in 1. Split it into 4. But personally I liked your question and want to know answers of them too. I might come with a solutions also – Anwar Nov 02 '16 at 13:43

1 Answers1

1

My question is already partially answered at How do I get a list of obsolete packages?.

The answers suggest to use

apt-show-versions | grep 'No available version'   # Show all package not coming from repo
aptitude search '~o'                              # Similar

I guess we can do as well:

apt-show-versions | grep -v uptodate              # All packages that are not up-to-date

This would give packages that are not up-to-date, i.e. packages that are upgradeable from enabled repositories, or packages not coming from such repositories.

To get a list of all available versions for such packages, we could do:

apt-show-versions -a $(apt-show-versions | grep -v uptodate | sed -r 's/:.*//')

I also found a question referencing deborphan -a (How to list installed packages in apt that are not backed by a repository?)

deborphan -a             # List all packages that have no reverse dependencies

So to summarize, I have some answers for item 1 and 2, but still looking for 3 and 4:

  1. apt-show-versions is a good answer
  2. Idem, one of the command combo above. The key step here of course is first make sure that only official repositories are enabled in /etc/apt.
  3. ?
  4. ?
fuujuhi
  • 182
  • For 3, dpkg -L packagename gives a list of files installed by the package, but not their modification status (or if it still exists on the system). – saiarcot895 May 07 '14 at 22:36
  • Yes, interesting. I could write a script that does that for all packages, collate in some list, and then compare to the list of all files on my system. But surely there must be some tool for that? Actually my question is really how debian/ubuntu admin masters do manage their boxes. I use Ubuntu for years now, but I'm not sure I'm doing it right. – fuujuhi May 08 '14 at 14:46
  • If you're not sure, update it in the question part. Not in answer section – Anwar Nov 02 '16 at 13:43