我安装了一些snap软件包(`snap install ...`)。我可以使用`snap list`命令列出它们。然而,我无法区分哪些是手动安装的,哪些是因为其他软件包依赖而安装的(在apt中是`auto`)。我想要删除自动安装的软件包(在apt中是`apt autoremove`),(在docker中是`docker system prune`)。
user@~ $simplenote
ERROR: not connected to the gnome-3-28-1804 content interface.
snap connections | grep gnome
时,输出包括以下行:user@~ $snap connections | grep gnome
content[gnome-3-38-2004] firefox:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
content[gnome-3-28-1804] simplenote:gnome-3-28-1804 gnome-3-28-1804:gnome-3-28-1804 -
这表明仍有一些程序在使用Gnome 3.28和3.38版本,因此不应删除。
snap connections gnome-3-38-2004
)无需通过grep
进行管道传输也可以工作。 - antichrissnap connections
$ snap connections gnome-3-38-2004
Interface Plug Slot Notes
content[gnome-3-38-2004] firefox:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
content[gnome-3-38-2004] gimp:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
content[gnome-3-38-2004] snap-store:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
content[gnome-3-38-2004] snapd-desktop-integration:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
bare
和所有core
快照,如core18
,core20
等)。#!/bin/bash
list_connected_snaps_sorted() {
snap connections \
| tail -n +2 \
| awk '{print $1}' \
| sort \
| uniq
}
list_all_snaps_sorted() {
snap list \
| tail -n +2 \
| awk '{print $1}' \
| sort
}
echo "Unconneted snaps:"
(
diff -U0 -u \
<(list_connected_snaps_sorted) \
<(list_all_snaps_sorted) \
) \
| grep '^+' \
| tail -n +2 \
| cut -c2-
snap remove <snap name>
snap install firefox
snap remove core20
snap 正在被 Firefox 使用
。snap install firefox
snap connections | grep gtk-common-themes
snap remove gtk-common-themes
snap remove
在移除依赖时不会出错,只有在尝试移除基本的snap时才会出错。连接就是snap的依赖关系,如果连接断开,snap将无法运行,这一点并不“软性”。如果你没有从控制台尝试启动这样一个损坏的GUI snap,你甚至看不到为什么什么都没有发生的错误消息。 - antichris