这可能是一个可能的错误,但它已经困扰我几天了。
apt-get upgrade
和之间的区别apt-get dist-upgrade
现在是众所周知和公认的,即升级安装/升级而dist-upgrade
能够安装/删除/升级如果软件包删除恰好是安装或升级另一个软件包所必需的。可以通过以下方式轻松发现包中的差异
(以下是一种快速而肮脏的方法,需要在终端中输入 sudo 密码才能进行复制粘贴。另外,由于我有几个包和驱动程序,我自己修补了一些需要保留的功能,因此我将 OR 包含在仅提取要安装和要升级的awk
那些,而不是列出要保留的那些,但是即使apt upgrade
输出中不存在这些行,以下内容也应该起作用):
$echo -e 'n' | sudo apt-get dist-upgrade | awk '
/be installed|be upgraded/{f=1;next}; /not upgraded|kept back/{f=0}f' | awk '
BEGIN {RS=" ";} {print $0}
' | grep . > apt_get_dist_list
$echo -e 'n' | sudo apt-get upgrade | awk '
/be installed|be upgraded/{f=1;next}; /not upgraded|kept back/{f=0}f' | awk '
BEGIN {RS=" ";} {print $0}
' | grep . > apt_get_upgrade_list
当我将两个输出与:
$diff apt_get_dist_list apt_get_upgrade_list | grep -E '<|>'
就我而言,我得到以下信息:
< gir1.2-nm-1.0
< libcpupower2
< linux-kbuild-5.2
< blueman
< linux-cpupower
< linux-headers-amd64
< linux-image-amd64
< pdf-parser
这使得差异非常明显,特别是考虑到linux-header-*
和linux-image-*
apt-get dist-upgrade
现在,如果我重复相同的apt upgrade
过程apt full-upgrade
$echo -e 'n' | sudo apt upgrade | awk '
/be installed|be upgraded/{f=1;next}; /not upgraded|kept back/{f=0}f' | awk '
BEGIN {RS=" ";} {print $0}
' | grep . > apt_upgrade_list
$echo -e 'n' | sudo apt full-upgrade | awk '
/be installed|be upgraded/{f=1;next}; /not upgraded|kept back/{f=0}f' | awk '
BEGIN {RS=" ";} {print $0}
' | grep . > apt_fullupgrade_list
并比较:
$diff apt_get_dist_list apt_fullupgrade_list | grep -E '<|>'
正如预期的那样,我一无所获,因为apt full-upgrade
并且apt-get dist-upgrade
旨在以相同的方式表现,但是当我比较时:
$diff apt_get_upgrade_list apt_upgrade_list | grep -E '<|>'
我得到与比较时相同的输出apt-get upgrade with apt-get dist-upgrade
。
> gir1.2-nm-1.0
> libcpupower2
> linux-kbuild-5.2
> blueman
> linux-cpupower
> linux-headers-amd64
> linux-image-amd64
> pdf-parser
我能得出的唯一结论是 that apt upgrade
is exactly the same as apt full-upgrade
which also make it as 相同apt-get dist-upgrade
,这最终意味着不仅是apt upgrade
多余的,而且更令人担忧的是目前apt
不允许相同的行为作为apt-get upgrade
.
它们不是多余的;还有一个额外的微妙之处:
apt-get upgrade
只会升级当前安装的包;apt upgrade
将升级当前安装的包并安装由更新的依赖项引入的新包;dist-upgrade
和full-upgrade
变体将升级当前安装的包,安装作为依赖项引入的新包,并删除被升级包破坏的包。换一种方式:
apt-get upgrade
apt upgrade
apt-get dist-upgrade
等apt full-upgrade
。实际上,
apt upgrade
它比apt-get upgrade
(默认情况下)更安全,因为它允许在 ABI 更改时自动安装更新的内核。请参阅apt-get upgrade 阻止内核更新。在 Debian 9 上应用更新的官方说明是什么?例如。apt-get upgrade
可以被告知行为apt upgrade
与--with-new-pkgs
选项相同。这也可以使用 APT 配置文件进行配置;你可以看到apt
的具体设置apt-config dump | grep '^Binary::apt
(这里涉及的设置是APT::Get::Upgrade-Allow-New
)。