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.

3
  • What stuff does autoremove leave behind?
    – muru
    Feb 2, 2016 at 10:29
  • @muru have look at askubuntu.com/questions/709434/… - that is how I solve stuff in the moment, it takes a lot of time and I want to test now not only Chinese but other languages, it is time consuming process, because once a font stays, it makes illusion that text displays that should not. Also using autoremove option actually sometimes uninstalls stuff that I use.
    – Mike
    Feb 2, 2016 at 10:39
  • Autoremove does uninstall every package which is not marked as installed manually and which is not referenced by any other installed package as dependency. If you used the Language Settings GUI to install those packages, probably each of them was treated as "installed manually"... But you could check /var/log/apt/history.log to find out which packages were installed when.
    – Byte Commander
    Feb 2, 2016 at 10:53

3 Answers 3

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.
3
  • What I do now is that I search trough dpkg.log, but I found it faster to restore to VM snapshot. I am comparing /var/log/apt/history.log and /var/log/dpkg.log and the main difference is that dpkg.log has information about fonts installed, logs in /apt/ directory do not. Try installing Chinese or Arabic and it will show. I manually take care of the fonts after uninstalling languages, I will probably have to copy these log lines after every installation and make it to my own uninstall script for every language, I do not see another solution that will be fast and precise.
    – Mike
    Feb 2, 2016 at 12:30
  • @Mike: Use the power of Linux - text manipulation is one of the many things Linux is good at. Read the man pages for (or a good book about) sed, awk, grep, perl, emacs, ed several times. Learn the tools. Use the tools.
    – waltinator
    Feb 2, 2016 at 15:17
  • Thank you for your fatherly advice, I am not against improving my text manipulation skills, but I am sure there must be a system where if something is installed, it can be uninstalled exactly as it was before, something like installwatch for packages.
    – Mike
    Feb 2, 2016 at 16:17
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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .