如何修复 Snapd dpkg 错误?

如何修复 Snapd dpkg 错误?

当我在sudo apt-get update && sudo apt-get upgrade清晨为我的新内核执行此操作时4.4.0-131-generic,我收到了 snapd 错误。

Setting up snapd (2.34.2~14.04) ...  
Failed to enable unit: Unit file snapd.autoimport.service does not exist.
dpkg: error processing package snapd (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of snapd-xdg-open:
snapd-xdg-open depends on snapd (= 2.34.2~14.04); however:
Package snapd is not configured yet.

dpkg: error processing package snapd-xdg-open (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 snapd
 snapd-xdg-open
E: Sub-process /usr/bin/dpkg returned an error code (1)

我不知道该怎么做,我试过 sudo dpkg -a --configure && sudo apt purge snapd* && sudo apt-get remove snapd*

这对我来说没有解决!!我还尝试清除 Ubuntu 上的所有缓存并重新安装 snapd,但还是没有解决。

答案1

为了解决这个问题,

第一步
使用以下方法检查所有包源:

rgrep 'xenial' /etc/apt

因为我用的是 trusty 而不是 xenial,所以我删除了所有 snapd* 的源

sudo add-apt-repository -r 'deb [some link xenial] xenial Release or inRelease'

下一步

我可以清除并删除 snapd 来解决这个问题。

dpkg --purge --force-all snapd
sudo apt install --fix-broken

运行sudo apt-get update,更新后它对我来说已经解决了。

相关内容