ubuntu内移除snap

ubuntu 移除snap

snap 是 ubuntu 的集中式管理的软件商城,但在使用过程中软件更新没有很及时。ubuntu 20.04 在安装开始就有预装了 snap,所以我想把它移除掉,省出系统空间。

具体参考链接:https://cloud.tencent.com/developer/article/2168090,可以直接跳转查看步骤。

查看 snap 服务

先查看 snapd 服务是否在运行。

$ sudo systemctl status snapd
[sudo] password for sanren1024: 
● snapd.service - Snap Daemon
     Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-12-04 09:59:36 CST; 10min ago
TriggeredBy: ● snapd.socket
   Main PID: 853 (snapd)
      Tasks: 15 (limit: 9387)
     Memory: 64.3M
     CGroup: /system.slice/snapd.service
             └─853 /usr/lib/snapd/snapd

12月 04 09:59:33 vm-ubuntu2004 systemd[1]: Starting Snap Daemon...
12月 04 09:59:36 vm-ubuntu2004 snapd[853]: overlord.go:272: Acquiring state lock file
12月 04 09:59:36 vm-ubuntu2004 snapd[853]: overlord.go:277: Acquired state lock file
12月 04 09:59:36 vm-ubuntu2004 snapd[853]: daemon.go:247: started snapd/2.60.4 (series 16; classic) ubuntu/>
12月 04 09:59:36 vm-ubuntu2004 snapd[853]: daemon.go:340: adjusting startup timeout by 1m10s (pessimistic e>
12月 04 09:59:36 vm-ubuntu2004 snapd[853]: backends.go:58: AppArmor status: apparmor is enabled and all fea>
12月 04 09:59:36 vm-ubuntu2004 systemd[1]: Started Snap Daemon.

上述结果中显示 Active: active (running) 表示 snapd 线程正在运行。

停止 snap 服务

停止 snap 相关服务。

$ sudo systemctl disable snapd
Removed /etc/systemd/system/multi-user.target.wants/snapd.service.
$ sudo systemctl disable snapd.socket
Removed /etc/systemd/system/sockets.target.wants/snapd.socket.
$ sudo systemctl disable snapd.seeded.service
Removed /etc/systemd/system/multi-user.target.wants/snapd.seeded.service.
Removed /etc/systemd/system/cloud-final.service.wants/snapd.seeded.service.

这样停止了 snap 服务。

查看 snap 安装的软件

查看 snap 已经安装的软件。

$ snap list
Name               Version           Rev    Tracking         Publisher   Notes
bare               1.0               5      latest/stable    canonical✓  base
core20             20230801          2015   latest/stable    canonical✓  base
core22             20230801          864    latest/stable    canonical✓  base
gnome-3-38-2004    0+git.efb213a     143    latest/stable/…  canonical✓  -
gnome-42-2204      0+git.ff35a85     141    latest/stable    canonical✓  -
gtk-common-themes  0.1-81-g442e511   1535   latest/stable/…  canonical✓  -
snap-store         41.3-71-g709398e  959    latest/stable/…  canonical✓  -
snapd              2.60.4            20290  latest/stable    canonical✓  snapd

卸载 snap 软件

卸载 snap 软件,先卸载普通应用软件,后现在 base 软件。

$ snap remove snap-store
$ snap remove gtk-common-themes
$ snap remove gnome-42-2204
$ snap remove gnome-3-38-2004
$ snap remove core20
$ snap remove core22
$ snap remove bare
$ snap remove snapd   # 最后移除这个服务,这是所有服务的基础。

这样 snap 就可以从系统中移除。

禁止 snap 重新安装

若只是上述方式移除了 snap,后面在使用过程中系统会提示软件升级,若安装了,snap 又会被重新安装。因此要禁止 snap 重新安装。

编辑配置文件

$ sudo gedit /etc/apt/preferences.d/nosnap.pref

添加内容

Package: snapd
Pin: release a=*
Pin-Priority: -10

保存退出。

相关推荐

  1. ubuntusnap

    2023-12-07 21:06:01       53 阅读
  2. Ubuntu netplan

    2023-12-07 21:06:01       29 阅读
  3. [ubuntu]add-apt-repository 添加以及

    2023-12-07 21:06:01       52 阅读
  4. 元素

    2023-12-07 21:06:01       50 阅读
  5. 27. 元素

    2023-12-07 21:06:01       63 阅读
  6. 27.元素

    2023-12-07 21:06:01       65 阅读
  7. conda环境

    2023-12-07 21:06:01       60 阅读
  8. 元素(简单)

    2023-12-07 21:06:01       63 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-07 21:06:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-07 21:06:01       101 阅读
  3. 在Django里面运行非项目文件

    2023-12-07 21:06:01       82 阅读
  4. Python语言-面向对象

    2023-12-07 21:06:01       91 阅读

热门阅读

  1. 浅谈排序——快速排序(最常用的排序)

    2023-12-07 21:06:01       54 阅读
  2. NGINX相关配置

    2023-12-07 21:06:01       52 阅读
  3. 使用Docker一键安装MySQL与Nginx脚本

    2023-12-07 21:06:01       51 阅读
  4. flink-cdc同步mysql到doris建设数据仓储最佳实践

    2023-12-07 21:06:01       63 阅读
  5. rabbitmq集群

    2023-12-07 21:06:01       65 阅读
  6. Flink优化——资源优化(一)

    2023-12-07 21:06:01       58 阅读
  7. 主流全文搜索方案对比

    2023-12-07 21:06:01       44 阅读
  8. UVa1339古老的密码题解

    2023-12-07 21:06:01       54 阅读
  9. Centos8安装Docker注意事项及原因

    2023-12-07 21:06:01       54 阅读
  10. Qt设置应用程序字体

    2023-12-07 21:06:01       57 阅读
  11. Rieds实战-Redis实现订阅发布

    2023-12-07 21:06:01       50 阅读