Is it safe to use the command apt-get autoremove in this particular scenario?

The last time I used sudo apt-get autoremove, nearly every important display driver or parts got deleted. This made me very squeamish about using the command again. However, each time I install something or use apt-get update the terminal reads:

The following packages were automatically installed and are no longer required:
  devilspie libturbojpeg:i386 libxrandr-ltsr2 language-pack-kde-en
  kde-l10n-engb language-pack-kde-en-base libxv1:i386 libllvm3.2
  libllvm3.2:i386 linux-generic-lts-raring
Use 'apt-get autoremove' to remove them.  

I tried the command clean and the messages stops displaying for a while. My question is whether it's safe running the autoremove command, or will I lose everything once again? Is there a way of checking how safe it is to use autoremove in this particular (or any) case?


To focus on your past experience, if autoremove is going to remove "more than you intended", it's only doing that because those packages are no longer depended upon. That happens when you accidentally remove something :)

A common example from the good old days would be removing something Compiz-related. apt-get would show you a list of Compiz packages it was going to remove and you'd miss that ubuntu-desktop was also in there. ubuntu-desktop is just a meta-package that depends on all the packages that make up the desktop so removing it doesn't directly remove anything...

... But when you do an subsequent autoremove, all those things that ubuntu-desktop was the sole dependency... They're going bye-bye.

A few lessons:

  • sudo apt-get remove <package> will warn you what it's going to remove directly. It won't notify you about knock-on effects.
  • sudo apt-get autoremove should also warn you what it's going to do.
  • Use apt-get -s autoremove to do a simulated dry run if you're unsure. You can use that on all apt-get commands.
  • If you reboot and you're staring at TTY1 wondering what the monkeys you've nuked this time, /var/log/apt/history.log should have you most recent activity.
  • If in doubt, check ubuntu-desktop is installed.

Is autoremove safe? It's heavy machinery so it's only as safe as the driver... But that said, it's hard to do permanent damage.


The following packages were automatically installed and are no longer required

If they are no longer required apt will know when it builds the dependencies. apt-get just inform you "Hey, you removed something that installed these packages. I prefer that you decide what to do with them since you are the boss".

Now, it is safe? Yes. What happen if you need em again? apt will download them. Should I check the list? Yes. A light check might be needed.


Unsafe example:

apt-get remove --purge icedove*

Never, almost never use an asterisk except for libreoffice

With great power comes great responsibility. Generally you should use the synaptic package manager which offers much better presentation (warnings**) then the terminal.

For example on debian Jessie (8.2) I noticed imagemagick was not functioning and that there were 2 shortcuts to it in the menu of a default install. I started with:

apt-get remove --purge imagemagick

That got rid of one shortcut, then I launched synaptic and two packages were left one of those being imagemagick-common. Upon selecting that package for complete removal it showed inkscape as the 1st thing that had to be removed as a consequence among many others.

Now do the same thing in the terminal, and it won't jump at you nearly as much. It might not phase you at all unless you're a linux veteran.