运行 apt-get update 后出现“KeyError: 'non-free-firmware'”

运行 apt-get update 后出现“KeyError: 'non-free-firmware'”

使用以下命令运行更新:

apt-get update

返回:

Hit:1 http://kali.download/kali kali-rolling InRelease
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 27, in <module>
    col.create(db)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 95, in create
    self._fill_commands(con)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 143, in _fill_commands
    self._parse_single_contents_file(con, f, fp.stdout)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 282, in _parse_single_contents_file
    priority = component_priorities[component]
KeyError: 'non-free-firmware'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'

有人可以解释一下回溯吗?

答案1

Kali 有一个新部分,non-free-firmware但你的版本command-not-found不知道它(它是在23.04.0版本中添加)。

要解决此问题,请禁用该挂钩:

sudo mv /etc/apt/apt.conf.d/50command-not-found{,.disabled}

然后你就可以apt update像平常一样跑步了。一旦您有了固定版本的command-not-found,请重新启用该挂钩:

sudo mv /etc/apt/apt.conf.d/50command-not-found{.disabled,}

答案2

在 /etc/apt/sources.list 中使用 nano 并添加 'debhttp://http.kali.org/kalikali-last-snapshot 主要贡献在“deb”之后非自由http://http.kali.org/kalikali-rolling 主要贡献非免费'。注释这两行,保存并尝试再次更新。祝你好运。

相关内容