E tudo começou pela falta que sinto de um equivalente ao comando pacman -Qmq ou pacman -Qm do Arch Linux, o dito de uma só vez me entrega todos os pacotes não-oficiais instalados num Arch Linux. Tendo dito isto, com a leitura das 2 dicas anteriores e do conteúdo a seguir teremos algo similar num Debian, Ubuntu ou derivado.
Remoção Completa de pacotes não-oficiais
Na página do desenvolvedor Debian Raphael Hertzog, existe a demonstração de como remover toda a série de pacotes não oficiais, e isto é muito fácil:
Primeiro listamos todos os pacotes não oficiais, seja com:
$ aptitude search '?narrow(?installed, !?origin(Debian))!?obsolete'
Ou com:
$ aptitude search '~S ~i !~ODebian !~o'
Depois, removemos a opção search e adicionamos em seu lugar as opção remove ou purge, como em:
$ sudo aptitude purge '?narrow(?installed, !?origin(Debian))!?obsolete'
Ou:
$ sudo aptitude remove '~S ~i !~ODebian !~o'
log:
[27462:27448 0:787] 03:53:40 Ter Mar 17 [edps@debian: +1] ~ (1:787)$ sudo aptitude purge '?narrow(?installed, !?origin(Debian))!?obsolete' Os pacotes a seguir serão REMOVIDOS: aacgain{p} aacplusenc{p} adeskbar{p} adwaita-elements{p} adwaita-x-dark-theme{p} adwaita-x-light-theme{p} antix-snapshot-cli{p} bbq-kielbasa-theme{p} bbq-tools{p} bleachbit{p} boje{p} cclive{p} clearbird-theme{p} clearlooks-flat-compact{p} clearlooks-phenix{p} clipit{p} compton{p} cupertino-theme{p} deb-multimedia-keyring{p} easytag{p} elegant-brit{p} exit-antix{p} faac{p} faenza-blue-dark{p} faenza-cupertino{p} faenza-icon-theme{p} faience-icon-theme{p} faience-theme{p} ffmpeg{p} ffmpeg2theora{p} flatstudio{p} futura{p} gambas3-gb-form{u} gambas3-gb-gtk{u} gambas3-gb-gui{u} gambas3-gb-image{u} gambas3-gb-qt4{u} gambas3-gb-settings{u} gambas3-runtime{u} gmusicbrowser{p} google-chrome-unstable{p} gstreamer0.10-ffmpeg{p} gstreamer0.10-plugins-really-bad{p} gtk2-engines-aurora{u} gtkdialog{p} handbrake-gtk{p} jdownloader-installer{p} ktsuss{p} lame{p} lesstif2{u} libaacplus2{p} libav-tools{p} libavcodec-dev{p} libavcodec53{p} libavcodec54{p} libavdevice54{p} libavfilter3{p} libavformat-dev{p} libavformat53{p} libavformat54{p} libavutil-dev{p} libavutil51{p} libavutil52{p} libdc1394-22-dev{u} libdca0{p} libdirac-dev{u} libdvdcss2{p} libexplain30{u} libfaac-dev{p} libfaac0{p} libfdk-aac0{p} libffms2-2{u} libglib1.2-dev{p} libglib1.2ldbl{p} libgtk1.2{p} libgtk1.2-common{p} libgtk1.2-dev{p} libguess1{u} libjline-java{u} liblavfile-2.0-0{p} liblavjpeg-2.0-0{p} liblavplay-2.0-0{p} liblsmash2{p} libmac2{p} libmjpegutils-2.0-0{p} libmkv0{p} libmowgli2{u} libmp3lame-dev{p} libmp3lame0{p} libmp4v2-2{p} libmpeg2encpp-2.0-0{p} libmplex2-2.0-0{p} libnspr4{p} libnspr4-0d{p} libnspr4-dev{p} libnss3{p} libnss3-1d{p} libnss3-dev{p} libnss3-tools{p} liboggkate1{u} libopencore-amrnb-dev{u} libopencore-amrwb-dev{u} libopusfile-dev{p} libopusfile0{p} liborc-0.4-dev{u} libpostproc52{p} libquicktime2{u} libraw1394-dev{u} libraw1394-tools{u} librhino-java{u} libschroedinger-dev{u} libsidplayfp-dev{p} libsidplayfp3{p} libswresample0{p} libswscale2{p} libtheora-dev{u} libva-glx1{u} libvlc-dev{p} libvlc5{p} libvlccore-dev{p} libvlccore5{p} libx264-124{p} libx264-132{p} libx264-142{p} libx264-dev{p} libxp6{u} libxvidcore-dev{p} libxvidcore4{p} logkeys{p} lsdvd{u} lubuntubox{p} malys-ex{p} malys-glassart{p} malys-glassart-arch{p} malys-glassart-blue{p} malys-glassart-green{p} malys-uniblack{p} malys-uniblue{p} malys-unicolors{p} malys-unicolors-blue{p} malys-unicolors-gray{p} malys-unisex-clear{p} malys-unisex-gray{p} malys-unisex-white{p} malys-uniwhite{p} mencoder{p} mjpegtools{p} monkeys-audio{p} mplayer{p} mplayer2{p} mpv{p} openbox-themes{p} opera{p} opera-next{p} oracle-java7-jre{p} pia{u} plowshare4{p} pogo{p} python-mutagen{u} qmmp{p} quiterss{p} rhino{u} scantv{u} simpleburn{p} smplayer{p} smplayer-skins{p} smplayer-themes{p} soundkonverter{p} sublime-text{p} synaptic{p} timeshift{p} transcode{p} transcode-doc{p} transmission{p} v4l-conf{u} vivaldi-snapshot{p} vlc{p} vlc-data{p} vlc-nox{p} vlc-plugin-notify{p} vlc-plugin-pulse{p} vnstat{p} w32codecs{p} wbar{p} wbar-config{p} x264{p} xawtv{u} xawtv-plugins{u} xipper{p} xix-media-player{p} xlockmore{p} xmms{p} xmms-plugins-antix{p} 0 pacotes atualizados, 0 novos instalados, 193 a serem removidos e 4 não atualizados. É preciso obter 0 B de arquivos. Depois do desempacotamento, 1.224 MB serão liberados. Os pacotes a seguir possuem dependências não satisfeitas: libnss3-nssdb : Depende: libnss3 (= 2:3.17.4-0ubuntu0.14.04.1) but it is not going to be installed. gstreamer0.10-plugins-ugly : Depende: libmp3lame0 but it is not going to be installed. libgegl-0.2-0 : Depende: libavcodec53 (>= 6:0.8.3-1~) but it is not going to be installed. ou libavcodec-extra-53 (>= 6:0.8.4) but it is not going to be installed. Depende: libavformat53 (>= 6:0.8.3-1~) but it is not going to be installed. libreoffice-core : Depende: libnspr4 (>= 2:4.9-2~) but it is not going to be installed. ou libnspr4-0d (>= 1.8.0.10) but it is not going to be installed. Depende: libnss3 (>= 2:3.13.4-2~) but it is not going to be installed. ou libnss3-1d (>= 3.12.0~1.9b1) but it is not going to be installed. vlmc-build-deps : Depende: vlc (>= 1.1.0) but it is not going to be installed. Depende: libvlccore-dev (>= 1.1.0) but it is not going to be installed. Depende: libvlc-dev (>= 1.1.0) but it is not going to be installed. handbrake-cli : Depende: libavcodec54 (>= 6:9.1-1) but it is not going to be installed. ou libavcodec-extra-54 (>= 6:9.13) o qual é um pacote virtual. Depende: libavformat54 (>= 6:9.1-1) but it is not going to be installed. Depende: libavutil52 (>= 6:9.1-1) but it is not going to be installed. Depende: libmkv0 (>= 0.6.5.1) but it is not going to be installed. Depende: libmp3lame0 but it is not going to be installed. Depende: libswscale2 (>= 6:9.1-1) but it is not going to be installed. pepperflashplugin-nonfree : Depende: libnspr4 but it is not going to be installed. Depende: libnss3 but it is not going to be installed. libstreamanalyzer0 : Depende: libavcodec53 (>= 6:0.8.3-1+b1) but it is not going to be installed. ou libavcodec-extra-53 (>= 6:0.8.3-1+b1) but it is not going to be installed. Depende: libavformat53 (>= 6:0.8.3-1+b1) but it is not going to be installed. Depende: libavutil51 (>= 6:0.8.3-1+b1) but it is not going to be installed. Depende: libswscale2 (>= 6:0.8.3-1+b1) but it is not going to be installed. gstreamer0.10-plugins-bad : Depende: libdca0 but it is not going to be installed. Depende: libxvidcore4 (>= 1.2.2) but it is not going to be installed. flashplugin-nonfree : Depende: libnspr4 but it is not going to be installed. Depende: libnss3 but it is not going to be installed. libasound2-plugins : Depende: libavcodec53 (>= 6:0.8.2-2) but it is not going to be installed. ou libavcodec-extra-53 (>= 6:0.8.2-2) but it is not going to be installed. Depende: libavutil51 (>= 6:0.8.2-2) but it is not going to be installed. libk3b6-extracodecs : Depende: libavcodec53 (>= 6:0.8.3-1~) but it is not going to be installed. ou libavcodec-extra-53 (>= 6:0.8.3) but it is not going to be installed. Depende: libavformat53 (>= 6:0.8.3-6) but it is not going to be installed. Depende: libavutil51 (>= 6:0.8.3-6) but it is not going to be installed. As seguintes ações resolverão estas dependências: Remover os pacotes a seguir: 1) flashplugin-nonfree 2) gimp 3) gstreamer0.10-plugins-bad 4) gstreamer0.10-plugins-ugly 5) handbrake-cli 6) k3b 7) k3b-i18n 8) katepart 9) kde-runtime 10) kdelibs-bin 11) kdelibs5-dev 12) kdelibs5-plugins 13) kdoctools 14) libasound2-plugins 15) libgegl-0.2-0 16) libk3b6 17) libk3b6-extracodecs 18) libkatepartinterfaces4 19) libkcddb-dev 20) libkcddb4 21) libkde3support4 22) libkdewebkit5 23) libkemoticons4 24) libkfile4 25) libkhtml5 26) libkimproxy4 27) libkio5 28) libkmediaplayer4 29) libknewstuff2-4 30) libknewstuff3-4 31) libknotifyconfig4 32) libkparts4 33) libkprintutils4 34) libkrossui4 35) libktexteditor4 36) libkutils4 37) libnss3-nssdb 38) libplasma3 39) libreoffice-avmedia-backend-gstreamer 40) libreoffice-base-core 41) libreoffice-calc 42) libreoffice-core 43) libreoffice-draw 44) libreoffice-impress 45) libreoffice-math 46) libreoffice-pdfimport 47) libreoffice-writer 48) libstreamanalyzer0 49) pepperflashplugin-nonfree 50) plasma-scriptengine-javascript 51) python-uno 52) vlmc-build-deps Leave the following dependencies unresolved: 53) gimp-data recomenda gimp 54) k3b recomenda libk3b6-extracodecs 55) kdelibs5-plugins recomenda kde-runtime 56) libkhtml5 recomenda kdelibs5-plugins (= 4:4.8.4-4+deb7u1) 57) libwebkitgtk-1.0-0 recomenda gstreamer0.10-plugins-bad 58) libwebkitgtk-1.0-0 recomenda gstreamer0.10-ffmpeg 59) libwebkitgtk-3.0-0 recomenda gstreamer0.10-plugins-bad 60) libwebkitgtk-3.0-0 recomenda gstreamer0.10-ffmpeg 61) libreoffice-common recomenda python-uno 62) libreoffice-impress recomenda libreoffice-avmedia-backend-gstreamer | libreoffice-avmedia-backend-vlc 63) libreoffice-writer recomenda libreoffice-math 64) iceweasel recomenda gstreamer0.10-ffmpeg Aceitar esta solução? [Y/n/q/?]
Remoção por repositório
Diferentemente do primeiro caso, aqui podemos remover apenas os pacotes de um determinado repositório.
Mas isso não que dizer que outros pacotes não serão removidos, pois pode haver casos que um pacote fique órfão(ou perdido no sistema, porque nada depende dele), ou outro seja removido porque sua dependência faz parte da lista dos pacotes do repositório a ser removido).
Então, para remover todos os pacotes de um determinado repositório fazemos assim (vou usar o repositório do Opera como exemplo):
$ sudo aptitude remove "?installed?origin(Opera Software ASA)"
log:
[27462:27448 0:792] 04:16:20 Ter Mar 17 [edps@debian: +1] ~ (1:792)$ sudo aptitude remove "?installed?origin(Opera Software ASA)" Os pacotes a seguir serão REMOVIDOS: opera opera-next 0 pacotes atualizados, 0 novos instalados, 2 a serem removidos e 4 não atualizados. É preciso obter 0 B de arquivos. Depois do desempacotamento, 85,3 MB serão liberados. (Lendo banco de dados ... 286572 files and directories currently installed.) Removendo opera ... update-alternatives: using /usr/bin/opera-next to provide /usr/bin/x-www-browser (x-www-browser) in auto mode update-alternatives: using /usr/bin/opera-next to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode Removendo opera-next ... update-alternatives: using /usr/bin/google-chrome-unstable to provide /usr/bin/x-www-browser (x-www-browser) in auto mode update-alternatives: using /usr/bin/google-chrome-unstable to provide /usr/bin/gnome-www-browser (gnome-www-browser) in auto mode Processando gatilhos para shared-mime-info ... Processando gatilhos para menu ... Processando gatilhos para desktop-file-utils ... Processando gatilhos para man-db ... Processando gatilhos para hicolor-icon-theme ... Processando gatilhos para gnome-menus ... [27462:27448 0:793] 04:18:23 Ter Mar 17 [edps@debian: +1] ~ (1:793)$
Ou algo mais difícl, como o deb-multimedia:
$ sudo aptitude remove "?installed?origin(Unofficial Multimedia Packages)"
log:
[27462:27448 0:794] 04:20:44 Ter Mar 17 [edps@debian: +1] ~ (1:794)$ sudo aptitude remove "?installed?origin(Unofficial Multimedia Packages)" Os pacotes a seguir serão REMOVIDOS: aacgain aacplusenc deb-multimedia-keyring faac ffmpeg ffmpeg2theora gstreamer0.10-ffmpeg gstreamer0.10-plugins-really-bad handbrake-cli handbrake-gtk lame lesstif2{u} libaacplus2 libav-tools libavcodec-dev libavcodec53 libavcodec54 libavdevice54 libavfilter3 libavformat-dev libavformat53 libavformat54 libavresample1{u} libavutil-dev libavutil51 libavutil52 libavutil53{u} libdc1394-22-dev{u} libdca0 libdirac-dev{u} libdvdcss2 libexplain30{u} libfaac-dev libfaac0 libfdk-aac0 libffms2-2{u} liblavfile-2.0-0 liblavjpeg-2.0-0 liblavplay-2.0-0 liblsmash2 libmac2 libmjpegutils-2.0-0 libmkv0 libmp3lame-dev libmp3lame0 libmp4v2-2 libmpeg2encpp-2.0-0 libmplex2-2.0-0 liboggkate1{u} libopencore-amrnb-dev{u} libopencore-amrwb-dev{u} liborc-0.4-dev{u} libpostproc52 libquicktime2{u} libraw1394-dev{u} libraw1394-tools{u} libschroedinger-dev{u} libswresample0 libswscale2 libtag1-dev libtag1-vanilla libtag1c2a libtagc0 libtheora-dev{u} libvlc-dev libvlc5 libvlccore-dev libvlccore5 libx264-124 libx264-132 libx264-142 libx264-dev libxp6{u} libxvidcore-dev libxvidcore4 mencoder mjpegtools monkeys-audio mplayer mplayer2 pia{u} scantv{u} timeshift transcode transcode-doc v4l-conf{u} vlc vlc-data vlc-nox vlc-plugin-notify vlc-plugin-pulse w32codecs x264 xawtv{u} xawtv-plugins{u} 0 pacotes atualizados, 0 novos instalados, 95 a serem removidos e 4 não atualizados. É preciso obter 0 B de arquivos. Depois do desempacotamento, 267 MB serão liberados. Os pacotes a seguir possuem dependências não satisfeitas: gstreamer0.10-plugins-ugly : Depende: libmp3lame0 but it is not going to be installed. libk3b6 : Depende: libtag1c2a (>= 1.5) but it is not going to be installed. libgegl-0.2-0 : Depende: libavcodec53 (>= 6:0.8.3-1~) but it is not going to be installed. ou libavcodec-extra-53 (>= 6:0.8.4) but it is not going to be installed. Depende: libavformat53 (>= 6:0.8.3-1~) but it is not going to be installed. xix-media-player : Depende: lame but it is not going to be installed. Depende: mplayer but it is not going to be installed. soundkonverter : Depende: libtag1c2a (>= 1.9.1) but it is not going to be installed. qmmp : Depende: libavcodec54 (>= 10:1.2.0) but it is not going to be installed. Depende: libavformat54 (>= 10:1.2.0) but it is not going to be installed. Depende: libavutil52 (>= 10:1.2.0) but it is not going to be installed. Depende: libtag1c2a (>= 1.8) but it is not going to be installed. gstreamer0.10-plugins-good : Depende: libtag1c2a (>= 1.5) but it is not going to be installed. vlmc-build-deps : Depende: vlc (>= 1.1.0) but it is not going to be installed. Depende: libvlccore-dev (>= 1.1.0) but it is not going to be installed. Depende: libvlc-dev (>= 1.1.0) but it is not going to be installed. moc : Depende: libtagc0 (>= 1.5) but it is not going to be installed. thunar-media-tags-plugin : Depende: libtag1c2a (>= 1.5) but it is not going to be installed. Depende: libtagc0 (>= 1.5) but it is not going to be installed. mpv : Depende: libmp3lame0 (>= 1:3.99.0) but it is not going to be installed. Depende: libx264-142 but it is not going to be installed. Depende: libxvidcore4 but it is not going to be installed. libstreamanalyzer0 : Depende: libavcodec53 (>= 6:0.8.3-1+b1) but it is not going to be installed. ou libavcodec-extra-53 (>= 6:0.8.3-1+b1) but it is not going to be installed. Depende: libavformat53 (>= 6:0.8.3-1+b1) but it is not going to be installed. Depende: libavutil51 (>= 6:0.8.3-1+b1) but it is not going to be installed. Depende: libswscale2 (>= 6:0.8.3-1+b1) but it is not going to be installed. gstreamer0.10-plugins-bad : Depende: libdca0 but it is not going to be installed. Depende: libxvidcore4 (>= 1.2.2) but it is not going to be installed. smplayer : Depende: mplayer but it is not going to be installed. ou mplayer-nogui but it is not going to be installed. ou mplayer-mt o qual é um pacote virtual. ou mplayer2 but it is not going to be installed. easytag : Depende: libtag1c2a (>= 1.9.1) but it is not going to be installed. libasound2-plugins : Depende: libavcodec53 (>= 6:0.8.2-2) but it is not going to be installed. ou libavcodec-extra-53 (>= 6:0.8.2-2) but it is not going to be installed. Depende: libavutil51 (>= 6:0.8.2-2) but it is not going to be installed. libk3b6-extracodecs : Depende: libavcodec53 (>= 6:0.8.3-1~) but it is not going to be installed. ou libavcodec-extra-53 (>= 6:0.8.3) but it is not going to be installed. Depende: libavformat53 (>= 6:0.8.3-6) but it is not going to be installed. Depende: libavutil51 (>= 6:0.8.3-6) but it is not going to be installed. Depende: libtag1c2a (>= 1.5) but it is not going to be installed. xmms-plugins-antix : Depende: mplayer but it is not going to be installed. As seguintes ações resolverão estas dependências: Remover os pacotes a seguir: 1) easytag 2) gimp 3) gstreamer0.10-plugins-bad 4) gstreamer0.10-plugins-good 5) gstreamer0.10-plugins-ugly 6) k3b 7) k3b-i18n 8) katepart 9) kde-runtime 10) kdelibs-bin 11) kdelibs5-dev 12) kdelibs5-plugins 13) kdoctools 14) libasound2-plugins 15) libgegl-0.2-0 16) libk3b6 17) libk3b6-extracodecs 18) libkatepartinterfaces4 19) libkcddb-dev 20) libkcddb4 21) libkde3support4 22) libkdewebkit5 23) libkemoticons4 24) libkfile4 25) libkhtml5 26) libkimproxy4 27) libkio5 28) libkmediaplayer4 29) libknewstuff2-4 30) libknewstuff3-4 31) libknotifyconfig4 32) libkparts4 33) libkprintutils4 34) libkrossui4 35) libktexteditor4 36) libkutils4 37) libplasma3 38) libstreamanalyzer0 39) moc 40) mpv 41) opera 42) opera-next 43) plasma-scriptengine-javascript 44) pogo 45) qmmp 46) smplayer 47) smplayer-skins 48) smplayer-themes 49) soundkonverter 50) thunar-media-tags-plugin 51) vlmc-build-deps 52) xix-media-player 53) xmms-plugins-antix Leave the following dependencies unresolved: 54) gimp-data recomenda gimp 55) kdelibs5-plugins recomenda kde-runtime 56) libkhtml5 recomenda kdelibs5-plugins (= 4:4.8.4-4+deb7u1) 57) phonon-backend-gstreamer recomenda gstreamer0.10-plugins-good 58) libwebkitgtk-1.0-0 recomenda gstreamer0.10-plugins-good 59) libwebkitgtk-1.0-0 recomenda gstreamer0.10-plugins-bad 60) libwebkitgtk-1.0-0 recomenda gstreamer0.10-ffmpeg 61) libwebkitgtk-3.0-0 recomenda gstreamer0.10-plugins-good 62) libwebkitgtk-3.0-0 recomenda gstreamer0.10-plugins-bad 63) libwebkitgtk-3.0-0 recomenda gstreamer0.10-ffmpeg 64) pogo recomenda gstreamer0.10-plugins-ugly 65) pogo recomenda gstreamer0.10-plugins-bad 66) simpleburn recomenda mplayer-nogui | mplayer | gmplayer 67) simpleburn recomenda mencoder 68) soundkonverter recomenda faac 69) soundkonverter recomenda ffmpeg 70) soundkonverter recomenda lame 71) soundkonverter recomenda mplayer 72) iceweasel recomenda gstreamer0.10-ffmpeg 73) iceweasel recomenda gstreamer0.10-plugins-good Aceitar esta solução? [Y/n/q/?]
Como dito anteriormente, além dos pacotes do repositório, outros pacotes serão removidos porque dependem dos pacotes daquele repositório, caso do K3B, MPV, EasyTag, Qmmp, SmPlayer, etc.
Então, fique atento! se não se garante em usar o terminal para resolver seus problemas, o Synaptic faz tudo isso aí que demonstrei no modo gráfico.
Referências
Find packages installed from a certain repository with aptitude
Debian Cleanup Tip #3: get rid of third-party packages
LISTANDO OS REPOSITÓRIOS HABILITADOS NUM SISTEMA DEBIAN-LIKE
LISTANDO OS PACOTES INSTALADOS (POR ORIGEM) NUM SISTEMA DEBIAN-LIKE
t+