今天在安装 ubuntu 18 时 遇到了证书过期导致 sudo apt-get update
在执行过后遇到
Certificate verification failed: The certificate is NOT trusted.
…
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
** Certificate verification failed: The certificate is NOT trusted.** 是认证过期
date
查看当前日期是否有问题
cp /usr/share/zoneinfo/UTC /etc/localtime
复制UTC时间到 /etc/localtime
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
创建软连接 /etc/localtime
执行
timedatectl
时区已经更改成功
再次执行 sudo apt-get update 证书过期问题解决 但是还存在以下报错
好吧接着解决GLib-ERROR **: 03:24:54.619: g_variant_new_parsed: 11-13:invalid GVariant format string
这个报错
切换到
cd /var/lib/dpkg/updates
这个文件夹下将文件夹下面所有的文件删除
rm -r ./*
再次执行 sudo apt-get update
错误更换成了
哭死,接着解决
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
当执行sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb
代码时
报了一个 dpkg: error: dpkg status database is locked by another process
错误
使用下面三个命令即可解决
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/cache/apt/archives/lock
之后再次执行sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb
以及sudo apt-get update
就会发现错误便只剩下
好了好了,只剩下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'
这个报错
执行一下代码
sudo apt --fix-broken install
sudo apt-get install appstream
sudo apt-get install libappstream4
ok ,最后执行 sudo apt update
发现便没有报错了
有的时候一个问题会引发多个问题 头秃头秃