appstream E: 问题执行脚本 APT Update::Post 调用成功时调用成功错误

分享于 

7分钟阅读

ubuntu

  繁體

问题

我无法安装软件包,运行命令apt-get update,但它抛出一些错误:


$ sudo apt-get update


Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB] 


Hit:2 http://ve.archive.ubuntu.com/ubuntu xenial InRelease 


Hit:3 http://ve.archive.ubuntu.com/ubuntu xenial-updates InRelease 


Hit:4 http://ve.archive.ubuntu.com/ubuntu xenial-backports InRelease 


Fetched 102 kB in 23s (4337 B/s) 


*** Error in `appstreamcli': double free or corruption (fasttop): 0x000000000210f4b0 ***


======= Backtrace: =========


/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fac8d8317e5]


[...]


Aborted (core dumped)


Reading package lists... Done


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 > /dev/null; fi'


E: Sub-process returned an error code




答案1


sudo apt-get purge libappstream3




答案2

删除apt.conf.d条目为我解决了这个问题。


Friday 25 August 22:17:45 AEST 2017


LSB Version: core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:printing-9.20160110ubuntu0.2-amd64:printing-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch


 Distributor ID: Ubuntu


 Description: Ubuntu 16.04.3 LTS


 Release: 16.04


 Codename: xenial



我运行以下命令来消除错误:


sudo apt-get purge libappstream2


sudo rm /etc/apt/apt.conf.d/50appstream




答案3


sudo apt install appstream/xenial-backports


sudo rm /etc/apt/apt.conf.d/50appstream


sudo rm /var/cache/app-info/xmls/fwupd.xml


sudo apt install --reinstall libappstream4


sudo appstreamcli refresh --force


sudo reboot




sudo appstreamcli refresh --force




答案4

从16.04 LTS升级到18.04.1 LTS后,我遇到了这个问题,初始错误消息是:


AppStream system cache was updated, but problems were found: Metadata files have errors: /var/cache/app-info/xmls/fwupd.xml



以下是我修复它的方法:


$ sudo rm /var/cache/app-info/xmls/fwupd.xml


$ sudo appstreamcli refresh --force



导致此终端消息:


AppStream cache update completed successfully.



然后,sudo apt-get updatesudo apt-get upgrade完美地工作。


答案5






$ sudo apt-get update


[sudo] password for XXX: 


...



AppStream system cache was updated, but problems were found: Metadata files have errors: /var/cache/app-info/xmls/fwupd.xml


Reading package lists... Done


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



$ sudo appstreamcli --version


AppStream CLI tool version: 0.10.6



$ sudo appstreamcli refresh-cache --force --verbose


** (appstreamcli:15334): DEBUG: Added /usr/share/app-info/xmls to metadata search path.


** (appstreamcli:15334): DEBUG: Added /var/lib/app-info/yaml to metadata search path.


** (appstreamcli:15334): DEBUG: Added /var/cache/app-info/xmls to metadata search path.


** (appstreamcli:15334): DEBUG: Refreshing AppStream cache


** (appstreamcli:15334): DEBUG: Searching for data in: /usr/share/app-info/xmls


** (appstreamcli:15334): DEBUG: Searching for data in: /var/cache/app-info/xmls


** (appstreamcli:15334): DEBUG: Searching for data in: /var/lib/app-info/yaml


** (appstreamcli:15334): DEBUG: Reading: /usr/share/app-info/xmls/org.freedesktop.fwupd.xml


** (appstreamcli:15334): DEBUG: Reading: /var/cache/app-info/xmls/fwupd.xml


** (appstreamcli:15334): DEBUG: WARNING: Could not parse XML data: Entity: line 265: parser error : EntityRef: expecting ';'


 <checksum filename="Firmware_SF30&SN30_Pro_V1.26.dat" target="content" t


 ^


...




修复是:






$ sudo -i



# cd /var/cache/app-info/xmls/



# ls -l


total 236


drwxr-xr-x 2 root root 4096 jul 27 09:56 ./


drwxr-xr-x 5 root root 4096 aug 31 2017 ../


-rw-r--r-- 1 root root 233177 jun 29 16:02 fwupd.xml



# sed < fwupd.xml -rne 's/Firmware_SF30&SN30_Pro_V1.26.dat/Firmware_SF30&SN30_Pro_V1.26.dat/gp'


 <checksum filename="Firmware_SF30&SN30_Pro_V1.26.dat" target="content" type="sha1">3ef2bdee8aca2a45b9f53b4d4cce9722523f57f8</checksum>



# sed fwupd.xml -i_BACKUP -re 's/Firmware_SF30&SN30_Pro_V1.26.dat/Firmware_SF30&SN30_Pro_V1.26.dat/gp'



# ls -l


total 464


drwxr-xr-x 2 root root 4096 jul 27 09:57 ./


drwxr-xr-x 5 root root 4096 aug 31 2017 ../


-rw-r--r-- 1 root root 233328 jul 27 09:57 fwupd.xml


-rw-r--r-- 1 root root 233177 jun 29 16:02 fwupd.xml_BACKUP



# rm fwupd.xml_BACKUP



# apt-get update


Hit:1 http://se.archive.ubuntu.com/ubuntu xenial InRelease


...


Fetched 491 kB in 0s (715 kB/s) 


Reading package lists... Done



# exit


logout



$




注:https://github.com/hughsie/lvfs-website/issues/33



scripts  EXE  GET  EXEC  APT  Success