LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   Use of the Debian 6 (Squeeze) "apt-get autoremove" command (http://www.linuxquestions.org/questions/debian-26/use-of-the-debian-6-squeeze-apt-get-autoremove-command-4175440293/)

cbjones50 12-06-2012 10:47 AM

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.

k3lt01 12-06-2012 12:39 PM

Quote:

Originally Posted by cbjones50 (Post 4843875)
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.

Read this thread, which I think you will have found if you did a search on apt-get autoremove

Quote:

Originally Posted by cbjones50 (Post 4843875)
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.

You should have been given a warning before you were given an option to continue, did you get this warning? If yes did you read it? If yes why did you continue?

Quote:

Originally Posted by cbjones50 (Post 4843875)
It would appear that apt-get does not properly determine the packages that are "no more needed".

Actually apt does exactly what it is meant to do, instead this was caused due to a lack of user diligence, sorry to be so blunt. I would recommend that you install and set up deborphan so you don't break your system again in this manner.

Quote:

Originally Posted by cbjones50 (Post 4843875)
My main question is "Does anybody see any packages in the above list that I need to reinstall before something else goes wrong?".

No not really, maybe go through your system and make sure the recommends are installed, doing that may pick up a few that you removed not relaising you still needed them.

odiseo77 12-06-2012 02:44 PM

Quote:

Originally Posted by cbjones50 (Post 4843875)
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

The output of dpkg showing a "rc" status, means that the packages have been removed from the system ("r"), but some configuration files remain in it ("c") (most likely inside /etc). If you don't need these packages you can purge them to completely remove their configuration files. You can use either dpkg, apt-get, aptitude or synaptic (I usually do it through synaptic when I have too many packages to purge, since I can select them all with a single click).

Quote:

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?
It depends on which type of connection you use (DHCP, static, etc). You can take a look at /usr/share/doc/ifupdown/examples/network-interfaces.gz for examples on how to connect using the /etc/network/interfaces file (that's where the examples are in my Sid system; not sure about Squeeze).

snowpine 12-06-2012 02:46 PM

'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.)

remusrm 12-06-2012 06:51 PM

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.

k3lt01 12-06-2012 08:27 PM

Quote:

Originally Posted by remusrm (Post 4844156)
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.

Nope, if you install a metapackage then, as long as you leave everything the metapackage installed alone, autoremove should not advise anything needs removing.

TobiSGD 12-06-2012 09:11 PM

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 defoma
i  python-gtk2        Depends libpango1.0-0 (>= 1.22.0)               
i A libpango1.0-0      Depends libpango1.0-common (>= 1.28.3-1+squeeze2)
i A libpango1.0-common Depends defoma (>= 0.11.1)

Here you can see that the package defoma is installed as a dependency for the package libpango1.0-common, which in turn is an automatically installed dependency (i=installed, A=marked as automatically installed) for libpango1.0-0, which is in turn an automatically installed dependency for the manually installed python-gtk2 (only i, but not A, so manually installed).

Now 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 defoma
p  vim-gtk            Provides vim                                     
p  vim-gtk            Depends  libpango1.0-0 (>= 1.14.0)               
p  libpango1.0-0      Depends  libpango1.0-common (>= 1.28.3-1+squeeze2)
idA libpango1.0-common Depends  defoma (>= 0.11.1)

Here you can see that defoma is installed as dependency for libpango1.0-common, which is marked as automatically installed (i and A), but also marked for deletion (lower-case d), because the package that has pulled it in, libpango1.0-0, is no longer installed (purged, lower-case p).
I 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 
Reading package lists... Done
Building dependency tree     
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libgtk2.0-common libatk1.0-0 libfont-freetype-perl shared-mime-info libxcb-render-util0 libpixman-1-0 libgfortran3 libpango1.0-common libxcb-render0 hicolor-icon-theme libdatrie1 fontconfig
  libxfont1 libffi5 python-numpy libxcomposite1 libthai0 libglib2.0-data libatk1.0-data libblas3gf libjasper1 xfonts-utils liblapack3gf libthai-data libglib2.0-0 libxcursor1 xfonts-encodings
  defoma libxrandr2 x-ttcidfont-conf python-gobject
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  libcairo2 libgtk2.0-0 libgtk2.0-bin libpango1.0-0 python-cairo python-gtk2
0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
After this operation, 13.6 MB disk space will be freed.
Do you want to continue [Y/n]?

Under the "The following packages will be REMOVED:" line you can see the packages that will be removed because one of their dependencies has been removed. That is the part when the package manager works its way upwards the dependency tree.
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.

remusrm 12-07-2012 12:07 AM

Quote:

Originally Posted by k3lt01 (Post 4844184)
Nope, if you install a metapackage then, as long as you leave everything the metapackage installed alone, autoremove should not advise anything needs removing.

Should not might be true, but it did. In a non technical term, it happend in the same way if you do a apt-get remove orca or rhythmbox and removes stuff from gnome, or just gnome. I always found it weird if you install gnome it installs so many other useless programs that only take space and if you want to remove them individually removes almost everything and makes some things unfunctional

snowpine 12-07-2012 02:51 AM

Quote:

Originally Posted by remusrm (Post 4844276)
Should not might be true, but it did. In a non technical term, it happend in the same way if you do a apt-get remove orca or rhythmbox and removes stuff from gnome, or just gnome. I always found it weird if you install gnome it installs so many other useless programs that only take space and if you want to remove them individually removes almost everything and makes some things unfunctional

I am running Debian Wheezy, standard install, Gnome desktop. I don't have orca or rhythmbox installed, and yet my system is not "unfunctional." Respectfully, I think you should re-read some of the excellent advice that's been posted in this thread so far. :)

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).

k3lt01 12-07-2012 02:57 AM

Quote:

Originally Posted by remusrm (Post 4844276)
Should not might be true, but it did. In a non technical term, it happend in the same way if you do a apt-get remove orca or rhythmbox and removes stuff from gnome, or just gnome. I always found it weird if you install gnome it installs so many other useless programs that only take space and if you want to remove them individually removes almost everything and makes some things unfunctional

You actually have it back to front. If you install "gnome" youa re installing a metapackage which depends on many packages within the Gnome Desktop Environment. If you remove 1 of those packages that "gnome" installed you also remove the metapackage. That is where your problem begins. Take a look at this page, it shows you what packages "gnome depends on, some of these packages are also metapackages. If you remove something from one of teh other metapackages, it will also tell autoremove that "gnome" is not needed because the other metapackage is a dependency of "gnome". Now if instead you used deborphan you would only be told what packages are not used by anything, not what packages are no longer needed by a metapackage because you removed the package that caused them to be installed. When you understand the difference between a metapackage and a regular package you will understand what is going on.

descendant_command 12-07-2012 03:34 AM

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'.

TobiSGD 12-07-2012 05:11 AM

Quote:

Originally Posted by remusrm (Post 4844276)
I always found it weird if you install gnome it installs so many other useless programs that only take space

Just install the gnome-core meta-package instead of gnome or gnome-desktop-environment. That will give you a slimmer Gnome install, but keep in mind that the meta-package problem still persists. But you should now know how to handle it: Just use aptitude why before removing a program and simply don't remove it if it is a dependency for a different program or meta-package.


All times are GMT -5. The time now is 11:04 PM.