ubuntu@RHC-395:~$ sudo apt-get install snap
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
snapd : Depends: cgroup-lite but it is not going to be installed
Recommends: linux-generic-lts-xenial but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
ubuntu@RHC-395:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
snapd
The following packages will be upgraded:
snapd
1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B/13.2 MB of archives.
After this operation, 594 kB disk space will be freed.
`Do you want to continue? [Y/n] y`
(Reading database ... 334787 files and directories currently installed.)
Preparing to unpack .../snapd_2.42.1_amd64.deb ...
Failed to stop snapd.service: Unit snapd.service not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead ...
Failed to stop snapd.core-fixup.service: Unit snapd.core-fixup.service not loaded.
Failed to stop snapd.failure.service: Unit snapd.failure.service not loaded.
Failed to stop snapd.seeded.service: Unit snapd.seeded.service not loaded.
Failed to stop snapd.service: Unit snapd.service not loaded.
Failed to stop snapd.snap-repair.service: Unit snapd.snap-repair.service not loaded.
Failed to stop snapd.snap-repair.timer: Unit snapd.snap-repair.timer not loaded.
Failed to stop snapd.system-shutdown.service: Unit snapd.system-shutdown.service not loaded.
dpkg: error processing archive /var/cache/apt/archives/snapd_2.42.1_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 5
Errors were encountered while processing:
/var/cache/apt/archives/snapd_2.42.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
这看起来有点乱,但任何帮助都会很感激。我尝试了配置和几乎所有操作,但同样的循环不断重复。配置代码不起作用,其他一切都给出了关于 snapd 的输出。
答案1
我怀疑sudo service --status-all
可能会列出 snapd 实例。在这种情况下,使用 停止它sudo systemcl stop snapd
。要么是这个,要么是你在 dpkg 上设置了锁。您可以使用pgrep -f 'dpkg|apt
( 的后继ps afx|grep dpkg
) 检查后者,然后删除卡住用 锁sudo rm /var/lib/dpkg/lock
。