The first thing I realized after running apt autoremove
and rebooting was that DockX no longer starts. A glance at /var/log/apt/term.log
told me that the packages were indeed eradicated despite being in use right at the moment it happened:
Removing dockbarx (0.93+git20190103-1~ppa3) ...
Removing dockbarx-applet-appindicator (0.93+git20190103-1~ppa3) ...
Removing dockbarx-applet-clock (0.93+git20190103-1~ppa3) ...
Removing dockbarx-applet-hello-world (0.93+git20190103-1~ppa3) ...
Removing dockbarx-applet-volume-control (0.93+git20190103-1~ppa3) ...
Removing dockbarx-dockx (0.93+git20190103-1~ppa3) ...
My question is: Why did apt
decide to remove these packages and how can I prevent this behaviour in the future?
Update
It was suggested that the packages were removed because they were dependencies of some other, already removed packages. This is not the case. I rolled back the VM anyway and now I can look at the state before the event, using dockbarx
as an example:
~$ apt-rdepends -r dockbarx
Reading package lists... Done
Building dependency tree
Reading state information... Done
dockbarx
~$
This is it. There are no packages dependent on dockbarx
.
I suspect the situation is somehow related to the fact that I installed these packages from a PPA that is no longer connected. Could there be a link?
Update 2
Checked the logs manually to find out that the dockbarx
package was installed as a dependency of xfce4-dockbarx-plugin
, a package my system is no longer aware of - most likely because of the disconnected PPA:
~$ apt show xfce4-dockbarx-plugin
N: Unable to locate package xfce4-dockbarx-plugin
N: Unable to locate package xfce4-dockbarx-plugin
E: No packages found
Which is why apt-rdepends
gives wrong output for dockbarx
. Overall, the answer below is correct and I am accepting it.
This was quite a detective story.
It's all about apt-marking
Any package that is not a automatically-installed dependency (apt-marked 'auto') dependency of a specified package (apt-marked 'manual') is eligible for autoremoval.
Example:
sudo apt install foo bar
Apparently, you removed whatever 'manual' package required those 'auto' dependencies.
In order to prevent autoremoval of a package, simply ensure that the package has an apt-marking of 'manual.'