Remove unnecessary packages and services

7 Antworten [Letzter Beitrag]
Triqel
Offline
Beigetreten: 12/06/2014

I use Trisquel 7 Mini and everything works well. However I want to remove unnecessary packages and services that I really don't need for example lvm2, dmraid, mdadm, modemmanager, ppp, btrfs-tools, jfsutils etc.

I can remove them using apt but then I get a long list of packages due to dependencies of Trisquel's metapackages above of line "Use 'apt-get autoremove' to remove them." If I would execute autoremove then it will remove almost all the system. I get a same list and message if I try only remove Trisquel's metapackages.

So what would be the best way remove these unnecessary packages and services safely and avoid message of "Use 'apt-get autoremove' to remove them."

Magic Banana

I am a member!

I am a translator!

Offline
Beigetreten: 07/24/2010

'apt-get autoremove' removes packages that were not explicitly asked for and that do not depend anymore on a package that was explicitly installed. Because the default install only explicitly installs the meta-packages, 'apt-get autoremove' suggests the removal of most of the system after those meta-packages are removed.

The solution (besides never using 'apt-get autoremove') would therefore be to explicitly install the packages you need. You can take a look at the dependencies of the meta-package, ask for them but, before confirming, check whether it would trigger the installation of the packages you do not want. If so, then look at the dependencies of that dependency and apply the same process. Recursively. It can take a while but it certainly is doable.

To do all that you can use the "Synaptic package manager" (in the "System settings") or the terminal ('apt-cache depends' followed by the packages name gives its dependencies).

lembas
Offline
Beigetreten: 05/13/2010

>Because the default install only explicitly installs the meta-packages

I think this is a bad idea. Perhaps we could file a bug requesting the actual packages instead?

(In Synaptic those are in Installed (auto removable). If you select such a package and then go to the Package menu and click the tick next to automatically installed, the package will be moved to Installed (manual).)

Triqel
Offline
Beigetreten: 12/06/2014

This situation is similar when the user is used Synaptic.

Problem is that these packages are installed by default via OS installation and they are dependencies with OS metapackages. I also tested on Linux Mint 17.1 and there were not any problems there, All packages were standalone without dependencies and I could remove them easily using apt. For instance: sudo apt-get purge lvm2

davidnotcoulthard (nicht überprüft)
davidnotcoulthard

If I'm not mistaken none of the preinstalled packages are set to auto so you should be safe even if you remove the metapackages.

The best way to know for sure is to remove one of them and do an apt-get autoremove and see if it asks to remove anything.

Anyway, there's always netinstall :) or debootstrap. I use the latter.

Triqel
Offline
Beigetreten: 12/06/2014

This case has solved. I did a fresh installation using GUI installer and I could remove metapackages except one and then I removed all my unnecessary packages (and then apt-get autoremove command). However if trisquel-desktop-common-data metapackege is removed then it will break apt/dpkg as shown below:

xxxxxxxx@xxxxxxx:~$ dpkg --get-selections trisquel*

trisquel-base install
trisquel-base-data install
trisquel-base-recommended install
trisquel-codecs install
trisquel-desktop-common install
trisquel-desktop-common-data install
trisquel-desktop-common-recommended install
trisquel-gtk-theme install
trisquel-icon-theme install
trisquel-keyring install
trisquel-mini install
trisquel-mini-data install
trisquel-mini-recommended install
trisquel-minimal install
trisquel-release-upgrader-core install
trisquel-release-upgrader-gtk install
trisquel-wallpapers install

xxxxxxxxxx@xxxxxxxx:~$ sudo apt-get purge trisquel-base* trisquel-desktop-common* trisquel-mini* trisquel-minimal

[sudo] password for xxxxxxxx:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'trisquel-base-recommended' for regex 'trisquel-base*'
Note, selecting 'trisquel-base-data' for regex 'trisquel-base*'
Note, selecting 'trisquel-base' for regex 'trisquel-base*'
Note, selecting 'trisquel-desktop-common' for regex 'trisquel-desktop-common*'
Note, selecting 'trisquel-desktop-common-recommended' for regex 'trisquel-desktop-common*'
Note, selecting 'trisquel-desktop-common-data' for regex 'trisquel-desktop-common*'
Note, selecting 'trisquel-minimal' for regex 'trisquel-mini*'
Note, selecting 'trisquel-mini-data' for regex 'trisquel-mini*'
Note, selecting 'trisquel-mini-recommended' for regex 'trisquel-mini*'
Note, selecting 'trisquel-mini' for regex 'trisquel-mini*'
The following packages were automatically installed and are no longer required:
apt-clone archdetect-deb cifs-utils dpkg-repack gir1.2-appindicator3-0.1
gir1.2-json-1.0 gir1.2-timezonemap-1.0 gir1.2-xkl-1.0 libdebian-installer4
libtimezonemap1 python3-cairo python3-gi-cairo python3-icu python3-pam
sbsigntool
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
trisquel-base* trisquel-base-data* trisquel-base-recommended*
trisquel-desktop-common* trisquel-desktop-common-data*
trisquel-desktop-common-recommended* trisquel-mini* trisquel-mini-data*
trisquel-mini-recommended* trisquel-minimal*
0 upgraded, 0 newly installed, 10 to remove and 284 not upgraded.
After this operation, 1 993 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 109383 files and directories currently installed.)
Removing trisquel-mini (7.0-34) ...
Removing trisquel-base (7.0-34) ...
Removing trisquel-base-data (7.0) ...
Purging configuration files for trisquel-base-data (7.0) ...
Removing trisquel-base-recommended (7.0-34) ...
Removing trisquel-desktop-common (7.0-34) ...
Removing trisquel-desktop-common-data (7.0-15) ...
dpkg: error processing package trisquel-desktop-common-data (--purge):
subprocess installed post-removal script returned error exit status 1
Removing trisquel-desktop-common-recommended (7.0-34) ...
Removing trisquel-mini-data (7.0-2) ...
Purging configuration files for trisquel-mini-data (7.0-2) ...
Removing trisquel-mini-recommended (7.0-34) ...
Removing trisquel-minimal (7.0-34) ...
Processing triggers for gconf2 (3.2.6-0ubuntu2) ...
Processing triggers for fontconfig (2.11.0-0ubuntu4.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu1+7.0trisquel1) ...
Processing triggers for mime-support (3.54ubuntu1) ...
Processing triggers for libglib2.0-0:amd64 (2.40.2-0ubuntu1) ...
Errors were encountered while processing:
trisquel-desktop-common-data
E: Sub-process /usr/bin/dpkg returned an error code (1)

Legimet
Offline
Beigetreten: 12/10/2013

BTW, if you ever want to clear the autoremove list, this command comes in handy (run as root):
aptitude keep-all

Triqel
Offline
Beigetreten: 12/06/2014

I tested a bit more and just noticed one thing: If user has set auto-login on LXDE and then trisquel-mini-data metapackage is removed and when the system will restart next time then a login screen appears and user password does not work anymore and user can't continue to forward. Maybe this is bug.

So my system works well with auto-login when the following packages have leaved into the system

trisquel-codecs
trisquel-desktop-common-data
trisquel-gtk-theme
trisquel-icon-theme
trisquel-keyring
trisquel-mini-data
trisquel-release-upgrader-core
trisquel-release-upgrader-gtk
trisquel-wallpapers

Besides I highly recommend that a system backup is taken before than any metapackages are removed.