分心升级似乎造成了一个问题

如果我没记错的话,我使用了sudo apt-get dist-upgrade ,但我取消了之间的过程。 我收到了一个(Y/N)提示,要求升级到最后并键入N.

在此之后,我在运行apt-get update时遇到了一些类似的问题

有趣的是,我实际上是在运行16.04。

 Distributor ID: Ubuntu Description: Ubuntu 16.04.4 LTS Release: 16.04 Codename: xenial 

但不知何故apt-get寻找artful包而不是xenial包。

 Get:25 http://archive.ubuntu.com/ubuntu artful-updates/multiverse amd64 DEP-11 Metadata [2,468 B] Get:26 http://archive.ubuntu.com/ubuntu artful-backports/universe amd64 DEP-11 Metadata [5,088 B] Fetched 1,592 kB in 5s (283 kB/s) (appstreamcli:8437): GLib-CRITICAL **: g_strchug: assertion 'string != NULL' failed (appstreamcli:8437): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed 

编辑:这是我的/etc/apt/sources.list看起来的样子

搞砸了/apt/sources.list

我到处都用xenial替换了艺术,这个问题似乎已经解决了。

在Ubuntu 16.04克隆分区上运行sudo do-release-upgrade -d之后我遇到了同样的问题。 目的是测试升级到18.04.1错误,但系统停止了消息:

 To continue please press [ENTER] Inhibiting until Ctrl+C is pressed... 

所以我按下Ctrl + C并返回命令提示符。

接下来我跑了:

 $ sudo apt update Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease Hit:2 http://ca.archive.ubuntu.com/ubuntu bionic InRelease Hit:3 http://ca.archive.ubuntu.com/ubuntu bionic-updates InRelease Hit:4 http://ca.archive.ubuntu.com/ubuntu bionic-backports InRelease (appstreamcli:15814): GLib-CRITICAL **: g_strchug: assertion 'string != NULL' failed (appstreamcli:15814): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed (appstreamcli:15814): GLib-CRITICAL **: g_strchug: assertion 'string != NULL' failed (appstreamcli:15814): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed AppStream cache update completed, but some metadata was ignored due to errors. Reading package lists... Done Building dependency tree Reading state information... Done 1675 packages can be upgraded. Run 'apt list --upgradable' to see them. 

基于以上评论加上此答案: 在执行释放升级期间按Ctrl + c。 我打破了吗? 我用了:

 sudo sed -i -e 's/bionic/xenial/g' /etc/apt/sources.list 

现在sudo apt update正常完成。

升级问题

现在,当我运行do-release-upgrade -d并密切关注时,我注意到中间的这些行:

 Get:57 http://ca.archive.ubuntu.com/ubuntu bionic-backports/universe DEP-11 64x64 Icons [1,789 B] Fetched 44.8 MB in 6s (4,884 kB/s) (appstreamcli:30117): GLib-CRITICAL **: g_strchug: assertion 'string != NULL' failed (appstreamcli:30117): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed (appstreamcli:30117): GLib-CRITICAL **: g_strchug: assertion 'string != NULL' failed (appstreamcli:30117): GLib-CRITICAL **: g_strchomp: assertion 'string != NULL' failed AppStream cache update completed, but some metadata was ignored due to errors. Checking package manager Reading package lists... Done 

我通过回答N提示来中止升级。

快速搜索导致此问答: E:在apt-get update期间执行脚本APT Update :: Post-Invoke-Success错误

我可以使用以下方法validation相同的情况

 $ sudo apt update Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease Hit:2 http://ca.archive.ubuntu.com/ubuntu xenial InRelease Hit:3 http://ca.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:4 http://ca.archive.ubuntu.com/ubuntu xenial-backports InRelease AppStream cache update completed, but some metadata was ignored due to errors. Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. 

链接中推荐的解决方案是使用:

 sudo apt-get purge libappstream3 

运行此元错误现在已经消失:

 $ sudo apt update Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease Hit:2 http://ca.archive.ubuntu.com/ubuntu xenial InRelease Hit:3 http://ca.archive.ubuntu.com/ubuntu xenial-updates InRelease Hit:4 http://ca.archive.ubuntu.com/ubuntu xenial-backports InRelease Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. 

下一步将是第三次运行sudo do-release-upgrade -d并交叉我的手指。

升级期间误导性消息

另一个用户有类似的问题: Ubuntu从16.04升级到18.04需要太长时间

结果两行消息同时出现:

 To continue please press [ENTER] Inhibiting until Ctrl+C is pressed... 

您认为升级被禁止,直到您按Ctrl + C,但它的真正含义是在您按Enter键之前不会启动升级。