当软件包是最新版本时,如何阻止 apt 报告软件包可升级?

当软件包是最新版本时,如何阻止 apt 报告软件包可升级?

我正在运行 Pop!_OS 18.04,并且已经通过 安装了 Microsoft VS Code apt。现在我看到有可用的升级,但没有。

$ sudo apt list --upgradable                   
Listing... Done
code/bionic 1.27.2-1536736588 amd64 [upgradable from: 1.27.2-1536736588]
N: There are 45 additional versions. Please use the '-a' switch to see them.
$ sudo apt-get upgrade                         
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  code
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/45.4 MB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
(Reading database ... 422930 files and directories currently installed.)
Preparing to unpack .../code_1.27.2-1536736588_amd64.deb ...
Unpacking code (1.27.2-1536736588) over (1.27.2-1536736588) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.1) ...
Setting up code (1.27.2-1536736588) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...
$ sudo apt list --upgradable
Listing... Done
code/bionic 1.27.2-1536736588 amd64 [upgradable from: 1.27.2-1536736588]
N: There are 45 additional versions. Please use the '-a' switch to see them.

我似乎陷入了无限循环。我怎样才能打破这个循环并告诉apt“不,真的,这个包没有新版本!”?

因为@Xen2050 问了....

这看起来好像没有安装“最新”版本,但我不知道如何安装它!

sudo apt-cache policy code                      
code:
  Installed: 1.27.2-1536736588
  Candidate: 1.27.2-1536736588
  Version table:
     1.27.2-1536736588 500
        500 http://apt.pop-os.org/proprietary bionic/main amd64 Packages
 *** 1.27.2-1536736588 500
        500 http://packages.microsoft.com/repos/vscode stable/main amd64 Packages
        100 /var/lib/dpkg/status
     1.27.1-1536226049 500
        500 http://packages.microsoft.com/repos/vscode stable/main amd64 Packages
     1.27.0-1536125615 500
        500 http://packages.microsoft.com/repos/vscode stable/main amd64 Packages
     [... dozens of older versions ...]
$ sudo apt-cache show code
Package: code
Architecture: amd64
Version: 1.27.2-1536736588
Priority: optional
Section: devel
Maintainer: Microsoft Corporation 
Installed-Size: 200215
Provides: visual-studio-code
Depends: libnotify4, libnss3 (>= 2:3.26), gnupg, apt, libxkbfile1, libgconf-2-4, libsecret-1-0, libgtk-3-0 (>= 3.10.0)
Conflicts: visual-studio-code
Origin: system76
Filename: pool/bionic/main/binary-amd64/c/code/code_1.27.2-1536736588_amd64.deb
Size: 45361876
Md5Sum: 56597e66d42240738e0f704d5682762b
SHA1: c990d18754012c9d666e519541349d6335938bd5
SHA256: bc5db10c45151cf45b435abbb481ff10bb20cb6ab7d7e1b068ab10448de1911f
SHA512: 6399a3a4acd2ea7943d53e7bfc06c277ad167810a8809992bd1f3cb5e8e01865830137cde54462f3b6af3ed79510aaaed4353dbfd9f89b7a92a327badd80b87e
Homepage: https://code.visualstudio.com/
Description: Code editing. Redefined.
 Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.
Description-md5: b38f8538d3cead7a194af6aeeaf02e6a

Package: code
Priority: optional
Section: devel
Installed-Size: 200215
Maintainer: Microsoft Corporation 
Architecture: amd64
Version: 1.27.2-1536736588
Replaces: visual-studio-code
Provides: visual-studio-code
Depends: libnotify4, libnss3 (>= 2:3.26), gnupg, apt, libxkbfile1, libgconf-2-4, libsecret-1-0, libgtk-3-0 (>= 3.10.0)
Conflicts: visual-studio-code
Filename: pool/main/c/code/code_1.27.2-1536736588_amd64.deb
Size: 45365022
MD5sum: e488406a124c3dd617b922be4c073e48
SHA1: 8c9b279ed949e0fae8bb736be2cee6c09f70f914
SHA256: 35aedf314a3d886e1affac8591904ba0b1ffb7e20075acabf7bfeec1fa2b6515
SHA512: 6956b09bbba360fc65ec4d50bf3a9539684f639695ccfa4761b9fd84755e6afeac8696a0f30d8664950310de019eb8d2b3d0e8613ebfed269c100e9520b16b4d
Description: Code editing. Redefined.
 Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.
Description-md5: b38f8538d3cead7a194af6aeeaf02e6a
Homepage: https://code.visualstudio.com/

[...dozens of older versions...]

答案1

修复了!事实证明我想法我已从中删除了对 Microsoft 存储库的所有引用/etc/apt,但我没有这么做。

$ cd /etc/apt
$ sudo rm trusted.gpg.d/microsoft*.gpg
$ sudo rm sources.list.d/vscode*
$ sudo rm /var/lib/dpkg/status

现在没有人提到微软版本的软件包。最后。现在,根据https://askubuntu.com/questions/527064/corrupt-dpkg-status-file我需要再生/var/lib/dpkg/status

$ sudo apt-get update
$ sudo apt-get dist-upgrade

现在,终于:

$ sudo apt list --upgradable   
Listing... Done
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

现在...有人可以添加一条评论:(1)这是什么意思?和/或(2)我可以用更少的潜在破坏性命令做同样的事情吗?

相关内容