我尝试运行该命令,sudo apt-get update
但它显示了以下错误。
E: Failed to stat /var/lib/apt/lists/partial/packages.microsoft.com_repos_vscode_dists_stable_InRelease - pkgAcqTransactionItem::TransactionState-stat (2: No such file or directory)
E: Failed to stat /var/lib/apt/lists/partial/packages.microsoft.com_repos_vscode_dists_stable_main_binary-amd64_Packages - pkgAcqTransactionItem::TransactionState-stat (2: No such file or directory)
W: Duplicate sources.list entry http://packages.microsoft.com/repos/vscode stable Release
如何解决这个错误?
内容 /etc/apt/sources.list
# deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ x$
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://in.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial universe
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://in.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
# deb-src [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
答案1
根据此链接,解决这个问题:
- 从 /var/lib/apt/lists/partial 中删除所有内容 (
sudo rm /var/lib/apt/lists/partial/*
) - 卸载 vscode (
sudo apt purge vscode
) - 运行更新
sudo apt update
- 再次安装 vscode,方法是:
从以下位置下载 .deb 包此链接...
通过运行转到下载文件夹cd ~/Downloads
...
通过运行安装包:(sudo dpkg -i code_1.41.1-1576681836_amd64.deb
文件名可能会根据版本号而更改)。
要删除重复的警告:
1-运行2-注释掉有 3-保存并退出的sudo gedit /etc/apt/sources.list
行http://packages.microsoft.com/repos/vscode stable Release
答案2
我尝试了很多建议,但以下解决方案对我有效。
sudo rm -rf /etc/apt/sources.list.d/vscode.list*
sudo apt-get update
希望这对有类似问题的人有帮助。
答案3
步骤 1:按下ctrl alt t打开terminal
第 2 步:运行命令
sudo apt clean
步骤 3:更新软件包列表
sudo apt update
步骤 4:删除所有文件/var/lib/apt/lists/partial
(如果存在)
sudo rm /var/lib/apt/lists/partial/*
步骤 5:删除/etc/apt/sources.list
deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
# deb-src [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
步骤 6:vscode
从此链接下载软件包https://go.microsoft.com/fwlink/?LinkID=760868
步骤 7:cd
进入文件下载的目录(可能Downloads
),运行命令
sudo dpkg -i *.deb