无法升级或修复(Kali)

无法升级或修复(Kali)
┌──(istiak㉿kali)-[~]
└─$ sudo apt-get upgrade
[sudo] password for istiak: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 nodejs : Depends: libnode72 (= 12.21.0~dfsg-1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

当我尝试修复时

┌──(istiak㉿kali)-[~]
└─$ sudo apt --fix-broken install                                                                                                                                  100 ⨯
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libjs-highlight.js nodejs-doc xdg-desktop-portal-gtk
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  nodejs
The following packages will be upgraded:
  nodejs
1 upgraded, 0 newly installed, 0 to remove and 56 not upgraded.
Need to get 0 B/24.6 MB of archives.
After this operation, 119 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 339678 files and directories currently installed.)
Preparing to unpack .../nodejs_14.16.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (14.16.1-deb-1nodesource1) over (12.21.0~dfsg-1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/doc/nodejs/api/cli.json.gz', which is also in package nodejs-doc 12.21.0~dfsg-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

当我安装 debian 软件包时。

┌──(istiak㉿kali)-[~]
└─$ sudo dpkg -i /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb
[sudo] password for istiak: 
(Reading database ... 339678 files and directories currently installed.)
Preparing to unpack .../nodejs_14.16.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (14.16.1-deb-1nodesource1) over (12.21.0~dfsg-1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb (--install):
 trying to overwrite '/usr/share/doc/nodejs/api/cli.json.gz', which is also in package nodejs-doc 12.21.0~dfsg-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Processing triggers for man-db (2.9.4-2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_14.16.1-deb-1nodesource1_amd64.deb

/etc/apt/

┌──(istiak㉿kali)-[/etc/apt]
└─$ ls
apt.conf.d   preferences.d  sources.list~   trusted.gpg
auth.conf.d  sources.list   sources.list.d  trusted.gpg.d

我没有找到任何叫sources.d.并且,sources.list.d是我拥有的目录google-chrome.list nodesource.list

sources.list:

# See https://www.kali.org/docs/general-use/kali-linux-sources-list-
repositories/
deb http://http.kali.org/kali kali-rolling main contrib non-free

# Additional line for source packages
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free

os-release:

┌──(istiak㉿kali)-[/etc/apt]
└─$ cat /etc/os-release      
PRETTY_NAME="Kali GNU/Linux Rolling"
NAME="Kali GNU/Linux"
ID=kali
VERSION="2021.1"
VERSION_ID="2021.1"
VERSION_CODENAME="kali-rolling"
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="https://www.kali.org/"
SUPPORT_URL="https://forums.kali.org/"
BUG_REPORT_URL="https://bugs.kali.org/"

我也尝试过 clean( sudo apt clean) 。我不知道现在该怎么办..?我npm因为这个原因无法安装。但是,我能够update正确地...您可能会注意到我正在使用 Kali。版本是2020.1。而且,我不是专家,也不是中级。我对Linux有一些想法。

我发现了一些与我的问题类似的问题,但没有答案对我有用。

  1. dpkg:处理存档时出错

  2. apt-get 升级期间处理包 mysql-community-server 时出错

  3. 处理时遇到错误:/var/cache/apt/archives/apport_2.20.1-0ubuntu2.6_all.deb

我正在读书文档。当我打印出来时:grep -v '#' /etc/apt/sources.list | sort -u.

我的输出确实匹配。

来自文档:

deb http://http.kali.org/kali kali-rolling main non-free contrib

我的输出(我之前也添加了它。我想我在阅读了 Unix SE 或 askubuntu 中的一些答案后更新了分支〜我实际上忘记了。):

deb http://http.kali.org/kali kali-rolling main contrib non-free

“我认为这可能不是问题”。

您进行了离线安装(例如在安装过程中缺少网络连接)。

您已切换分支。

使用不同的(硬编码的)镜像。

实际上,我在安装某些东西时多次失去网络连接。从该文档中,我还打印出了两个命令。

cat /etc/apt/sources.list

我之前也给出了它的输出。

sudo apt-cdrom add

实际上我没有任何 cdrom,这就是它返回错误的原因。

E: 挂载光驱失败。 E:使用默认安装点无法自动检测或找到CD-ROM。

答案1

从 中删除google-chrome.list和。如果你幸运的话,你没有破坏太多的 Kali 发行版,这两个命令会让你回到正确的轨道nodesource.list/etc/apt/sources.d

apt update
apt full-upgrade

有关上下文,请阅读 Kali 自己的文档:存储库特别是标题为“非 Kali 存储库”的部分,

[...]将其他操作系统的存储库添加到 Kali 中(例如尝试将 Ubuntu 放在 Kali 上)将会破坏您的安装。这是 Kali Linux 系统崩溃的最常见原因

答案2

我已经做了@roaima 说。尽管我面临着这个问题。然后,我直接再次尝试升级。

sudo apt-get upgrade or, sudo apt upgrade

但是,我遇到了错误。然后,我想以 root 用户身份运行这些命令(sudo su sudo也代表 root)。

sudo su
apt --fix-broken install
apt upgrade

现在,一切都在一步步升级。

相关内容