因此突然间任何 apt-get 命令都不再对我起作用了。例如,当我输入sudo apt-get upgrade
它时输出
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up snapd (2.32.3.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
Errors were encountered while processing:
snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
当我输入apt-get autoremove
sudo apt-get install -f
和大多数其他 apt-get 命令时,也会出现同样的问题。我到底能做什么,在网上找不到任何能帮助我的东西
所以在我尝试之后sudo apt install --reinstall snapd
它输出的是
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reinstallation of snapd is not possible, it cannot be downloaded.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up snapd (2.32.3.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
Errors were encountered while processing:
snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
还有其他解决方案吗?
答案1
添加exit 0
到/var/lib/dpkg/info/snapd.prerm
after #!/bin/sh
。然后执行:
dpkg --purge --force-all snapd
sudo apt-get update
看起来您使用了较旧的存储库进行安装snapd
,或者您以不干净的方式升级了 Ubuntu。因此,不要忘记检查您的sources.list
存储库是否无效。