一些 flatpak 的软件包可能在发布的时候没有经过细致的检测就发布,导致更新后出现各种各样的问题,除了等待新版本发布之外,也可以对安装的应用进行降级,回滚到使用良好的版本。

以下是降级应用版本涉及到的流程:

查询 Application ID

找到要降级的 Application ID,这里我以 slack 为例:

1
2
[hcai@P1-Gen4 ~]$ flatpak list --app | grep slack
Slack com.slack.Slack 4.32.127 stable flathub system

第二列中的 com.slack.Slack 就是应用的 ID。

降级

找到要回滚的历史 commit 信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[hcai@P1-Gen4 ~]$ flatpak remote-info --log flathub com.slack.Slack | head -n 30
ID: com.slack.Slack
Ref: app/com.slack.Slack/x86_64/stable
Arch: x86_64
Branch: stable
Collection: org.flathub.Stable
Download: 1.8 MB
Installed: 5.4 MB
Runtime: org.freedesktop.Platform/x86_64/22.08
Sdk: org.freedesktop.Sdk/x86_64/22.08

Commit: ed0d3b59791fd162f6a842ecb9ee00b53865dbf68fc398e0795c40818eeb952c
Parent: 72345beafe0cb9d2b32b4f602a6b5392c23a987747f43340a387827f85b552a1
Subject: Update slack.deb to 4.32.127 (d30ecb82)
Date: 2023-06-16 08:19:43 +0000
History:

Commit: 72345beafe0cb9d2b32b4f602a6b5392c23a987747f43340a387827f85b552a1
Subject: Update slack.deb to 4.31.155 (aa799fc2)
Date: 2023-04-18 07:12:59 +0000

Commit: b95d24a8a354db07b95b065b3e57e9442c9fbaf851a49cbe6e7b1aa0afcab591
Subject: Update slack.deb to 4.29.149 (55db5446)
Date: 2022-12-15 08:53:28 +0000

Commit: cb44e08354a5dcb8b5799a0d2c05ca2470d1e2998e45e816afd21a2165ecc187
Subject: Update runtime to 22.08 (d0a4dc3b)
Date: 2022-10-12 10:31:17 +0000

Commit: 4ce1f7ea41b925a36ec6ffe0243f35b45d8d2592df3f83bfc3cf383b96e138a3
Subject: Update slack.deb to 4.27.156 (fe578202)

例如我要回滚上一个版本 4.32.155 对应的 Commit 为 72345beafe0cb9d2b32b4f602a6b5392c23a987747f43340a387827f85b552a1,使用对应的 Commit 来进行降级,降级需要 root 权限:

1
sudo flatpak update --commit=72345beafe0cb9d2b32b4f602a6b5392c23a987747f43340a387827f85b552a1 com.slack.Slack

后续等待新版本发布后再进行 flatpak update 操作。