老破小云ESC(2-2)发现CPU经常过高,发现有个snapd进程,网上搜了下,发现没啥用,放心删除。

for p in $(snap list | awk '{print $1}'); do
  sudo snap remove $p
done

注:这个脚本需要多执行几次,直到出现以下内容:

再执行如下:

sudo systemctl stop snapd
sudo systemctl disable --now snapd.socket
for m in /snap/core/*; do
   sudo umount $m
don

删除管理工具

sudo apt autoremove --purge snapd

依次执行如下代码,删除相关目录

rm -rf ~/snap
sudo rm -rf /snap
sudo rm -rf /var/snap
sudo rm -rf /var/lib/snapd
sudo rm -rf /var/cache/snapd

再执行如下代码禁止apt安装snapd

sudo sh -c "cat > /etc/apt/preferences.d/no-snapd.pref" << EOL
Package: snapd
Pin: release a=*
Pin-Priority: -10
EOL