运行apt update时appstreamcli的问题

Jon*_*ord 12 debian apt upgrade

我今天在运行 apt 更新时遇到了 debian 测试问题,返回如下:

E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi'
E: Sub-process returned an error code
Run Code Online (Sandbox Code Playgroud)

Jon*_*ord 16

谷歌搜索后,我发现有人说删除包 appstream 将解决问题。

此解决方案将起作用,但在许多情况下,此方法将删除您可能不想删除的包。

另一种解决方案是注释/etc/apt/apt.conf.d/50appstream文件中的最后三行,如下所示:

...
#APT::Update::Post-Invoke-Success {
#    "if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null | true; fi";
#};
Run Code Online (Sandbox Code Playgroud)

然后保存文件并apt-get update再次运行。

运行系统升级后,包 appstream 有可能进行升级以修复此错误,并且可能会出现如下消息:

Configuration file '/etc/apt/apt.conf.d/50appstream'
  ==> Modified (by yourself or by a script) since the installation.
  ==> The package distributor has released an updated version.
    What do you want to do? Your options are:
     Y or I: install the version of the maintainer package
     N or O: keep the currently installed version
       D: Show differences between versions
       Z: start a shell to examine the situation
Run Code Online (Sandbox Code Playgroud)

你应该说 Y 来升级你修改过的文件。

我发布此信息是为了帮助可能搜索此错误的其他人。