我的机器(Ubuntu 18.04)上有 Gnome 3.26、3.28 和 3.34,我想知道是否可以删除其中任何一个以节省磁盘空间。我可以运行某种snap命令来显示吗?
您可以使用下面的命令列出所有使用的插槽/插头。
snap connections
Run Code Online (Sandbox Code Playgroud)
或对于特定应用程序,例如:
$ snap connections snap-store
Interface Plug Slot Notes
appstream-metadata snap-store:appstream-metadata :appstream-metadata -
content[gnome-3-38-2004] snap-store:gnome-3-38-2004 gnome-3-38-2004:gnome-3-38-2004 -
content[gtk-3-themes] snap-store:gtk-3-themes gtk-common-themes:gtk-3-themes -
content[icon-themes] snap-store:icon-themes gtk-common-themes:icon-themes -
content[sound-themes] snap-store:sound-themes gtk-common-themes:sound-themes -
dbus - snap-store:packagekit-svc -
dbus - snap-store:snap-store -
desktop snap-store:desktop :desktop -
desktop-legacy snap-store:desktop-legacy :desktop-legacy -
...
Run Code Online (Sandbox Code Playgroud)
或者可能是反向搜索的最佳选择:
$ 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] 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
Run Code Online (Sandbox Code Playgroud)
可能值得添加,也可以通过界面搜索:
$ snap interface content | grep gnome
- firefox:gnome-3-38-2004
- snap-store:gnome-3-38-2004
- snapd-desktop-integration:gnome-3-38-2004
- gnome-3-38-2004:gnome-3-38-2004
Run Code Online (Sandbox Code Playgroud)
由于快照的客观性质。Snap 在受限环境中运行常规应用程序。因此,每个依赖于另一个应用程序的快照应用程序,其开发人员都必须声明“连接”(或者我们可以说插头插槽),mook765 的答案在这里已将其用于他的方法(snap.yaml包含依赖项声明)。连接的类型称为“接口” content[gnome-3-38-2004]。每个连接由(一个“插槽”连接到没有、一个或多个“插头”)组成。在这种情况下,插槽gnome-3-38-2004:gnome-3-38-2004由 gnome core snap 提供,应用程序声明并使用snap-store:gnome-3-38-2004该插槽的插件 ex: 。
阅读更多内容的一个很好的参考:snapcraft.io:gnome-3-38-extension - 插头
连接可以自动/手动连接或断开,这就是为什么我希望快照不会强制卸载依赖的应用程序。我在 Virtual-box 的 Ubuntu 22.04 中测试了它。Snap 断开插头/插槽,然后删除应用程序。该应用程序无论如何都无法运行。
$ snap remove gnome-3-38-2004
gnome-3-38-2004 removed
$ snap connections snap-store
Interface Plug Slot Notes
appstream-metadata snap-store:appstream-metadata :appstream-metadata -
content snap-store:gnome-3-38-2004 - -
content[gtk-3-themes] snap-store:gtk-3-themes gtk-common-themes:gtk-3-themes -
content[icon-themes] snap-store:icon-themes gtk-common-themes:icon-themes -
content[sound-themes] snap-store:sound-themes gtk-common-themes:sound-themes -
dbus - snap-store:packagekit-svc -
...
$ snap-store
ERROR: not connected to the gnome-3-38-2004 content interface.
$ firefox
ERROR: not connected to the gnome-3-38-2004 content interface.
Run Code Online (Sandbox Code Playgroud)
您可以通过检查快照的文件来找出快照的依赖关系,snap.yaml该文件是
/snap/<snapname>/<revision>/meta/snap.yaml
Run Code Online (Sandbox Code Playgroud)
命令
~$ grep "default-provider:" /snap/*/*/meta/snap.yaml
~$ grep "base:" /snap/*/*/meta/snap.yaml
Run Code Online (Sandbox Code Playgroud)
将生成所有已安装快照所需的所有依赖项的列表,可以安全地删除未列出的依赖项。请参阅此答案中的示例。
| 归档时间: |
|
| 查看次数: |
1085 次 |
| 最近记录: |