Manjaro升级错误解决方法

Manjaro是非常优秀的Linux发行版,我用了这么久没过出大问题,更没有碰到过滚动升级发行版偶尔出现的升级后系统倒地不起的情况。但有时候系统升级会出点小问题,下面将我碰到的问题及其解决办法列出来。

最常见的升级错误是由软件版本依赖造成的。软件仓库中的版本更新后,问题可能就消失了,不着急的话可以等等。运行pacman -Qtdq命令可得到未被其他软件用到的包,如果是这些包的依赖关系导致升级失败,卸载它们即可解决问题。

我遇到过wxgtk2导致的升级失败问题,最后一行错误信息如下:

1
removing wxgtk-common breaks dependency 'wxgtk-common' required by wxgtk2

用如下名称查看wxgtk2是否被其他软件依赖,如果输出为空,就可以放心大胆地卸载它。

1
pacman -Qi wxgtk2 | grep 'Depends On'

类似地,libcanberra造成的版本依赖问题也可以通过卸载来解决,运行如下命令卸载libcanberra后再重新升级系统即可:

1
pacman -R lib32-libcanberra-pulse lib32-libcanberra-gstreamer libcanberra-pulse libcanberra-gstreamer

我还碰到过PGP key丢失导致升级失败,出错日志如下:

1
2
3
4
5
6
downloading required keys...
:: Import PGP key F9F9FA97A403F63E, "lilac (on behalf of edward) <edward@edward-p.xyz>"? [Y/n]
error: key "F9F9FA97A403F63E" could not be looked up remotely
error: required key missing from keyring
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.

安装archlinuxcn-keyring即可解决该问题。

还有个npm无法升级的问题,错误日志如下:

1
2
3
4
5
6
7
error: failed to commit transaction (conflicting files)
npm: /usr/lib/node_modules/npm/lib/utils/read-package-name.js exists in filesystem
......
...... many similar lines are ommitted
......
npm: /usr/lib/node_modules/npm/node_modules/negotiator/package.json exists in filesystem
Errors occurred, no packages were upgraded.

可通过以下命令强行安装:

1
sudo pacman -S npm --overwrite='*'

参考

  1. arch linux - List all packages that depend on a certain package with pacman - Unix & Linux Stack Exchange
  2. cannot upgrade - could not satisfy lib32 dependencies
  3. Update problem- libcanberra-gstreamer
  4. 使用pacman -s出现问题
  5. npm update error in arch #636