![]() |
Use of the Debian 6 (Squeeze) "apt-get autoremove" command
Platform: Debian 6 (Squeeze) - Dell GX620
Command: apt-get autoremove Man entry: autoremove is used to remove packages that were automatically installed to satisfy dependencies for some package and that are no more needed. I quite often download packages and test them for function. If I like it I keep it if I don't I remove the package. The other evening I decided to issue and "apt-get autoremove". The "man apt-get" command indicated the above which implied to me that no package I might need should be affected. But no that certainly was not the case. I did receive a message containing a long list of packages that would be removed but I did not read it in detail. I assumed that "no more be needed" would be the correct status for the packages. Issuing the above command removed the following packages: software-center, aptdaemon, dnsmasq-base, epiphany-extensions, evolution-exchange, gdebi, gdebi-core, gedit-plugins, gnome-codec-install, gnome-office, gnome-themes-extras, gnome-themes-more, gnote, gtk2-engines-smooth, javascript-common, libboost-filesystem1.42.0, libboost-system1.42.0, libdbus-c++-1-0, libpanelappletmm-2.6-1c2, libgconfmm-2.6-1c2, shotwell, libgee2, libgexiv2-0, libgpod-common, rhythmbox-plugins, libgpod4, libjs-jquery, network-manager-gnome, libnm-glib-vpn1, libpcrecpp0, network-manager, wpasupplicant, libpcsclite1, liferea, liferea-data, rhythmbox-plugin-cdrecorder, rhythmbox, media-player-info, mobile-broadband-provider-info, modemmanager, ppp, python-aptdaemon-gtk, python-aptdaemon, python-gudev, python-mako, python-markupsafe, python-simplejson, update-notifier, update-manager-gnome, python-vte, python-webkit, simple-scan, usb-modeswitch, tcl, tcl8.4, totem-mozilla, transmission-gtk, transmission-common, update-manager-core, update-notifier-common, usb-modeswitch-data, wwwconfig-common A few I recognized but most I did not but of particular interest are "network-manager" and "network-manager-gnome". Removal of these left me without an Ethernet connection. It took a while but on another machine I managed to download the DEB packages for the two packages and the packages they depended on that had also been removed and "dpkg" installed them. Next I determined that the comment out "#Network Manager#" had been removed from the Ethernet line in the "etc/network/interfaces" file causing the Ethernet interface to no longer be under the control of Network-Manager. I corrected that by moving one of the backup interfaces files that contained the correct information to the "interfaces" file. Finally I was back online. It would appear that apt-get does not properly determine the packages that are "no more needed". My main question is "Does anybody see any packages in the above list that I need to reinstall before something else goes wrong?". One interesting thing, after the removal the "dpkg -l" list showed the following packages in "rc" status. If anybody can explain why these packages were still on the "dpkg" list and what the "rc" status means that might be useful. software-center, aptdaemon, gnome-themes-extras, gnome-themes-more, javascript-common, libboost-filesystem1.42.0, libboost-system1.42.0, libpanelappletmm-2.6-1c2, libgconfmm-2.6-1c2, shotwell, libgee2, libgexiv2-0, libgpod4, network-manager-gnome, libnm-glib-vpn1, libpcrecpp0, network-manager, wpasupplicant, libpcsclite1, liferea, rhythmbox, modemmanager, ppp, update-notifier, usb-modeswitch, tcl8.4, transmission-gtk, update-notifier-common, usb-modeswitch-data, libdbus-c++-1-0 I would also be interested to know how I might have come back online without "Network-Manager" inplace with the Ethernet definition line active in the "etc/network/interfaces" file? Thanks in advance for any helpful information. |
Quote:
Quote:
Quote:
Quote:
|
Quote:
Quote:
|
'apt-get autoremove' is a completely optional command, so if you have any questions/doubts about its usage, simply don't. (That's my zen advice.)
|
I notice this too. I also find it odd it removes things that should not be removed. In some cases when you just do apt-get install gnome. There is so much installed that apt-get autoremove might remove things that are used by gnome and package x that needs a gnome lib. I find it odd.
|
Quote:
|
The autoremove function works exactly as intended. The problem lies not in the package manager, but in the package maintainers and the admin (on desktop systems usually the user).
The package maintainer's part of the problem: They introduced meta-packages. A meta-package is a package that itself does not contain any software, but has a lot of dependencies. This is usually used to install larger software-groups, for example on Debian the package gnome is such a package. It pulls in the gnome-desktop-environment package, which itself is a meta-package, and some other software packages, for example the update-notifier package. This is fine, as long as the user knows about meta-packages. Which brings us to the admin's part of the problem: If the admin doesn't know about meta-packages he can seriously screw the system with the autoremove function. Imagine again a system with the gnome meta-package installed, which has as dependency the update-notifier package. Now you are annoyed by the update-notifier and decide to uninstall it. The problem is that you removed a dependency for the gnome package, which will remove the gnome package also, if the admin is not cautious (it will ask if you really want to remove those packages). This will lead the package manager to the conclusion that all the dependencies can also be removed, since the package that has pulled them in is no longer installed, and they will be marked for removal. Once the admin issues an autoremove command and he is still uncautious the whole desktop will be gone. You can see, as long as the admin is aware that such things like meta-packages exist and is somewhat cautious (which you always should be when launching a command as root) there is no problem with the autoremove command. So, whenever you are unsure if a package that is in the list for removal should really be removed, cancel the action and inform yourself what is going on. A good help here is the aptitude command, especially its why option. For example I ask aptitude why the package defoma is installed on this machine: Code:
tobi ~ ☺ $ aptitude why defomaNow just for fun I remove the package libcairo2 from the system, which is also a dependency for libpango1.0-0. So what happens now? The package manager knows that libpango1.0-0 is dependent on libcairo2, so the removal of libcairo2 causes also the removal of libpango1.0-0. But libpango1.0-0 is a dependency for python-gtk2, so the removal of libpango1.0-0 causes the removal of python-gtk2. If there were a package on the system that is dependend on python-gtk2 it would also be removed, and so on, recursively working upwards the dependency tree until no dependent package is found anymore. But the package manager is not only working upwards the tree, it is doing it also downward. For any package that will be removed by the former action, the package manager looks at the dependencies, and if they are marked as automatically installed and have no other package that is dependent on them the package will be marked for the autoremove function, this will be done recursively downwards the dependency tree for any package that can be marked as removable. If you now ask aptitude about the defoma package it looks like this: Code:
tobi ~ ☺ $ aptitude why defomaI am curious how the vim-gtk package went into the list, if someone knows please add that information, it was never installed on that system. In apt-get this looks like this: Code:
root ~ ☺ # apt-get remove libcairo2 Under the "The following packages were automatically installed and are no longer required:" line you can see the packages that were marked for removal when the package manager worked its way downwards the tree. At this screen you should always take your time to actually read which packages will be removed, otherwise the action can end in a disaster. There is a good reason for the "Do you want to continue?" question. Short lesson in apt's inner workings from a former Debian user which is thankful that there is no dependency resolution in the distro he now works with. |
Quote:
|
Quote:
Gnome is a modern, full-featured desktop environment with many "bells & whistles" that the developers do not consider "useless." If you are looking for something simpler then maybe try a lightweight windows manager (openbox, fluxbox, etc.) instead of a full-featured desktop environment that will take up more space on your hard drive (actually only a couple of GB's--if you can't spare that then maybe consider upgrading your hardware, hard drives are cheap). |
Quote:
|
Consider the case if the system is not set up this way.
If you take the "metapackages and dependency resolution are stupid" approach then you need to manually install each and every dependency and required lib. Also when removing software, the reverse process is equally tiresome, and you can easily remove dependencies of the package you are ditching, only to discover that the other software you still use also depended on that, and now no longer works. There are people who like it this way, and there are distro's that cater for that. Debian's approach makes it very easy to add and remove software, without having to get into the minutiae of manual dependency resolution, while also generally ensuring the system is in a sane state. When removing metapakages, apt-get marks the dependencies for deletion, but does nothing about it until the admin decides to (by using 'autoremove' and then answering "Yes" to the are you sure? question). aptitude, on the other hand, will immediately remove those 'no longer required' packages (again, though, asking "here is the list, are you sure?") when the packages requiring them are removed. It is also worth noting that even though YOU may consider a package as 'required', by removing the parent of an auto-installed package, you have just told dpkg that it is not. This is easily fixed by marking that package as manually installed. Very simple with the aptitude ncurses interface - at the "this is what I'm about to do" screen, arrow down to the wanted package and press 'm'. |
Quote:
|
| All times are GMT -5. The time now is 03:03 AM. |