如何在 Linux 中降级 Flatpak 软件包
Flatpak
![](/data/attachment/album/202301/01/160400h0mmppwwvxd004bm.jpg)



> 
> Flatpak 软件包的一个鲜为人知的特点是，它允许你对已安装的应用程序进行降级。下面是如何使用它的方法。
> 
> 
> 


从技术上讲，小版本或次要更新是为了解决问题。但是，当某些更新破坏你当前的工作流程时，情况可能会变得更糟。


无论是 Flatpak 包还是 Snap，当出现问题时，一切都会在某个时候崩溃。作为一个沙盒打包方案，它可能不会影响整个系统，但如果你遇到一个让你的应用体验变差的错误，你可能会后悔更新。


比如之前 [Black Box](https://itsfoss.com/blackbox-terminal/) 的更新就带来了一些错误，无法选择文字！开发人员现在已经解决了这个问题，但在他们没有解决之前，我降级了那个特定的包以使其正常工作。


所以，如果你想降级特定的 Flatpak 应用，你可以按照本指南进行操作。


### 在 Linux 中降级 Flatpak 包


**免责声明：** 与安装 Flatpak 不同，你需要 `sudo` 权限才能降级 Flatpak 包。如果你的用户没有该权限，你可以按照我们关于 [如何向用户授予 sudo 访问权限](https://itsfoss.com/add-sudo-user-ubuntu/) 的详细指南进行操作。


以下是步骤：


#### 1、获取包的应用 ID


第一步是找到要降级的包的应用 ID。你可以列出已安装的软件包轻松找到它：



```
flatpak list --app

```

![find flatpak package id in linux](/data/attachment/album/202301/01/160402zbws11busddlhpuz.png)


记下要降级的包的应用 ID。


这里，我要降级 Black Box，所以我的应用 ID 将是 `com.raggesilver.BlackBox`。


#### 2、列出以前的版本并获取该提交的代码


获得应用 ID 后，你需要列出以前的版本。


你可以按照给定的命令语法做到这点：



```
flatpak remote-info --log flathub <Application ID>

```

![find previous releases in flatpak](/data/attachment/album/202301/01/160403so7tjrjrfowr772k.png)


找到首选的先前版本后，复制如上所示的提交的代码。


#### 3、降级 Flatpack 包


执行前两个步骤后，你应该有以下内容：


* 包的应用 ID。
* 首选旧版本的提交代码。


现在，你必须将它们放在以下命令中：



```
sudo flatpak update --commit=<commit_code> <Application ID>

```

当我将 Black Box 降级到以前的版本时，我将使用以下命令：



```
sudo flatpak update --commit=c4ef3f4be655cbe2559451a9ef5977ab28139c54bb5adbd7db812f3482bd0db5 com.raggesilver.BlackBox

```

![downgrade flatpak package in linux](/data/attachment/album/202301/01/160404rbd2ed8z8vh8vge4.png)


这就完成了！


要检查你是否已成功降级软件包，你可以列出需要更新的软件包（考虑到其他所有内容都是最新的）。它应该包括你最近降级的软件包的名称：



```
flatpak update

```

![downgrade flatpak package](/data/attachment/album/202301/01/160404h347dhcjf264ffed.png)


如你所见，Black Box 已过时，需要更新，这意味着包已成功降级！


### 总结


在本快速教程中，我解释了如何降级 Flatpak 软件包，希望对你有所帮助。


如果你有任何疑问或建议，请在评论中告诉我。




---


via: <https://itsfoss.com/downgrade-flatpak-packages/>


作者：[Sagar Sharma](https://itsfoss.com/author/sagar/) 选题：[lkxed](https://github.com/lkxed) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

Technically, minor or point release updates are released to solve issues. But things may get worse when some updates break your current workflow.

Whether a Flatpak package or Snap, everything breaks at some point when there is an issue. Being a sandboxed packaging solution, it may not affect the entire system, but if you encounter a bug that makes your app experience worse, you may regret the update.

For example, the previous update of [Black Box](https://itsfoss.com/blackbox-terminal/) was bundled with certain bugs, and I could not select text! Developers have solved this issue now, but until they did not, I downgraded that specific package to make things work.

So, if you want to downgrade a specific app installed as a Flatpak, you can follow this guide.

## Downgrade Flatpak packages in Linux

**privileges to downgrade Flatpak packages.**

**sudo**Here are the steps below:

### 1. Get the Application ID of the Package

The first step is to find the Application ID of the package you want to downgrade. You can easily find it by listing the installed packages:

`flatpak list --app`


![find flatpak package id in linux](https://itsfoss.com/content/images/wordpress/2022/12/find-flatpak-package-id-in-linux.png)

Note down the application ID of the package you want to downgrade.

Here, I am going to downgrade the Black Box, so my application ID will be `com.raggesilver.BlackBox`

.

### 2. List previous releases and get the commit code

Once you get the application ID, you’d need to list the previous releases.

You can easily do this by following the given command syntax:

`flatpak remote-info --log flathub <Application ID>`


![find previous releases in flatpak](https://itsfoss.com/content/images/wordpress/2022/12/find-previous-releases-in-flatpak-1-800x575.png)


![find previous releases in flatpak](https://itsfoss.com/content/images/wordpress/2022/12/find-previous-releases-in-flatpak-1-800x575.png)

Once you find the preferred previous release, copy the commit code as shown above.

### 3. Downgrade the Flatpack package

Once you follow the first two steps, you should have the following:

- Application ID of the package.
- Commit code of preferred older release.

Now, you have to put them in the following command:

`flatpak update --commit=<commit_code> <Application ID>`


As I’m downgrading Black Box to the previous release, I’ll be using the following command:

`flatpak update --commit=c4ef3f4be655cbe2559451a9ef5977ab28139c54bb5adbd7db812f3482bd0db5 com.raggesilver.BlackBox`


![downgrade flatpak package in linux](https://itsfoss.com/content/images/wordpress/2022/12/downgrade-flatpak-package-in-linux.png)

And that’s it!

To check whether you have successfully downgraded the package, you can list the packages that need to be updated (considering everything else is up-to-date). It should include the name of the package that you have recently downgraded:

`flatpak update`


![downgrade flatpak package](https://itsfoss.com/content/images/wordpress/2022/12/downgrade-flatpak-package.png)

And as you can see, the Black Box is outdated and needs to be updated, meaning the package has been downgraded successfully!

[Flatpak Apps Look Out of Place? Here’s How to Apply GTK Themes on Flatpak ApplicationsOne of the reasons why some users avoid installing Flatpak apps is that most Flatpak apps don’t change their appearance as per the current system theme. This makes the applications look out of place in your otherwise beautiful setup. The official way to apply GTK themes to Flatpak apps](https://itsfoss.com/flatpak-app-apply-theme/)![](https://itsfoss.com/content/images/wordpress/2021/11/apply-gtk-themes-on-flatpak-applications.png)


![](https://itsfoss.com/content/images/wordpress/2021/11/apply-gtk-themes-on-flatpak-applications.png)

## Wrapping Up

In this quick tutorial, I explained how you downgrade Flatpak packages, and I hope you find this helpful.

And if you have any queries or suggestions, let me know in the comments.