Ubuntu 执行sudo apt-get update 出现错误 E:Sub-process returned an error code 的解决方法

ubuntu 在执行:

sduo apt-get update

出现如下错误:

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

此时可以利用以下解决方法:

sudo pkill -KILL appstreamcli
wget -P /tmp https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb
sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb

执行完成之后,应该就可以解决问题了。