是什么
snap是一种全新的软件包管理方式,类似于一个容器拥有一个应用程序所有的文件和库,各个应用之间完全独立,所以使用snap包的好处就是解决了应用程序之间的依赖问题,使应用程序之间更容易管理,但是由此带来的问题就是占用更多的磁盘空间以及部分权限问题。
~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 32G 0 32G 0% /dev
tmpfs 6.3G 1.3M 6.3G 1% /run
/dev/mapper/vg0-lv--0 80G 15G 66G 19% /
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/loop0 62M 62M 0 100% /snap/core20/1587
/dev/mapper/vg0-lv--2 887G 6.3G 881G 1% /home
/dev/loop1 62M 62M 0 100% /snap/core20/1328
/dev/loop2 44M 44M 0 100% /snap/snapd/14978
/dev/loop3 68M 68M 0 100% /snap/lxd/21835
/dev/loop4 68M 68M 0 100% /snap/lxd/22753
/dev/loop5 47M 47M 0 100% /snap/snapd/16292
/dev/sda2 994M 146M 849M 15% /boot
tmpfs 6.3G 0 6.3G 0% /run/user/0
/dev/loop6 56M 56M 0 100% /snap/core18/2538
/dev/loop7 119M 119M 0 100% /snap/docker/1779
tmpfs 6.3G 0 6.3G 0% /run/user/1001
这里多出来的snap目录就是自动生成的。
为什么
Snap是Ubuntu的杰作,也就是Ubuntu背后的公司Canonical搞的,所以Snap都会随着Ubuntu一起发行。由于Ubuntu在Linux操作系统中占有非常重要地位,使用率非常高。连带的导致Snap也被使用的越来越多。这并不是什么坏现象,对吧。但可惜事实是,Snap越发的不受到欢迎。
什么原因?
Snap有很多问题,比如几个比较明显的缺点是性能相对较差,软件包的体积大,中心化的软件商店,不透明的运行机制等等很多不受人欢迎的原因,我卸载主要是担心有啥问题了怕不知道咋处理。。。
怎么做
sudo apt autoremove --purge snapd
执行结果:
/# sudo apt autoremove --purge snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
snapd* squashfs-tools*
0 upgraded, 0 newly installed, 2 to remove and 44 not upgraded.
After this operation, 147 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 72121 files and directories currently installed.)
Removing snapd (2.54.3+20.04.1ubuntu0.2) ...
Stopping snap.lxd.activate.service
Stopping unit snap.lxd.activate.service
Waiting until unit snap.lxd.activate.service is stopped [attempt 1]
snap.lxd.activate.service is stopped.
Stopping snap.lxd.daemon.service
Stopping unit snap.lxd.daemon.service
Waiting until unit snap.lxd.daemon.service is stopped [attempt 1]
snap.lxd.daemon.service is stopped.
Stopping snap.lxd.daemon.unix.socket
Stopping unit snap.lxd.daemon.unix.socket
Waiting until unit snap.lxd.daemon.unix.socket is stopped [attempt 1]
snap.lxd.daemon.unix.socket is stopped.
Removing squashfs-tools (1:4.4-1ubuntu0.3) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for dbus (1.12.16-2ubuntu2.2) ...
Processing triggers for mime-support (3.64ubuntu1) ...
(Reading database ... 72029 files and directories currently installed.)
Purging configuration files for snapd (2.54.3+20.04.1ubuntu0.2) ...
Stopping snap.lxd.activate.service
Stopping unit snap.lxd.activate.service
Waiting until unit snap.lxd.activate.service is stopped [attempt 1]
snap.lxd.activate.service is stopped.
Removing snap.lxd.activate.service
Stopping snap.lxd.daemon.service
Stopping unit snap.lxd.daemon.service
Waiting until unit snap.lxd.daemon.service is stopped [attempt 1]
snap.lxd.daemon.service is stopped.
Removing snap.lxd.daemon.service
Stopping snap-core18-2538.mount
Stopping unit snap-core18-2538.mount
Waiting until unit snap-core18-2538.mount is stopped [attempt 1]
snap-core18-2538.mount is stopped.
Removing snap core18 and revision 2538
Removing snap-core18-2538.mount
Stopping snap-core20-1328.mount
Stopping unit snap-core20-1328.mount
Waiting until unit snap-core20-1328.mount is stopped [attempt 1]
snap-core20-1328.mount is stopped.
Removing snap core20 and revision 1328
Removing snap-core20-1328.mount
Stopping snap-core20-1587.mount
Stopping unit snap-core20-1587.mount
Waiting until unit snap-core20-1587.mount is stopped [attempt 1]
snap-core20-1587.mount is stopped.
Removing snap core20 and revision 1587
Removing snap-core20-1587.mount
Stopping snap-lxd-21835.mount
Stopping unit snap-lxd-21835.mount
Waiting until unit snap-lxd-21835.mount is stopped [attempt 1]
snap-lxd-21835.mount is stopped.
Removing snap lxd and revision 21835
Stopping unit snap.lxd.daemon.unix.socket
Waiting until unit snap.lxd.daemon.unix.socket is stopped [attempt 1]
snap.lxd.daemon.unix.socket is stopped.
Stopping unit snap.lxd.daemon.unix.socket
Waiting until unit snap.lxd.daemon.unix.socket is stopped [attempt 1]
snap.lxd.daemon.unix.socket is stopped.
Removing snap-lxd-21835.mount
Stopping snap-lxd-22753.mount
Stopping unit snap-lxd-22753.mount
Waiting until unit snap-lxd-22753.mount is stopped [attempt 1]
snap-lxd-22753.mount is stopped.
Removing snap lxd and revision 22753
Removing snap-lxd-22753.mount
Stopping snap-snapd-14978.mount
Stopping unit snap-snapd-14978.mount
Waiting until unit snap-snapd-14978.mount is stopped [attempt 1]
snap-snapd-14978.mount is stopped.
Removing snap snapd and revision 14978
Removing snap-snapd-14978.mount
Stopping snap-snapd-16292.mount
Stopping unit snap-snapd-16292.mount
Waiting until unit snap-snapd-16292.mount is stopped [attempt 1]
snap-snapd-16292.mount is stopped.
Removing snap snapd and revision 16292
Removing snap-snapd-16292.mount
Discarding preserved snap namespaces
Final directory cleanup
Removing extra snap-confine apparmor rules
Removing snapd cache
Removing snapd state
验证
/# snap list
-bash: /usr/bin/snap: No such file or directory
评论区