ubuntu中 删除 snap

这篇文章详细介绍了如何使用命令行卸载系统中的所有Snap应用,包括Firefox,然后停止和移除snapd服务及相关缓存数据。接着,它指导如何阻止Ubuntu安装Snap版Firefox,通过添加Mozilla团队的PPA来重新安装Firefox的apt版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

First, let’s list all the snaps installed on your system with the following command:

snap list

Let’s also stop snapd (snap daemon) services:

sudo systemctl disable snapd.service
sudo systemctl disable snapd.socket
sudo systemctl disable snapd.seeded.service
sudo systemctl mask snapd
sudo apt-mark hold snapd

Then remove each snap. It’s best to do so one-by-one, rather than all in one apt remove line. So something like:

sudo snap remove firefox
sudo snap remove snap-store
sudo snap remove gtk-common-themes
sudo snap remove gnome-3-38-2004
sudo snap remove core18
sudo snap remove snapd-desktop-integration

Now, let’s delete any leftover snap cached data:

sudo rm -rf /var/cache/snapd/

Then purge or remove completely snapd using the following command:

sudo apt autoremove --purge snapd

Finally, using purge doesn’t touch your home directory, so you can optionally delete any files previously created in ~/snap.

To do this, use the following command:

rm -rf ~/snap

Reinstalling Firefox with apt

If you want to reinstall Firefox, when you try to do so with apt, you may get the following error:

firefox : PreDepends: snapd but it is not going to be installed

You can get around that by blocking Ubuntu from pulling the snap version of Firefox by pinning it.

First, create a new file:

vim /etc/apt/preferences.d/firefox-no-snap

Next, add these lines to that new file:

Package: firefox*
Pin: release o=Ubuntu*
Pin-Priority: -1

Save it. Then add the Mozilla team Ubuntu PPA for Firefox:

sudo add-apt-repository ppa:mozillateam/ppa

Finally, ‘apt update’ and ‘apt install’ the latest Firefox version:

sudo apt update
sudo apt install firefox
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值