![Dist-upgrade 似乎造成了一个问题](https://linux22.com/image/1155939/Dist-upgrade%20%E4%BC%BC%E4%B9%8E%E9%80%A0%E6%88%90%E4%BA%86%E4%B8%80%E4%B8%AA%E9%97%AE%E9%A2%98.png)
如果我没记错的话,我使用了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
样子
我把所有地方的 artful 都替换成了 xenial,问题似乎已经解决了。
答案1
在 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.
根据以上评论加上这个答案:在 do-release-upgrade 过程中按 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 Update::Post-Invoke-Success 错误(apt-get update 期间)
我可以使用以下方法验证相同的情况:
$ 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。
叹