4

How do I remove exactly same stuff I have installed or system have installed with adding support for a language for example? Is there a procedure I can follow? Apt-get remove, autoremove or purge is not what I am looking for, it leaves stuff behind.

I am currently looking into debfoster, but I hope that I am overseeing something easier and more native.

In this moment I have to restore my system from a snapshot to get it into previous setup, I am working on international application, when I install and uninstall for example Chinese, I will end up with several unwanted fonts that were not there before and it makes my testing pointless.

Update:

To update and clarify my question, I already know that package installations are logged a month ago I asked How to properly remove Chinese support and I found a solution, packages installed including fonts I want to delete are only in /var/log/dpkg.log. I am looking for automation or some tool, that will automate this so I do not have to process logs every time I install and uninstall new language or an application. Apparently Ubuntu has a tiny flaw and it does not uninstall fonts on language removal, I do install a new language and then delete it several times a day for testing, I have a script I made today where I put everything from logs that does not uninstall and I still hope I am reinventing a wheel and there is already some procedure in place that keeps track of what files and other stuff package is touching and making sure it will be deleted on removal.

Mike
  • 5,931

3 Answers3

3

If you installed "stuff" via a package manager (apt-get, dpkg, synaptic), it's all logged in /var/log/apt/*. It's a simple matter of editing to generate the apt-get purge commands.

If you installed "stuff" some other way (sudo make install, /usr/bin/cpan, ...) you have to uninstall it using the same method.

To make your life easier in the future, especially if you use the second method, consider installing and using installwatch. From the man page:

trusty (1) installwatch.1.gz
Provided by: checkinstall_1.6.2-4ubuntu1_i386

NAME

       installwatch — Track installation of software

SYNOPSIS

       installwatch [options]  [command]

DESCRIPTION

       installwatch  is  a  program that is used in order to track the changes
       made  while  installing  local  software  (i.e.   "make  install").  It
       monitors  the requested command, and produces a log which indicates all
       created and modified files.
waltinator
  • 37,856
2

Application debfoster I mention in the question does the trick after all, it just took me a while to figure out how it is used.

sudo apt-get install debfoster

Generate keepers file, stored in /var/lib/debfoster/keepers:

sudo debfoster -q

This keepers file contains all the currently installed packages, the next time something is installed, just run:

sudo debfoster

It will start listing all the packages installed from the time last keepers file was generated. Questions will be asked giving 9 options, first 4 are important:

Yes        Keep the package. [default]
No         Delete the package.
Prune      Delete the package and the packages it is keeping installed.
Skip       Skip this question.

More information man debfoster or debfoster --help.

This actually lists even fonts that are omitted with apt-get autoremove or when uninstalling language packages with Language Settings GUI.

Mike
  • 5,931
0

I think that what you call "related" packages are the ones mentioned by apt or apt-get as "additional" packages (upon installation) and as "automatically installed" packages (upon removal).

As far as I can understand from this answer, sudo apt autoremove shouldn't leave anything behind if run after your specific program/package has been uninstalled.

To see before uninstalling the program what its installation (with apt or apt-get) has brought along - following the linked answer:

First, run sudo apt autoremove so that apt starts from a "clean" state.

Then, simulate removal of your program/package and take note of the automatically installed packages:

sudo apt-get remove --dry-run YOUR_PROGRAM

which will give something like

The following packages were automatically installed and are no longer required:
  THE_LIST_OF_PACKAGES
Use 'sudo apt autoremove' to remove them.

After uninstalling YOUR_PROGRAM, if you prefer, do

sudo apt remove <THE_LIST_OF_PACKAGES>

instead of sudo apt autoremove.


As for debfoster, if you had it installed and had created the keepers file before installing your program, the simple way to see what additional packages a program brought is with the command

sudo debfoster -r YOUR_PROGRAM