Car*_*guz 2 dpkg apt package-management deb
我正在通过.deb从官方网站下载的文件安装 Prey ,突然我意识到我的 Ubunu 笔记本电脑中有这么多“不必要的”安装包。
这是我的行动顺序:
试图sudo dpkg -i prey.deb。由于丢失数据包/冲突而无法工作:
prey:i386 depèn de sudo.
prey:i386 depèn de python.
prey:i386 depèn de python-gtk2.
prey:i386 depèn de scrot.
prey:i386 depèn de streamer.
prey:i386 depèn de mpg123.
prey:i386 depèn de dmidecode.
prey:i386 depèn de gksu.
Run Code Online (Sandbox Code Playgroud)然后我做了一个sudo apt-get update(一切都很好)和一个sudo apt-get upgrade(失败,因为我认为以前的软件包安装不成功)。APT 建议这样做apt-get -f install,我就这样做了。突然间,我意识到我有一个非常长的不必要的包列表,我没有(至少在昨天):
aglfn asymptote asymptote-doc checkbox-ng checkbox-ng-service cm-super cm-super-minimal context context-modules fonts-cabin fonts-comfortaa fonts-dejavu-extra fonts-ebgaramond fonts-ebgaramond-extra
fonts-font-awesome fonts-freefont-otf fonts-gfs-artemisia fonts-gfs-baskerville fonts-gfs-bodoni-classic fonts-gfs-complutum fonts-gfs-didot fonts-gfs-didot-classic fonts-gfs-gazis
fonts-gfs-neohellenic fonts-gfs-olga fonts-gfs-porson fonts-gfs-solomos fonts-gfs-theokritos fonts-hosny-amiri fonts-inconsolata fonts-junicode fonts-lato fonts-linuxlibertine fonts-lobster
fonts-lobstertwo fonts-oflb-asana-math fonts-roboto fonts-sil-gentium fonts-sil-gentium-basic fonts-sil-gentiumplus fonts-stix freeglut3 giblib1:i386 gstreamer0.10-alsa gstreamer0.10-plugins-good
gstreamer0.10-x lcdf-typetools libasound2:i386 libatk1.0-0:i386 libaudit1:i386 libavahi-client3:i386 libavahi-common-data:i386 libavahi-common3:i386 libbz2-1.0:i386 libcairo2:i386 libcomerr2:i386
libcups2:i386 libdatrie1:i386 libdb5.3:i386 libdbus-1-3:i386 libdbus-glib-1-2:i386 libdv4:i386 libffi6:i386 libfontconfig1:i386 libfreetype6:i386 libftgl2 libgconf-2-4:i386 libgcrypt20:i386
libgdk-pixbuf2.0-0:i386 libgif4:i386 libglib2.0-0:i386 libgmp10:i386 libgnome-keyring0:i386 libgnutls-deb0-28:i386 libgpg-error0:i386 libgpm2:i386 libgraphite2-3:i386 libgsl0ldbl libgssapi-krb5-2:i386
libgtk2.0-0:i386 libharfbuzz0b:i386 libhogweed4:i386 libid3tag0:i386 libimlib2:i386 libintl-perl libjbig0:i386 libjpeg-turbo8:i386 libjpeg8:i386 libk5crypto3:i386 libkeyutils1:i386 libkrb5-3:i386
libkrb5support0:i386 libltdl7:i386 liblzma5:i386 libmpg123-0:i386 libncursesw5:i386 libnettle6:i386 libosmesa6 libp11-kit0:i386 libpam-modules:i386 libpam0g:i386 libpango-1.0-0:i386
libpangocairo-1.0-0:i386 libpangoft2-1.0-0:i386 libpcre3:i386 libpixman-1-0:i386 libpng12-0:i386 libpoppler-qt5-1 libprojectm2v5 libpython-stdlib:i386 libpython2.7-minimal:i386
libpython2.7-stdlib:i386 libpython3.5-minimal libpython3.5-stdlib libqca2-plugins libqca2v5 libqt5script5 libqxt-core0 libqxt-gui0 libreadline6:i386 libselinux1:i386 libsigsegv2 libsqlite3-0:i386
libssl1.0.0:i386 libstartup-notification0:i386 libsystemd0:i386 libtasn1-6:i386 libtext-unidecode-perl libthai0:i386 libtiff5:i386 libtinfo5:i386 libv4l-0:i386 libv4lconvert0:i386 libx11-xcb1:i386
libxcb-render0:i386 libxcb-shm0:i386 libxcb-util1:i386 libxcomposite1:i386 libxcursor1:i386 libxdamage1:i386 libxfixes3:i386 libxi6:i386 libxinerama1:i386 libxml-libxml-perl
libxml-namespacesupport-perl libxml-sax-base-perl libxml-sax-expat-perl libxml-sax-perl libxrandr2:i386 libxrender1:i386 linux-image-4.2.0-16-generic linux-image-4.2.0-18-generic
linux-image-4.2.0-19-generic linux-image-4.2.0-22-generic linux-image-extra-4.2.0-16-generic linux-image-extra-4.2.0-18-generic linux-image-extra-4.2.0-19-generic linux-image-extra-4.2.0-22-generic
linux-signed-image-4.2.0-18-generic linux-signed-image-4.2.0-19-generic linux-signed-image-4.2.0-22-generic m-tx mpg123:i386 musixtex pfb2t1c2pfb plainbox-secure-policy pmx python3-checkbox-ng
python3-checkbox-support python3-jinja2 python3-plainbox python3-pyparsing python3-xlsxwriter python3.5 python3.5-minimal qml-module-qtquick-localstorage qtdeclarative5-localstorage-plugin scrot:i386
streamer:i386 sudo:i386 tex4ht tex4ht-common texinfo texlive-fonts-extra texlive-fonts-extra-doc texlive-formats-extra texlive-games texlive-generic-extra texlive-humanities texlive-humanities-doc
texlive-lang-african texlive-lang-arabic texlive-lang-cyrillic texlive-lang-czechslovak texlive-lang-english texlive-lang-european texlive-lang-french texlive-lang-german texlive-lang-greek
texlive-lang-indic texlive-lang-italian texlive-lang-polish texlive-lang-portuguese texlive-lang-spanish texlive-luatex texlive-math-extra texlive-music texlive-omega texlive-plain-extra
texlive-publishers texlive-publishers-doc texlive-science-doc texlive-xetex ttf-adf-accanthis ttf-adf-gillius ttf-adf-universalis ttf-dejavu-core xawtv-plugins:i386 zlib1g:i386
Run Code Online (Sandbox Code Playgroud)
请注意,除了这个长列表之外,apt还表示将删除以下软件包(sudo??):
Es SUPRIMIRAN els paquets següents:
plainbox-provider-resource-generic prey:i386 sudo
Run Code Online (Sandbox Code Playgroud)
所以因为这一切,我中止了apt-get -f install,以防万一......
因为我不确定这个dpkg过程,所以我通过执行dpkg --purge prey.
此时,我apt-get -f install再次检查了不必要的包列表 ( ),它减少了,但仍然足够长,足以让我取消此命令。这是apt“想要”卸载的软件包列表,因为它们不是必需的:
aglfn asymptote asymptote-doc checkbox-ng checkbox-ng-service cm-super cm-super-minimal context context-modules fonts-cabin fonts-comfortaa fonts-dejavu-extra fonts-ebgaramond fonts-ebgaramond-extra
fonts-font-awesome fonts-freefont-otf fonts-gfs-artemisia fonts-gfs-baskerville fonts-gfs-bodoni-classic fonts-gfs-complutum fonts-gfs-didot fonts-gfs-didot-classic fonts-gfs-gazis
fonts-gfs-neohellenic fonts-gfs-olga fonts-gfs-porson fonts-gfs-solomos fonts-gfs-theokritos fonts-hosny-amiri fonts-inconsolata fonts-junicode fonts-lato fonts-linuxlibertine fonts-lobster
fonts-lobstertwo fonts-oflb-asana-math fonts-roboto fonts-sil-gentium fonts-sil-gentium-basic fonts-sil-gentiumplus fonts-stix freeglut3 gstreamer0.10-alsa gstreamer0.10-plugins-good gstreamer0.10-x
lcdf-typetools libftgl2 libgsl0ldbl libintl-perl libosmesa6 libpoppler-qt5-1 libprojectm2v5 libpython3.5-minimal libpython3.5-stdlib libqca2-plugins libqca2v5 libqt5script5 libqxt-core0 libqxt-gui0
libsigsegv2 libtext-unidecode-perl libxml-libxml-perl libxml-namespacesupport-perl libxml-sax-base-perl libxml-sax-expat-perl libxml-sax-perl linux-image-4.2.0-16-generic linux-image-4.2.0-18-generic
linux-image-4.2.0-19-generic linux-image-4.2.0-22-generic linux-image-extra-4.2.0-16-generic linux-image-extra-4.2.0-18-generic linux-image-extra-4.2.0-19-generic linux-image-extra-4.2.0-22-generic
linux-signed-image-4.2.0-18-generic linux-signed-image-4.2.0-19-generic linux-signed-image-4.2.0-22-generic m-tx musixtex pfb2t1c2pfb plainbox-provider-resource-generic plainbox-secure-policy pmx
python3-checkbox-ng python3-checkbox-support python3-jinja2 python3-plainbox python3-pyparsing python3-xlsxwriter python3.5 python3.5-minimal qml-module-qtquick-localstorage
qtdeclarative5-localstorage-plugin tex4ht tex4ht-common texinfo texlive-fonts-extra texlive-fonts-extra-doc texlive-formats-extra texlive-games texlive-generic-extra texlive-humanities
texlive-humanities-doc texlive-lang-african texlive-lang-arabic texlive-lang-cyrillic texlive-lang-czechslovak texlive-lang-english texlive-lang-european texlive-lang-french texlive-lang-german
texlive-lang-greek texlive-lang-indic texlive-lang-italian texlive-lang-polish texlive-lang-portuguese texlive-lang-spanish texlive-luatex texlive-math-extra texlive-music texlive-omega
texlive-plain-extra texlive-publishers texlive-publishers-doc texlive-science-doc texlive-xetex ttf-adf-accanthis ttf-adf-gillius ttf-adf-universalis ttf-dejavu-core
Run Code Online (Sandbox Code Playgroud)我记得linux-signed-image...昨天在这个列表中填充了一些和其他的,但绝对没有所有的。事实上,一些如果正在使用这些包我知道肯定(例如texlive-*,fonts-*,ttf-*,python-*...)什么可能我已经打破,我怎么能恢复呢?
我怀疑错误来自第 3 步,但我不确定。
更新:debfoster在按照评论中的建议进行修补之前,我已经检查了一些软件包,我注意到:
ubuntu-desktop 未安装 (?!) -- 而且我没有使用 KDE 或 XCFE。 除了已经建议的 debfoster 之外,还有一些例行程序,老太太的故事,用于查找并清除不必要的包裹。
您在清理软件包时要使用的工具aptitude why pkg-name 来自 aptitude 手册页:
$ aptitude why kdepim
i nautilus-data Recommends nautilus
i A nautilus Recommends desktop-base (>= 0.2)
i A desktop-base Suggests gnome | kde | xfce4 | wmaker
p kde Depends kdepim (>= 4:3.4.3)
Run Code Online (Sandbox Code Playgroud)
这只会打印出最强的依赖链,但会很快回答很多问题。还有why-not哪些与删除软件包无关。
您可以找到自己不再使用但仍保留配置文件等的软件包。为此,请打开终端并键入
dpkg-query -l '*' | grep ^rc | awk '{print $2}' |xargs > my_ apt_rc_removeList.lst
Run Code Online (Sandbox Code Playgroud)
生成的列表包含处于 'rc' 状态的所有文件 - 已删除但配置文件仍保留。您现在将删除这些剩余文件,但首先查看 my_apt_rc_removeList.lst 文件中列出的文件,以检查您是否确实希望删除所有这些残骸。现在输入
aptitude purge `cat apt_rc_removeList.lst`
Run Code Online (Sandbox Code Playgroud)
所有这些杂物都将被移除。
另一个可以用来查找剩余包的应用程序是 gtkorphan。来自 gtkorphan 在 apt 系统中的描述:
GtkOrphan 是一个图形工具,它扫描您的 Debian 系统,寻找孤立的库。它实现了一个用于 deborphan 的 GUI 前端,但添加了包删除功能。有关该程序的详细文档,请访问:http : //www.marzocca.net/linux/gtkorphan.html。
您也可以使用它来帮助清理其他部分(“libs”除外)中的包。
在 aptitude 中,在“已安装的软件包”的一个子类别中,键入l(字母“el”),然后在出现的框中输入?not(?automatic)。这现在将只显示不依赖于其他包的包。现在,滚动其中的每一个,并在您不直接感兴趣的包上,点击M键。这不会删除任何包,而是将每个包标记为“仅在此处,因为有些东西依赖于它”
现在一一浏览各个部分。大多数“仅作为依赖项”包将位于 libs 部分。
所有“-dev”包都可以标记为删除-如果-不需要-由
aptitude markauto ~i~n"\-dev$"
Run Code Online (Sandbox Code Playgroud)
可以使用以下命令清除整个类别(“CATEGORY_NAME”)
aptitude purge '~sCATEGORY_NAME ! ~exceptThisApp
Run Code Online (Sandbox Code Playgroud)