LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   Is this apt-get autoremove operation safe? (http://www.linuxquestions.org/questions/debian-26/is-this-apt-get-autoremove-operation-safe-935534/)

edbarx 03-20-2012 02:26 PM

Is this apt-get autoremove operation safe?
 
I have just upgraded to Wheezy and apt-get autoremove is saying there are the following packages which may be safely removed. I have kde 4.7.4 installed.

Code:

/home/edbarx# apt-get autoremove
Reading package lists... Done
Building dependency tree     
Reading state information... Done
The following packages will be REMOVED:
  acl foomatic-filters-ppds g++-4.4 gksu hal hal-info hplip-data kaboom kdebase-apps kdebase-bin kdebase-workspace
  kdegraphics-libs-data konq-plugins-l10n libart-2.0-2 libavcodec52 libavformat52 libavutil49 libavutil50
  libboost-program-options1.42.0 libcolord1 libdvbpsi6 libebml0 libeggdbus-1-0 libexif12 libfftw3-3 libfreezethaw-perl libfs6
  libgail18 libgirepository1.0-0 libgksu2-0 libgmp3c2 libgnome-keyring-common libgnome-keyring0 libgphoto2-l10n libgphoto2-port0
  libgps19 libgs8 libgsf-1-114 libgsf-1-common libgtop2-7 libgtop2-common libhal-storage1 libhal1 libhunspell-1.2-0 libicu44
  libidl0 libieee1284-3 libjpeg62 libkdcraw-data libkephal4 libkexiv2-8 libkipi7 libksane-data libkwineffects1a libmaa2
  libmagickcore3 libmagickcore3-extra libmagickwand3 libmarblewidget4 libmatroska0 libmediastreamer0 libmldbm-perl libmozjs2d
  libmusicbrainz4c2a libnl1 libnm-glib2 libnm-util1 libnotify1 libofa0 liborbit2 libpango1.0-common libplasmaclock4a
  libpolkit-qt-1-0 libpoppler5 libpostproc51 libprocesscore4a libqt4-webkit libraptor1 librasqal2 libsane-common libsane-extras
  libsane-extras-common libsane-hpaio libsmpeg0 libsolidcontrol4 libsolidcontrolifaces4 libstdc++6-4.4-dev libsvga1 libswscale0
  libtaskmanager4a libtunepimp5 libvpx0 libweather-ion4a libwebkit-1.0-2 libwebkit-1.0-common libx264-118 libxcb-atom1
  libxcb-aux0 libxcb-event1 libxcb-render-util0 libxine1-console libxklavier16 min12xxw openvpn-blacklist pnm2ppa python-imaging
  python-pexpect python-renderpm python-reportlab python-reportlab-accel sudo x11-apps x11-session-utils x11-xfs-utils
  xbase-clients xinit xulrunner-1.9.1
0 upgraded, 0 newly installed, 117 to remove and 0 not upgraded.
After this operation, 197 MB disk space will be freed.
Do you want to continue [Y/n]? n
Abort.


craigevil 03-20-2012 02:30 PM

Ouch! No , not when it wants to remove that many packages and things like hal, and all the python stuff.

Try running apt-get -f install
or Open Synaptic and see what it says in either Obsolete or Autoremovable, something needs to be installed that was some how removed.

I find the safest thing to do is disable autoremove in apt.conf.

Code:

# cat /etc/apt/apt.conf

// auto-remove breaks on meta packages
APT::Get::AutomaticRemove "0";
APT::Get::HideAutoRemove "1";

// Recommends are as of now still abused in many packages
APT::Install-Recommends "0";
APT::Install-Suggests "0";
Debug::pkgAutoRemove "0";

// PDiffs reduce the required download for apt-get update, but increase the
// CPU requirements and quite often fail.
Acquire::PDiffs "0";

// Remove apt unauthenticated warnings
APT::Get::AllowUnauthenticated "0";

Quote:

# apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded.

T3RM1NVT0R 03-20-2012 02:31 PM

@ Reply
 
Hi edbarx,

Yes it is safe to use apt-get autoremove option. It removes the packages that are no longer needed so you can use this option.

@ craigevil

As I can see from the man apt-get page it says:

Code:

      autoremove
          autoremove is used to remove packages that were automatically
          installed to satisfy dependencies for some package and that are no
          more needed.

Could you please explain why this option cannot be used? I mean is there a specific reason?

snowpine 03-20-2012 02:38 PM

As the name suggests, apt-get AUTOremove is an automated operation where the system takes its "best guess" what you are trying to achieve. It should not be used as a substitute for common sense system administration.

Since you are new to Debian Testing you should definitely do some basic reading first. It is actually a fairly common situation in Testing that the user must go on the forum/mailing-lists to understand a particular update situation.

The safest thing to do is not use the (completely optional!!) apt-get autoremove until you understand the situation. Personally at this stage my next step would be to use tasksel to make sure you have installed the correct metapackages (I'm guessing you want Desktop Environment, right?) to avoid the situation of autoremove removing wanted packages.

DISCLAIMER: I am not a Testing user myself, and I know there are some pretty knowledgable Testing users here, so take my advice with a grain of salt. :)

edbarx 03-20-2012 03:34 PM

Wheezy is not misbehaving. I already did some reading to learn about the listed packages for removal. Whenever there is a big list of packages for removal, it is always safer to be on the side of caution. However, even if I remove the packages, I can still take a note of packages' names, save them to a file and use:
Code:

apt-get install $(cat removed-packages-list)
Code:

/home/edbarx# apt-get -f install
Reading package lists... Done
Building dependency tree     
Reading state information... Done
The following packages were automatically installed and are no longer required:
  x11-apps libxcb-aux0 libprocesscore4a libswscale0 libgsf-1-common libxcb-atom1 pnm2ppa libavutil50 libgail18 libavutil49
  libgphoto2-l10n libhal-storage1 libwebkit-1.0-common libpolkit-qt-1-0 libgphoto2-port0 libxklavier16 libsane-hpaio
  libplasmaclock4a xbase-clients libicu44 libx264-118 libkipi7 libkwineffects1a libmagickcore3 libweather-ion4a libsvga1
  python-reportlab g++-4.4 libnm-util1 python-imaging libmagickwand3 libboost-program-options1.42.0 libtunepimp5 libgps19
  libfftw3-3 libnotify1 libkexiv2-8 openvpn-blacklist librasqal2 libdvbpsi6 python-renderpm libcolord1 libavcodec52
  libkdcraw-data x11-session-utils libsolidcontrol4 libsolidcontrolifaces4 libxcb-event1 acl libpango1.0-common
  libgirepository1.0-0 libgmp3c2 libhal1 hal sudo x11-xfs-utils kdebase-bin libvpx0 libnm-glib2 kdegraphics-libs-data
  xulrunner-1.9.1 libmatroska0 libgsf-1-114 libgtop2-common libpoppler5 libieee1284-3 libidl0 libpostproc51 libxine1-console
  libsane-common xinit libfs6 libfreezethaw-perl libgs8 libavformat52 libhunspell-1.2-0 libkephal4 libtaskmanager4a libgtop2-7
  libmozjs2d libjpeg62 libwebkit-1.0-2 gksu libgnome-keyring0 libgnome-keyring-common libsane-extras foomatic-filters-ppds libnl1
  liborbit2 libksane-data libmaa2 libgksu2-0 libeggdbus-1-0 libart-2.0-2 python-pexpect libqt4-webkit libraptor1
  konq-plugins-l10n libmusicbrainz4c2a libmagickcore3-extra libmarblewidget4 hal-info kdebase-apps libsane-extras-common
  libexif12 min12xxw libebml0 libxcb-render-util0 kaboom libmldbm-perl libofa0 kdebase-workspace hplip-data libstdc++6-4.4-dev
  python-reportlab-accel libmediastreamer0 libsmpeg0
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I didn't continue with the removal operation.

T3RM1NVT0R 03-20-2012 03:56 PM

@ Reply
 
As far as I know if you use apt-get install to install the stuff on your system then apt-get autoremove should not hurt. It might create a problem if you do install stuff explicitly (that is without using apt-get install).

In that case apt-get autoremove might make a mistake as it will not be aware about the packages dependency of the package that you have installed explicitly.

snowpine 03-20-2012 04:12 PM

If as you say you went from Squeeze to Wheezy, then a lot of stuff might just have been obsoleted. :)

TobiSGD 03-20-2012 05:01 PM

Quote:

Originally Posted by T3RM1NVT0R (Post 4631842)
Could you please explain why this option cannot be used? I mean is there a specific reason?

Take the time and do a web search for "Debian meta-package problem", I think you will find plenty of explanations.
In short, Debian developers create meta-packages that don't contain any software, but have a lot of dependencies. This is used, for example, to install a complete desktop system with a single apt-get command, for example apt-get install gnome. In this case the package doesn't contain Gnome, but is dependent on all packages the Debian developers think that should be part of a Gnome install.
The problem with this approach: If you (or an update) removes a package that is part of this dependency list the auto-remove function wants to remove all other packages in the dependency list, leaving you with a system without working desktop (and sometimes even with a completely broken system).
apt-get autoremove is a dangerous weapon, use it with care (and edbarx has done that, rather ask than mindlessly confirm to rip out half of the system, relying on an automatic function).

Having said that, I thank Pat Volkerding for this one great system without automatic dependency resolution.

T3RM1NVT0R 03-20-2012 06:54 PM

@ Reply
 
Quote:

Originally Posted by TobiSGD (Post 4631958)
Take the time and do a web search for "Debian meta-package problem", I think you will find plenty of explanations.
In short, Debian developers create meta-packages that don't contain any software, but have a lot of dependencies. This is used, for example, to install a complete desktop system with a single apt-get command, for example apt-get install gnome. In this case the package doesn't contain Gnome, but is dependent on all packages the Debian developers think that should be part of a Gnome install.
The problem with this approach: If you (or an update) removes a package that is part of this dependency list the auto-remove function wants to remove all other packages in the dependency list, leaving you with a system without working desktop (and sometimes even with a completely broken system).
apt-get autoremove is a dangerous weapon, use it with care (and edbarx has done that, rather ask than mindlessly confirm to rip out half of the system, relying on an automatic function).

Having said that, I thank Pat Volkerding for this one great system without automatic dependency resolution.

I did some web search and came across this: http://administratosphere.wordpress....et-autoremove/

I can make out the following points from this link:

1. When you install a package using:
Code:

apt-get install <package name>
system consider it as a package which user wants to install. The packages which will be required as a dependency to this package will be considered as automatic package installation. So basically the initial command that has been given to install a package is explicit or manual install.

2. As you said about meta-package it is a package that contains all the dependency and it is not a software in itself. I found it to be like a shopping list (read somewhere). So basically meta-package is not a dish itself but ingredients that will be used in a dish.

Questions that is still bothering me is the later explanation in that article. Let us assume that I have installed gnome using:

Code:

apt-get install gnome
Now, this will install all the packages that are required by gnome. Now I went ahead and did a search of packages that were installed as part of dependency resolution during gnome installation using:

Code:

apt-get -s autoremove | less
And I planned to remove say gnome office using explicit command:

Code:

apt-get remove gnome-office
When I did the above and then ran:

Code:

apt-get autoremove
It came up stating that there is one package to remove named simple-scan. Now this package is used basically for providing scanning functionality for documents / images. Since gnome office has been removed this application system think is no longer required and which is correct.

Thing that is still confusing me is how system calculates which things to include/exclude in autoremove option.

TobiSGD 03-20-2012 07:11 PM

Did you do that on Ubuntu or on Debian? AFAIK, those both distributions handle the marking of automatically installed packages differently, Ubuntu handles it in a way that is more newbie friendly by marking those dependencies as manually installed to prevent newbies from accidentally delete half the system with apt-get, while Debian assumes that you are knowing what you do when you are playing with the package manager.

widget 03-20-2012 09:13 PM

I am certainly no expert on running Debian testing. I do have, however, this install of it which I have used for about 2 years as my production OS.

I wouldn't use the autoremove command if I were you.

Just pulled it up to take a look at it and in about 15 seconds of glancing at it only picked out to packages that are currently in use.

Admittedly it would not be a disaster if I removed lobrhythmbox-core5 or rhythmbox-data. Rhythmbox depends on both of these so I think it may suffer but could be reinstalled easily.

I do have a lot of experience with Ubuntu testing releases. Using auto remove on them is a very good way to break your system.

This is a command that is intended for stable releases.

You could easily go to synaptic and go through the list there. Select one at a time and hit apply. It will offer you a chance to back out. See what all is being removed.

You can set your preferences in Synaptic to show a lot of info. Just highlighting a package will give you info on the depends for instance.

I would be shocked if there are no some packages listed there that you have no need of at all. Maybe even a majority of them. I would be more shocked if just using the autoremove command did not do some very serious damage to your system.

Yes you can fix it after that. It is a lot easier to not break it in the first place.

k3lt01 03-20-2012 10:15 PM

Craigevil has given good solid and sound advice, if I were you I would heed it. Snowpine and Tobi have also given good advice. Widget is just full of good advice.

Now to mine and I'll give you an example to clarify it. If you have modified the system in any way your package lists will be different to the "official" package lists. If you have removed any packages at all you may find you have caused the removal of a dependency of a smetapackage. Metapackages are used to pull in a bunch of other packages but have no other use. If you have inadvertantly removed a metapackage dependency you will now see other packages listed as dependencies of that metapackage in the autoremove list.

So as an example say you have removed openoffice/libreoffice you will have caused a meta package to try and install other software like gnomeoffice or something similar. If you do not allow that to install apt will place many parts of Gnome (I can't give an example in KDE but it will do the same) in the autoremove list. If you allow the autoremove you will break your desktop environment and find it near impossible to do simple things like log in, open applications or even (I did this once) shut down.

As already pointed out, autoremove is indicating you now have a dependency problem. My gut feeling is you have accidentally removed a dependencies of a metapackage so the remaining dependencies are listing as autoremoveable.

edbarx 03-21-2012 01:00 AM

Actually, I have upgraded a full system (Squeeze with kde) to Wheezy. The upgrade process itself crashed and I had to revive it by issuing and apt-get -f install command. That, complained that it couldn't work because there was a dependency problem. I used dkpg -i to resolve the latter and then apt-get -f install. However, apt-get -f install, continued till the very end of the installation probably assuming it was not a dist-upgrade what I needed. After that, I reapplied an apt-get dist-upgrade to correct the remaining problems and did some package auditing to verify that I did not have any remaining packages from Squeeze.

As long as the system boots in CLI, it should not be a problem, although there is still the chance of using a chroot from within another working installation. That should enable one to repair the system and it would be an interesting experiment to try.

I think, the safest action to take is to backup the entire installation, attempt a removal of the packages from outside kde (with kdm stopped) and reinstall the deleted packages. That should eliminate the need for the missing meta package.

k3lt01 03-21-2012 03:23 AM

Quote:

Originally Posted by edbarx (Post 4632226)
I think, the safest action to take is to backup the entire installation, attempt a removal of the packages from outside kde (with kdm stopped) and reinstall the deleted packages. That should eliminate the need for the missing meta package.

Yes or fix it with it all running anyway. I don't see why you would deliberately complicate the procedure if it will actually boot to KDE and function normally anyway.

T3RM1NVT0R 03-21-2012 04:18 PM

@ Reply
 
Quote:

Originally Posted by TobiSGD (Post 4632053)
Did you do that on Ubuntu or on Debian? AFAIK, those both distributions handle the marking of automatically installed packages differently, Ubuntu handles it in a way that is more newbie friendly by marking those dependencies as manually installed to prevent newbies from accidentally delete half the system with apt-get, while Debian assumes that you are knowing what you do when you are playing with the package manager.

I did that on Debian:

Code:

cat /etc/debian_version
6.0.4

I do agree with what people have said in the above posts which simply means it is better to be safe then sorry :-) but still I am unable to find the answers of my queries:

1. How apt-get autoremove calculates which packages to be removed.
2. If this option is so disastrous then why it is there.
3. When I did small testing with my Debian system it did not remove any package which was in use when I ran apt-get autoremove.

I mean if it is so dangerous then why does it exist there on the first place. I did try to find more information on this option on Debian's site but was unable to find much.

If we say that autoremove option sometimes remove the stuff which is required by the system then there is a problem with the code. It is like running "clear" command sometimes not only clears the screen but make the screen go black till you reboot :-)


All times are GMT -5. The time now is 07:22 AM.