mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge pull request #25422 from hwlife/20220428-How-to-Remove-Snap-Packages-in-Ubuntu-Linux.md
Translated
This commit is contained in:
commit
de3ab8f8b0
@ -1,230 +0,0 @@
|
||||
[#]: subject: "How to Remove Snap Packages in Ubuntu Linux"
|
||||
[#]: via: "https://www.debugpoint.com/2022/04/remove-snap-ubuntu/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "hwlife"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Remove Snap Packages in Ubuntu Linux
|
||||
======
|
||||
A TUTORIAL ON HOW TO REMOVE SNAP FROM UBUNTU LINUX AND GETTING A
|
||||
SNAP-FREE SYSTEM.
|
||||
Snap packages developed by Canonical are beneficial for several use cases. It provides an easy and faster update of applications directly to the end-users. Not only that, it has several other benefits, such as it comes with all dependencies packaged and allows multiple installations of the same applications. Furthermore, it runs in a sandbox mode providing security and other benefits.
|
||||
|
||||
Among all these benefits, there are other debatable drawbacks of Snap tech. FOr example, almost every user who used Snap reported its slower performance, including its startup time compared to native deb or RPM packages. In addition, due to its design, the application installation size is huge and costs disk space because it packages all the dependencies.
|
||||
|
||||
Not only that, due to its sandbox nature, the Snap apps may not access several areas of your Linux desktop until managed with proper permission.
|
||||
|
||||
This guide explains how you can remove the snap from the Ubuntu system altogether.
|
||||
|
||||
These steps are tested in [Ubuntu 22.04 LTS Jammy Jellyfish][1]. However, it should work for all applicable Ubuntu versions.
|
||||
|
||||
Warning: These steps will remove Software and Firefox, the two critical applications in your Ubuntu system. Make sure you take backups of bookmarks and other Firefox settings before trying these steps.
|
||||
|
||||
### Remove Snap Packages in Ubuntu Linux
|
||||
|
||||
1. Open a terminal and view the list of Snap packages installed in your system using the below command. It shows the snap packages such as Firefox, Software store, themes and other core packages installed by default.
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
snap list
|
||||
|
||||
```
|
||||
|
||||
![Snap list in Ubuntu][2]
|
||||
|
||||
2. Remove snap packages in the following order. Firstly remove Firefox. Secondly, snap-store and the other packages that you see in the above command output in your system.
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
sudo snap remove --purge firefox
|
||||
sudo snap remove --purge snap-store
|
||||
sudo snap remove --purge gnome-3-38-2004
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
sudo snap remove --purge gtk-common-themes
|
||||
sudo snap remove --purge snapd-desktop-integration
|
||||
sudo snap remove --purge bare
|
||||
sudo snap remove --purge core20
|
||||
sudo snap remove --purge snapd
|
||||
|
||||
```
|
||||
|
||||
3. Finally, remove the snap daemon via apt command.
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
sudo apt remove --autoremove snapd
|
||||
|
||||
```
|
||||
|
||||
![remove snap and others][3]
|
||||
|
||||
That’s not all. Even if you removed the snaps using the above command, the sudo apt update command again brings back the snap if you don’t stop the apt trigger.
|
||||
|
||||
4. So, to stop that, we need to create an apt preference file in **/etc/apt/preferences.d/** and create a new preference file to stop snap. Create a new file called **nosnap.pref** in /etc/apt/preferences.d/
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
sudo gedit /etc/apt/preferences.d/nosnap.pref
|
||||
|
||||
```
|
||||
|
||||
5. And add the following lines, then save the file.
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
Package: snapd
|
||||
Pin: release a=*
|
||||
Pin-Priority: -10
|
||||
|
||||
```
|
||||
|
||||
![create a pref file][4]
|
||||
|
||||
_The apt preference is a potent tool if you know how to use it. For example, in the above statements, the Pin-Priority -10 means preventing a package from installation._
|
||||
|
||||
_Unrelated to this tutorial, for example, if you want to give super high priority to all the packages from distribution code name=bullseye, then one may see these preferences. If you want to learn more, you can visit the [apt man pages][5]._
|
||||
|
||||
```
|
||||
|
||||
Package: *
|
||||
Pin: release n=bullseye
|
||||
Pin-Priority: 900
|
||||
|
||||
```
|
||||
|
||||
6. Coming back to the topic, once you save and close the above file, run the below again from the terminal.
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
sudo apt update
|
||||
|
||||
```
|
||||
|
||||
7. Finally, the steps are complete for getting rid of the snap from Ubuntu.
|
||||
|
||||
|
||||
|
||||
[][6]
|
||||
|
||||
SEE ALSO: How to Install and Use Snap Packages in Ubuntu
|
||||
|
||||
### Installing Software and Firefox as deb files after removing Snap from Ubuntu
|
||||
|
||||
You removed Firefox and Sofware applications, so you need those for your work.
|
||||
|
||||
To install the apt version of the Gnome Software, you can use the following command. Make sure you use the –install-suggests. Otherwise, it will install the snap version again!
|
||||
|
||||
```
|
||||
|
||||
sudo apt install --install-suggests gnome-software
|
||||
|
||||
```
|
||||
|
||||
And to install firefox, use the official PPA via the below commands.
|
||||
|
||||
```
|
||||
|
||||
sudo add-apt-repository ppa:mozillateam/ppa
|
||||
sudo apt update
|
||||
sudo apt install -t 'o=LP-PPA-mozillateam' firefox
|
||||
|
||||
```
|
||||
|
||||
![Add the PPA][7]
|
||||
|
||||
![Install Firefox as deb file from PPA][8]
|
||||
|
||||
Once you have installed the Firefox, enable the automatic update using the below commands. To learn more, [visit thi][9][s page][9].
|
||||
|
||||
```
|
||||
|
||||
mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox
|
||||
|
||||
```
|
||||
|
||||
Last but not the least, create another preference file for Firefox to give super high priority to the above PPA while running apt. If you don’t do this, the apt update command again pulls back firefox snap and brings over its “snap friends” 😂😂😂.
|
||||
|
||||
```
|
||||
|
||||
sudo gedit /etc/apt/preferences.d/mozillateamppa
|
||||
|
||||
```
|
||||
|
||||
Finally, add these lines and save the file.
|
||||
|
||||
```
|
||||
|
||||
Package: firefox*
|
||||
Pin: release o=LP-PPA-mozillateam
|
||||
Pin-Priority: 501
|
||||
|
||||
```
|
||||
|
||||
That’s it.
|
||||
|
||||
### Revert back to Snap in Ubuntu
|
||||
|
||||
If you change your mind, remove the preference file and install the applications again using the below set of commands.
|
||||
|
||||
```
|
||||
|
||||
sudo rm /etc/apt/preferences.d/nosnap.pref
|
||||
sudo apt update && sudo apt upgrade
|
||||
sudo snap install snap-store
|
||||
sudo apt install firefox
|
||||
|
||||
```
|
||||
|
||||
### Closing Notes
|
||||
|
||||
Wrapping up the tutorial on removing snap in Ubuntu, I would say these are unnecessary efforts to get rid of Snap completely. Mainly these are difficult for new users. I hope this guide helps you to get rid of snap. Cheers.
|
||||
|
||||
* * *
|
||||
|
||||
We bring the latest tech, software news and stuff that matters. Stay in touch via [Telegram][10], [Twitter][11], [YouTube][12], and [Facebook][13] and never miss an update!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2022/04/remove-snap-ubuntu/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.debugpoint.com/2022/01/ubuntu-22-04-lts/
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2022/04/Snap-list-in-Ubuntu.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/04/remove-snap-and-others-1024x544.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2022/04/create-a-pref-file.jpg
|
||||
[5]: https://manpages.ubuntu.com/manpages/focal/man5/apt_preferences.5.html
|
||||
[6]: https://www.debugpoint.com/2016/07/how-to-install-and-use-snap-packages-in-ubuntu/
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/04/Add-the-PPA-1024x550.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/04/Install-Firefox-as-deb-file-from-PPA-1024x548.jpg
|
||||
[9]: https://www.debugpoint.com/2021/09/remove-firefox-snap-ubuntu/
|
||||
[10]: https://t.me/debugpoint
|
||||
[11]: https://twitter.com/DebugPoint
|
||||
[12]: https://www.youtube.com/c/debugpoint?sub_confirmation=1
|
||||
[13]: https://facebook.com/DebugPoint
|
@ -0,0 +1,230 @@
|
||||
[#]: subject: "How to Remove Snap Packages in Ubuntu Linux"
|
||||
[#]: via: "https://www.debugpoint.com/2022/04/remove-snap-ubuntu/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "hwlife"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
怎样在 Ubuntu Linux 中移除 Snap 软件包
|
||||
======
|
||||
这是个关于在 Ubuntu Linux 系统中怎样删除 Snap 软件包并且得到一个无 Snap 软件包系统的教程。
|
||||
|
||||
由 Canonical开发的 Snap 软件包适用于多个使用情景。它为最终用户提供了轻便且快速的程序更新。不仅如此,它还有其他的好处,比如它打包了所有依赖包并允许相同程序安装多个。此外,它运行在沙盒模式提供安全和其他方面的保障。
|
||||
|
||||
在这些个好处里边,有一些是 Snap 技术备受争论的点。举个例子,几乎所有用过 Snap 软件包的用户都报告过它的较差的性能,包括它的启动时间要比本地 deb 或者 RPM 软件包时间要长。另外,由于它的设计,程序安装的容量占用巨大并且浪费磁盘空间,因为它的软件包包含所有用到的依赖包。
|
||||
|
||||
不仅如此,由于沙盒的天然属性, Snap 程序可能不能够访问你的 Linux 桌面的一些区域直到使用适度的权限来管理。
|
||||
|
||||
这个指南阐述你怎样可以从 Ubuntu 系统中移除所有的 Snap 软件包。
|
||||
|
||||
这些步骤在 [Ubuntu 22.04 LTS Jammy Jellyfish][1] 中进行测试。然而,它也适用于所有的 Ubuntu 系统版本。
|
||||
|
||||
警告:这些步骤将会移除软件商店和 Firefox - Ubuntu系统中两个关键的程序。尝试这些步骤之前确认你已经对书签和其它 Firefox 设置做了备份。
|
||||
|
||||
### 在 Ubuntu Linux 移除 Snap 软件包
|
||||
|
||||
1. 使用以下命令在你的系统中打开一个终端并查看已经安装的 Snap 软件包的列表。它显示了 Snap 软件包,比如 Firefox,软件商店,主题以及其它默认已经安装的核心软件包。
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
snap list
|
||||
|
||||
```
|
||||
|
||||
![ Ubuntu Snap 包列表][2]
|
||||
|
||||
2. 按照以下的顺序移除 Snap 软件包。首先移除 Firefox。其次,Snap 商店和在你系统中你看到的以上命令中输出的其它软件包。
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
sudo snap remove --purge firefox
|
||||
sudo snap remove --purge snap-store
|
||||
sudo snap remove --purge gnome-3-38-2004
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
sudo snap remove --purge gtk-common-themes
|
||||
sudo snap remove --purge snapd-desktop-integration
|
||||
sudo snap remove --purge bare
|
||||
sudo snap remove --purge core20
|
||||
sudo snap remove --purge snapd
|
||||
|
||||
```
|
||||
|
||||
3. 最后,通过 apt 命令移除 Snap 服务。
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
sudo apt remove --autoremove snapd
|
||||
|
||||
```
|
||||
|
||||
![移除 Snap 包和其它][3]
|
||||
|
||||
这还没完,即使你用以上命令移除了 Snap 软件包 ,但是如果你没有停止 apt 触发器, sudo apt update 命令会再一次将 Snap 带回来。
|
||||
|
||||
4. 所以,要停止它,我们需要在 **/etc/apt/preferences.d/** 目录下创建一个 apt 设置文件并创建一个新的设置文件来停止 Snap 服务。在 /etc/apt/preferences.d/ 目录下创建一个叫做 **nosnap.pref** 的新文件。
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
sudo gedit /etc/apt/preferences.d/nosnap.pref
|
||||
|
||||
```
|
||||
|
||||
5. 添加以下的命令行,并保存这个文件。
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
Package: snapd
|
||||
Pin: release a=*
|
||||
Pin-Priority: -10
|
||||
|
||||
```
|
||||
|
||||
![创建设置文件][4]
|
||||
|
||||
_如果你知道如何使用它,那么这个 apt 设置文件是一个潜在的工具。举个例子,在以上的状态中,Pin-Priority -10 意思就是阻止 Snap 软件包的安装。_
|
||||
|
||||
_与这个教程不相关的,举个例子,如果你想给所有发行版代码名字为 bulleye 的软件包超高优先权的话,那么就可以查看这些设置文件。如果你想了解的更多,你可以访问 [apt 手册页][5]._
|
||||
|
||||
```
|
||||
|
||||
Package: *
|
||||
Pin: release n=bullseye
|
||||
Pin-Priority: 900
|
||||
|
||||
```
|
||||
|
||||
6. 回到主题, 一旦你已经保存和关闭以上文件,从终端中再次运行以下命令。
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
sudo apt update
|
||||
|
||||
```
|
||||
|
||||
7. 最后, 从 Ubuntu 中处理掉 Snap 软件包的步骤全部完成。
|
||||
|
||||
|
||||
|
||||
[][6]
|
||||
|
||||
另见:在 Ubuntu 中怎样安装和使用 Snap 软件包
|
||||
|
||||
### 从 Ubuntu 移除 Snap 软件包后用 deb 文件安装软件和 Firefox
|
||||
|
||||
你已经移除了 Firefox 和软件程序,但是你的工作还需要它们。
|
||||
|
||||
要安装 apt 版的 Gnome 软件中心,你可以使用以下命令。确保使用 -install-suggests 参数。否则,将会再次安装上 Snap 软件包的版本!
|
||||
|
||||
```
|
||||
|
||||
sudo apt install --install-suggests gnome-software
|
||||
|
||||
```
|
||||
|
||||
要安装 Firefox,通过以下命令使用官方 PPA 仓库。
|
||||
|
||||
```
|
||||
|
||||
sudo add-apt-repository ppa:mozillateam/ppa
|
||||
sudo apt update
|
||||
sudo apt install -t 'o=LP-PPA-mozillateam' firefox
|
||||
|
||||
```
|
||||
|
||||
![添加 PPA 仓库][7]
|
||||
|
||||
![从 PPA 仓库以 deb 文件形式安装 Firefox][8]
|
||||
|
||||
一旦您已经安装完 Firefox,使用以下命令开启自动更新。要了解更多,[访问此页][9]。
|
||||
|
||||
```
|
||||
|
||||
mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox
|
||||
|
||||
```
|
||||
|
||||
最后但非不重要,当运行 apt 时,为 Firefox 创建另一个设置文件给予以上 PPA 仓库超高优先权。如果你不这么做,apt update 命令会再次回滚回 Firefox Snap包形式并带来它的 “ Snap 朋友们 ” 😂😂😂。
|
||||
|
||||
```
|
||||
|
||||
sudo gedit /etc/apt/preferences.d/mozillateamppa
|
||||
|
||||
```
|
||||
|
||||
最后, 添加这些命令行并保存文件。
|
||||
|
||||
```
|
||||
|
||||
Package: firefox*
|
||||
Pin: release o=LP-PPA-mozillateam
|
||||
Pin-Priority: 501
|
||||
|
||||
```
|
||||
|
||||
完成.
|
||||
|
||||
### 在 Ubuntu 系统恢复到 Snap 软件包形式
|
||||
|
||||
如果你改变想法,移除设置文件并通过以下命令再次安装程序。
|
||||
|
||||
```
|
||||
|
||||
sudo rm /etc/apt/preferences.d/nosnap.pref
|
||||
sudo apt update && sudo apt upgrade
|
||||
sudo snap install snap-store
|
||||
sudo apt install firefox
|
||||
|
||||
```
|
||||
|
||||
### 结尾
|
||||
|
||||
关于在 Ubuntu 下移除 Snap 软件包做个收尾,我想说的是这些处理 Snap 软件包的方法实属无奈。主要是这对新用户来说很困难。我希望这个指南能帮助你处理好 Snap 软件包。完结撒花。
|
||||
|
||||
* * *
|
||||
|
||||
我们带来最新的技术,软件和重要的新闻,通过 [Telegram][10], [Twitter][11], [YouTube][12] 和 [Facebook][13] 与我们保持联系,不要错过更新哟!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2022/04/remove-snap-ubuntu/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[hwlife](https://github.com/hwlife)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.debugpoint.com/2022/01/ubuntu-22-04-lts/
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2022/04/Snap-list-in-Ubuntu.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2022/04/remove-snap-and-others-1024x544.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2022/04/create-a-pref-file.jpg
|
||||
[5]: https://manpages.ubuntu.com/manpages/focal/man5/apt_preferences.5.html
|
||||
[6]: https://www.debugpoint.com/2016/07/how-to-install-and-use-snap-packages-in-ubuntu/
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2022/04/Add-the-PPA-1024x550.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2022/04/Install-Firefox-as-deb-file-from-PPA-1024x548.jpg
|
||||
[9]: https://www.debugpoint.com/2021/09/remove-firefox-snap-ubuntu/
|
||||
[10]: https://t.me/debugpoint
|
||||
[11]: https://twitter.com/DebugPoint
|
||||
[12]: https://www.youtube.com/c/debugpoint?sub_confirmation=1
|
||||
[13]: https://facebook.com/DebugPoint
|
Loading…
Reference in New Issue
Block a user