有清理系统的软件吗

问题是,我这儿只检测出 vbox,你那儿也差不多。。而这个我知道是用来干嘛的。。

而关于这个,

我感觉到的是 linux 用着用着会周期性的变慢,就一段时间感觉系统反应会变慢,但在没做什么的情况下,再过一段时间又变好了。。

有可能,上一周我的虚拟机里面的 13.1RC 有点慢,现在又很快了。 但是我倒是以前也没有碰到过类似情况。 Windows 和 Mac 越用越慢是毫不奇怪的。 Linux 我还没有什么感觉。。 虽然 Linux 是我使用时间最长的系统。

为什么要除去一些库,我想说的孤立软件包便是这些库。。我觉得系统用久了难免会出现一些不被其它软件包所依赖的库,尽管从系统整体上来看没有依赖性的问题,软件包管理器只会去检测是否有依赖性的问题而导致某些功能不能使用,而不会去管这些孤立的,据我所知就是当卸载一些软件包时包管理器不会移除那些在安装该软件包时同时安装的依赖性软件包,所以。。虽然不除去这些“孤立”的库对系统运行没什么影响,但强迫症的心理要求这我找出来看看吧!所以才会问这样的问题。。

不知道前面的叙述有没有错误,我是这样理解的,有错误请指出来。。

Linux 都怕这个。 那么 Windows 和 Mac 就不用活了吧。。 这两个都会留一堆垃圾的。

我本来以为我已经属于洁癖很重的人了,结果还有更洁癖的。 我一般就是希望所有包都在包管理器的管理下,不喜欢自己通过 make 或者 bin 文件来安装软件。

Debian 的 apt 有 一个 autoremove 选项。 就可以清除孤立包。 很强力,经常清除一大堆包。

Mandriva/Magiea 的 urpmi 也有这个功能的。

但是我建议不要滥用。因为他们有时候会把你正在使用的软件给当成孤立包删除的。 只要一个包现在不被依赖了,都有可能被当作孤立软件包的。 比如说以前你安装了一个包,依赖 firefox。 你把这个包卸载了,那么包管理器就可能把 firefox 给你误判成孤立包给删除掉了。 所以说千万不要滥用这个玩意儿。 我这次 Debian 下面 XFCE 迁移回 KDE,卸载 XFCE 之后 Libreoffice 就被当成了孤立包。 我运行 autoremove 之后一看到 libreoffice 也被当作了孤立包,只好赶紧打住。 然后 apt-get install libreoffice 把 libreoffice 设置为自己要安装的包,再运行 autoremove 的。

以前用 Mandriva 我也记得有过类似的事情发生过。

我测试了一下“孤立软件包”,在 openSUSE 里删除了 asciidoc 和 kile 这两个依赖 texlive 的包,结果 texlive 并没有出现在孤立包当中。 但是问题是,系统怎么知道我的 texlive 是自己要使用的,还是仅仅作为 asciidoc 与 kile 依赖而安装的呢? 这也是各类 autoremove 工具可能很难解决的一个问题。 我估计我的 Debian 把 Libreoffice 判断为孤立包就是类似的情况了。

/etc/zypp/zypp.conf里面有这么一段内容:

##
## EXPERTS ONLY: Cleanup when deleting packages. Whether the solver should
## per default try to remove packages exclusively required by the ones he's
## asked to delete.
##
## This option should be used on a case by case basis, enabled via
## command line options or switches the applications offer. Changing
## the global default on a system where unattended actions are performed,
## may easily damage your system.
##
## CHANGING THE DEFAULT IS NOT RECOMMENDED.
##
## Valid values:  boolean
## Default value: false
##
# solver.cleandepsOnRemove = false

上面的内容是是否在删除一个包的时候清理系统。 如果选择为true,就会在删除一个包的时候同时删除系统中仅仅被该包所依赖的包。 如果选择否,则不会删除这些仅仅被要删除的包所以来的包。

说明中很明确的说了“只适合expert用户”、“滥用、变更global value可能导致系统损坏”

另外我运行了 zypper help rm

获得了如下信息:

zypper help rm
remove (rm) 选项] <功能> ...

移除具有指定功能的软件包。功能的定义为"名称.架构]操作符 <版本>]",操作符为 <, <=, =, >=, > 其中之一。

  命令选项
-r, --repo <别名|#|URI>       仅加载指定软件源。
-t, --type <类型>               软件包类型 (package, patch, pattern, product)。
                                默认: package。
-n, --name                      通过名称选择软件包,而不是功能。
-C, --capability                 通过功能选择软件包。
    --debug-solver             创建依赖关系解决器试例以供调试。
-R, --no-force-resolution       不强制解决依赖关系,允许提问。
    --force-resolution          强制解决依赖关系 (即使方案很激进)。
-u, --clean-deps               自动移除不需要的依赖关系。
-U, --no-clean-deps           不自动移除不需要的依赖关系。
-D, --dry-run                   测试移除,并不真正移除。

在删除一个软件包的时候可以选择 --clean-deps ( -U )
PS: 我试验了一下 zypper rm -U asciidoc kile kile-lang
仍然只建议移除这三个软件包,不移除texlive

我怀疑可能我的电脑里还有别的以来texlive的包。 于是我现在正在安装 lyx, 安装lyx的时候又安装了60多个依赖。 这回可以测试测试到底有没有效果了。

更新:我彻底犯傻了,是 -u 被我打成 -U了。 怪不得。 确实如果用 zypper -u asciidoc kile kile-lang 的话,我会得到:

sudo zypper rm -u asciidoc kile kile-lang
正在加载软件源数据...
正在读取已安装的软件包...
正在解决软件包依赖关系...

将移除以下软件包:
  asciidoc dblatex docbook_4 docbook-xsl-stylesheets guile1 iso_ent kile kile-lang latex2html 
  latex2html-pngicons libguile17 libguilereadline-v-17-17 libguile-srfi-srfi-13-14-v-3-3 
  libguile-srfi-srfi-1-v-3-3 libguile-srfi-srfi-4-v-3-3 libguile-srfi-srfi-60-v-2-2 libxml2-tools 
  libxslt-tools lilypond lilypond-century-schoolbook-l-fonts lilypond-emmentaler-fonts lilypond-fonts-common 
  sgml-skel texlive-appendix texlive-appendix-doc texlive-attachfile texlive-attachfile-doc texlive-changebar 
  texlive-changebar-doc texlive-eepic texlive-eepic-doc texlive-overpic texlive-overpic-doc xmlcharent 

34 个软件包将移除.
操作完成后,将释放 71.6 MiB 空间。
继续吗? [y/n/? 显示全部选项] (y): n

如果输入 zypper rm asciidoc kile kile-lang

sudo zypper rm asciidoc kile kile-lang
正在加载软件源数据...
正在读取已安装的软件包...
正在解决软件包依赖关系...

将移除以下软件包:
  asciidoc kile kile-lang 

3 个软件包将移除.
操作完成后,将释放 14.5 MiB 空间。
继续吗? [y/n/? 显示全部选项] (y): n

还是有效果的。 但是必须看清楚了自动移除的包,才能下手。


×××××××××××××××××××

安装lyx:

sudo zypper install lyx
正在加载软件源数据...
正在读取已安装的软件包...
正在解决软件包依赖关系...

将安装以下新软件包:
  clisp ffcall libpq5 lyx texlive-algorithms texlive-algorithms-doc texlive-arabi texlive-arabi-doc 
  texlive-arabi-fonts texlive-bezos texlive-bezos-doc texlive-braille texlive-braille-doc texlive-braket 
  texlive-braket-doc texlive-collection-htmlxml texlive-covington texlive-covington-doc texlive-diagbox 
  texlive-diagbox-doc texlive-endnotes texlive-endnotes-doc texlive-esint texlive-esint-doc texlive-fragments 
  texlive-fragments-doc texlive-ifsym texlive-ifsym-doc texlive-jadetex texlive-jadetex-bin 
  texlive-jadetex-doc texlive-mathdots texlive-mathdots-doc texlive-mhchem texlive-mhchem-doc texlive-nomencl 
  texlive-nomencl-doc texlive-picinpar texlive-picinpar-doc texlive-pict2e texlive-pict2e-doc 
  texlive-prettyref texlive-prettyref-doc texlive-refstyle texlive-refstyle-doc texlive-rotfloat 
  texlive-rotfloat-doc texlive-sidecap texlive-sidecap-doc texlive-splitindex texlive-splitindex-bin 
  texlive-splitindex-doc texlive-textgreek texlive-textgreek-doc texlive-units texlive-units-doc 
  texlive-wrapfig texlive-wrapfig-doc texlive-xmltex texlive-xmltex-bin texlive-xmltex-doc texlive-zhmetrics 
  texlive-zhmetrics-doc xindy xindy-rules 

自动选中了以下推荐软件包:
  texlive-algorithms-doc texlive-arabi-doc texlive-bezos-doc texlive-braille-doc texlive-braket-doc 
  texlive-covington-doc texlive-diagbox-doc texlive-endnotes-doc texlive-esint-doc texlive-fragments-doc 
  texlive-ifsym-doc texlive-jadetex-doc texlive-mathdots-doc texlive-mhchem-doc texlive-nomencl-doc 
  texlive-picinpar-doc texlive-pict2e-doc texlive-prettyref-doc texlive-refstyle-doc texlive-rotfloat-doc 
  texlive-sidecap-doc texlive-splitindex-doc texlive-textgreek-doc texlive-units-doc texlive-wrapfig-doc 
  texlive-xmltex-doc texlive-zhmetrics-doc 

建议以下软件包,但不会安装:
  texlive-biber 

65 个软件包将新装.
总下载大小:28.9 MiB 。 操作完成后,将占用额外的 115.1 MiB 空间。
继续吗? [y/n/? 显示全部选项] (y): y
正在撷取

zypper rm lyx:

sudo zypper rm lyx
正在加载软件源数据...
正在读取已安装的软件包...
正在解决软件包依赖关系...

将移除以下软件包:
  lyx 

1 个软件包将移除.
操作完成后,将释放 47.0 MiB 空间。
继续吗? [y/n/? 显示全部选项] (y): n

zypper rm -u lyx:

sudo zypper rm -u lyx
正在加载软件源数据...
正在读取已安装的软件包...
正在解决软件包依赖关系...

将移除以下软件包:
  clisp ffcall libpq5 lyx texlive-algorithms texlive-algorithms-doc texlive-arabi texlive-arabi-doc 
  texlive-arabi-fonts texlive-bezos texlive-bezos-doc texlive-braille texlive-braille-doc texlive-braket 
  texlive-braket-doc texlive-collection-htmlxml texlive-covington texlive-covington-doc texlive-diagbox 
  texlive-diagbox-doc texlive-endnotes texlive-endnotes-doc texlive-esint texlive-esint-doc texlive-fragments 
  texlive-fragments-doc texlive-ifsym texlive-ifsym-doc texlive-jadetex texlive-jadetex-bin 
  texlive-jadetex-doc texlive-mathdots texlive-mathdots-doc texlive-mhchem texlive-mhchem-doc texlive-nomencl 
  texlive-nomencl-doc texlive-picinpar texlive-picinpar-doc texlive-pict2e texlive-pict2e-doc 
  texlive-prettyref texlive-prettyref-doc texlive-refstyle texlive-refstyle-doc texlive-rotfloat 
  texlive-rotfloat-doc texlive-sidecap texlive-sidecap-doc texlive-splitindex texlive-splitindex-bin 
  texlive-splitindex-doc texlive-textgreek texlive-textgreek-doc texlive-units texlive-units-doc 
  texlive-wrapfig texlive-wrapfig-doc texlive-xmltex texlive-xmltex-bin texlive-xmltex-doc texlive-zhmetrics 
  texlive-zhmetrics-doc xindy xindy-rules 

65 个软件包将移除.
操作完成后,将释放 115.1 MiB 空间。
继续吗? [y/n/? 显示全部选项] (y): y
( 1/65) 正在移除

可以看出来使用 -u 选项确实可以移除掉依赖于当前要删除的包的库。

但是我的观点仍然是:谨慎使用。 必须仔细看一遍移除的包的内容再移除。

同时最好不要在zypp.conf中进行全局设置。 如果你足够大胆,可以全局设置,但是不排出某一天你发现libreoffice或者firefox消失了,或者不排出系统崩溃了。。

2赞

@奇瑞艾瑞泽

  1. 原来不移除依赖是默认设置啊!想要移除的话还是可以的,只是比较危险。。
  2. 又知道几个好用的软件包了,lyx,kile 啥啥的。。
  3. 你可以上知乎去回答问题了!
  4. 今天状态不对,暂时没想到还要回复什么。。

YaST 确实是大杀器来的 zh.opensuse.org/index.php?title=File:YaST_autoremove_dependencies.png&variant=zh-cn ,和命令行是一个效果

在 Debian 下面默认也是不移除的。 但是删除软件之后会提示有孤立软件包,可以用 autoremove 删除。

你如果想删除就在卸载软件的时候用 -u 好了

其实最有用的是 asciidoc,比 markdown 强太多了。 可惜到处都是 markdown。 自从我用惯了 asciidoc 再也用不了 markdown 了。 另外还有个 pandoc,debian 有,opensuse 官方源没有的。 是强力的文本转换利器。

实际上有了 asciidoc,可以用 asciidoc 来写,然后用 asciidoc 把文档转化成 tex 再处理就行了。 所以说一定程度上来说 lyx 和 kile 这些 tex 利器可以用 asciidoc 来替代掉大部分功能了。