Fedora 31 升级到 Fedora 32

Fedora 31 升级到 Fedora 32

老灯一个10多年的ArchLinux用户, 这么多年啊, 一直用Arch滚啊滚啊,借用一下某电商的广告台词就是:

Arch滚动一时爽,一直滚动一直爽。

一时升级一时爽,一直升级一直爽!!

滚动升级是爽了,但是天天滚,对于升级这种事也就没有什么”激情“了。甚至都升级升得想吐了。有时候一天能更新好几次。

这不,老灯前面更换到Fedora, 终于等来了这次的”大版本“升级体验了。心情居然还有点小激动。

毕竟下次再升级还得期待半年呢(Fedora固定6个月发布一个大版本)。这真是:

Fedora升级一时爽, 半年升级等半年。

Fedora 32 更新了啥

Fedora 32 原定于2020年4月21日发布的,由于bug问题推迟发布了一周。 对此phoronix有报导,见Fedora 32 Delayed From Releasing Next Week Due To Bugs

The current blocker bugs include Fedora's "rescue mode" not recognizing LVM partitions and the F32 backgrounds version not being in the stable repository. There are also freeze exceptions around issues with some dual GPU laptops, the KDE desktop session not starting when switching between users, and other rather minor items.

4月28号,F32准时发布了。

phoronix 报导: https://www.phoronix.com/scan.php?page=news_item&px=Fedora-32-Released

官方博客有简单的说明: https://fedoramagazine.org/whats-new-fedora-32-workstation/

更详细的说明在 https://fedoraproject.org/wiki/Releases/32/ChangeSet?rd=Releases/32

主要更新:

  • 内核从 5.5.x 更新到 5.6.7

  • 默认启用 EarlyOOM

    安装Earlyoom软件包,并默认启用它。 如果RAM和swap都低于10%,则EarlyOOM将SIGTERM发送给具有最大oom_score的进程。 如果RAM和swap都低于5%,则EarlyOOM将SIGKILL发送给具有最大oom_score的进程。 这个想法是要尽快从内存不足的情况中恢复,而不是典型的整个系统挂起(假死)使用户不得不关闭电源而没有其他选择的。

    我觉得这个特性还是挺赞的,特别是对于小内存机器。 那么为什么叫EarlyOOM?因为Linux机器默认就有OOM的。 OOM是Out of Memory的缩写,内存不足的意思。当内存严重不足时,内核就会调用 OOM 终结者杀死oom_score超标的进程。

    terminator

    这位同志,你吃内存吃太多了,没说,Chrome同志,说的就是你,你赶紧的,从食堂给我离开!

    OOM终结者是怎么选择应该杀死哪个进程的呢? Linux内核为每个正在运行的进程oom_score评分,该评分显示了在可用内存不足的情况下终止该进程的可能性。 得分与该进程使用的内存量成正比。oom_score评分 = 10 x 进程的内存使用百分比(x%中的x)。 因此,最大分值为 100(百分之100) x 10 = 1000. 此外,如果进程以特权用户身份运行,则与普通用户进程使用相同的内存相比,该进程的oom_score略低。

    可以在/proc目录中找到进程的oom_score。 假设进程ID(pid)为42, 执行cat /proc/42/oom_score即可提到该进程的当前的OOM得分。

    进程使用的内存我们可以用htop或top查看,然后按m和M切换排序。 内核对象使用的内存可以通过以下命令:

    # awk '{printf "%5d MB %s\n", $3*$4/(1024*1024), $1}' < /proc/slabinfo | sort -n
    

    那么既然内核已经有OOM机制了,为什么还要引入一个EarlyOOM ? 我们看看OOM的判断条件是什么:

    根据文档 https://www.kernel.org/doc/gorman/html/understand/understand016.html :

    • Is there enough swap space left (nr_swap_pages > 0) ? If yes, not OOM
    • Has it been more than 5 seconds since the last failure? If yes, not OOM
    • Have we failed within the last second? If no, not OOM
    • If there hasn't been 10 failures at least in the last 5 seconds, we're not OOM
    • Has a process been killed within the last 5 seconds? If yes, not OOM

    我们可以发现,OOM终结者在杀死一个进程之前的决定还是很谨慎的。比如上面描述的很多条件下都会判断为not OOM。 实际发生OOM时,系统很可能UI界面无法响应了(比如GNOME卡死了)。 EarlyOOM 能够确保RAM和swap中至少有一个是可用大于10%的。 在小于10%的时候,EarlyOOM终结者采取温和的劝退策略,Chrome同志,你吃内存吃太多了,你先自行退出吧(SIGTERM信号)。 在小于5%的时候,EarlyOOM终结者发现Chrome又跑回来了,EarlyOOM非常地生气, 则直接拿枪把它”突突突“了(SIGKILL信号)。

    chrome-ram-killer
  • SSD默认启用TRIM https://fedoraproject.org/wiki/Changes/EnableFSTrimTimer

启用fstrim.timer将导致fstrim.service每周执行,这顺带执行/usr/sbin/fstrim --fstab --verbose --quiet, 所述fstrim命令通知存储设备(物理和虚拟的)关于未使用的块。这提示可以使耗损均衡和块擦除更有效率,并通过将空闲逻辑盘区返回到精简池(the thin pool)来提高LVM自动精简配置(thin provisioning)上的空闲逻辑盘区的利用率。

fstrim.timer-status
  • GNOME 3.36

    • 性能提升

    • 视觉效果改进

    • gnome-3.36-new-extensions-app
    • 默认app变更:

      • Shotwell (image viewer and manager) is replaced by Photos.
      • Evolution (email client) is replaced by Geary.
      • Rhythmbox (music player for a long time in GNOME) is replaced by Music.
    • 优化Settings菜单组织

    gnome-3.36-new-about

    你可能会发现一个细节,我这里的Windowing System显示的是X11,原因是我使用了Nvidia的闭源驱动(the proprietary nvidia driver)。

    GNOME博客的这个文章解释得很清楚: https://blogs.gnome.org/uraeus/2019/09/23/fedora-workstation-31-whats-new/

    In Fedora Workstation 31 Wayland is still disabled by default if you use the Nvidia binary driver. The reason for this is due to lack of acceleration under XWayland, meaning that any application depending on GLX, like a lot of games, will just get software GL rendering with the binary NVidia driver. This isn’t something we can resolv on our own, Nvidia has to do the work since its their closed source driver, but we been discussing it regularly with them and we been told now that they are looking at the work Adam Jackson some time ago which was specifically aimed at helping them bring their X.org driver to XWayland. We don’t have a timeline yet, but it is being actively looked at and hopefully a proper date can be provided soon. I am actually running Fedora Workstation 31 using the NVidia driver myself at the moment on this laptop, and for those interested in helping dogfood this setup, in preparation for hopefully being able to enable Wayland on NVidia in Fedora Workstation 32, it is fairly simple thing to do. Under /usr/lib/udev/rules.d/ you find a file called 61-gdm.rules, just edit that file and comment out (#) the line that reads ‘DRIVER=="nvidia", RUN+="/usr/libexec/gdm-disable-wayland"‘ and you will revert to a standard setup where your standard session is a Wayland session, but with a x.org session available as a fallback. The more people that run this and report issues the better as it helps us make this rock solid before releasing it upon the world.

    已经F32了,我们看看这个限制是否默认移除了?

    /usr/lib/udev/rules.d
    cat 61-gdm.rules 
    # disable Wayland on Cirrus chipsets
    ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="/usr/libexec/gdm-disable-wayland"
    # disable Wayland on Hi1710 chipsets
    ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="/usr/libexec/gdm-disable-wayland"
    # disable Wayland when using the proprietary nvidia driver
    DRIVER=="nvidia", RUN+="/usr/libexec/gdm-disable-wayland"
    # disable Wayland if modesetting is disabled
    IMPORT{cmdline}="nomodeset", RUN+="/usr/libexec/gdm-disable-wayland"
    

    not good, disable Wayland when using the proprietary nvidia driver依旧存在。看来还是要等nvidia官方把XWayland支持加上了。

  • GCC 10 https://fedoraproject.org/wiki/Changes/GCC10

    GCC 10的重大改进应该是新增加的静态分析功能吧,见 https://developers.redhat.com/blog/2020/03/26/static-analysis-in-gcc-10/

  • Glibc 2.31 https://fedoraproject.org/wiki/Changes/GLIBC231

  • LLVM 10 https://fedoraproject.org/wiki/Changes/LLVM-10

  • firewalld默认使用nftables后端 https://fedoraproject.org/wiki/Changes/firewalld_default_to_nftables

    这个改动应该是比较大的. ntf跟iptables相比,还是很新的一个东西。像docker这种一直还坚守在老的iptables上面,会容易造成问题。不过,其实在Fedroa上面完全不是问题,反正从RHEL 8起就不能跑docker了。它自家的podman自然是跟firewalld配合得比较好的。

    • libvirt libvirt already cooperates with the firewalld nftables backend. The only thing needed is to test/verify.

    • podman libvirt already cooperates with the firewalld nftables backend. The only thing needed is to test/verify.

    • docker Docker currently does not cooperate with the nftables backend. It currently side-steps firewalld by injecting its own rules in iptables ahead of firewalld's rules. However, with the nftables backend firewalld's rule will still be evaluated. Netfilter in the kernel will call iptables, then nftables for the same packet. This means firewalld/nftables is likely to drop the packet even if docker has iptables rules to ACCEPT.

      Proposed fix 1: Docker package should provide a firewalld zone definition that includes the docker interfaces (e.g. docker0). The zone should use the "ACCEPT" policy (firewalld --set-target). This will allow docker's traffic to pass through firewalld/nftables. Issue 1: If a user has configured a different docker bridge name, then they'll have to manually add the bridge to the docker zone (or firewalld's trusted zone).

      Proposed fix 2: Just like "Proposed fix 1", but instead of adding the zone definition to docker we created a "docker-firewalld" (or firewalld-docker?) package that has the zone definition. This could be installed by default when docker is installed.

  • 程序语言相关

    • Python 3.8 https://fedoraproject.org/wiki/Changes/Python3.8

      Python版本从 Python 3.7 升级到 Python 3.8

    • Python 2 彻底退休

      The python2 package and all its subpackages will be removed from Fedora 32. A legacy python27 package for developers and users will be provided. All packages in Fedora that need Python 2 to run will be removed from Fedora 32 regardless of their dependencies. All packages in Fedora that need Python 2 to build will be removed from Fedora 32 regardless of their dependencies. Exceptions can be granted by FESCo.

    • Deprecate python-nose https://fedoraproject.org/wiki/Changes/DeprecateNose

      The python-nose (python3-nose) package will be deprecated in Fedora 32. Nose is dead upstream, but far too many packages still BuildRequire it, so we cannot remove it yet. Packagers are encouraged to switch to python3-pytest or python3-nose2, but python3-nose remains available for the time being.

    • Python3-rdiff-backup https://fedoraproject.org/wiki/Changes/Python3-rdiff-backup

    • Build Python with -fno-semantic-interposition for better performance https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup

      We add the -fno-semantic-interposition compiler/linker flag when building Python interpreters, as it provides significant performance improvement, up to 27% depending on the workload. Users will no longer be able to use LD_PRELOAD to override a symbol from libpython, which we consider a good trade off for the speedup.

    • Django 3

    • Ruby 2.7 && Bundler 2.0

    • Golang 1.14

    • PHP 7.4 https://fedoraproject.org/wiki/Changes/php74

    • Mono 6.6

      Update the Mono stack in Fedora from 5.20 to 6.6.

    • Switch mingw32 toolchain to dwarf-2 exceptions https://fedoraproject.org/wiki/Changes/Mingw32GccDwarf2

      The main reason for switching to dwarf-2 is that rust can only be compiled to a MinGW toolchain targeting dwarf exceptions on 32-bit [4], and rust usage is starting to appear in some packages (i.e. librsvg2). Switching to dwarf-2 on mingw32 would hence allow to keep the same consistent package offering between mingw32 and mingw64, whereas otherwise one would need to either freeze the mingw32 variants at older versions, or remove them altogether.

  • 包管理相关

  • 数据库

    • MariaDB 10.4
    • PostgreSQL 12

如何从F31升级到F32

升级系统到F32

升级过程还是非常顺利的,基本上参数官方文档: https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/

# 首先确保系统更新到F31当前最新版
sudo dnf upgrade --refresh

# 安装dnf system-upgrade 插件(如果没有安装过的话)
sudo dnf install dnf-plugin-system-upgrade
# 下载升级文件, 注意这里的--releasever=32, 下次如果要升级到33, 只需要改动这里 --releasever=33 即可
sudo dnf system-upgrade download --refresh --releasever=32

# 确认前面的操作都进行OK了,就可以执行以下命令开始升级
sudo dnf system-upgrade reboot

我在升级过程中还是遇到点小问题的,比如这个:

Error: 
 Problem: problem with installed package php-zmq-1.1.3-12.fc31.x86_64
  - package php-zmq-1.1.3-12.fc31.x86_64 requires php(api) = 20180731-64, but none of the providers can be installed
  - package php-zmq-1.1.3-12.fc31.x86_64 requires php(zend-abi) = 20180731-64, but none of the providers can be installed
  - php-common-7.3.17-1.fc31.x86_64 does not belong to a distupgrade repository
(try to add '--skip-broken' to skip uninstallable packages)

虽然提示说可以用--skip-broken, 但是这里我们只有一个php-zmq冲突,因此可以简单粗暴地卸载了php-common这个包完事: sudo dnf remove php-common-7.3.17-1.fc31.x86_64 系统升级之后再把php相关的包安装回来即可. 当然,也可以用--skip-broken参数。能解决问题就OK。

然后开始下载升级包:

sudo dnf system-upgrade download --refresh --releasever=32
Before you continue ensure that your system is fully upgraded by running "dnf --refresh upgrade". Do you want to continue [y/N]: y
Copr repo for bandwhich owned by atim              2.8 kB/s | 3.3 kB     00:01
Copr repo for fira-code-fonts owned by evana       3.2 kB/s | 3.3 kB     00:01
Adobe Systems Incorporated                         773  B/s | 2.9 kB     00:03
Fedora 32 openh264 (From Cisco) - x86_64            62  B/s | 543  B     00:08
Fedora Modular 32 - x86_64                          39 kB/s | 6.5 kB     00:00
Fedora Modular 32 - x86_64 - Updates               6.8 kB/s | 4.9 kB     00:00
Fedora 32 - x86_64 - Updates                       5.5 kB/s | 8.1 kB     00:01
Fedora 32 - x86_64 - Updates                       302 kB/s | 799 kB     00:02
Fedora 32 - x86_64                                 1.6 kB/s | 6.1 kB     00:03
RPM Fusion for Fedora 32 - Free - Updates          8.3 kB/s | 3.6 kB     00:00
RPM Fusion for Fedora 32 - Free                    3.0 kB/s | 3.7 kB     00:01
RPM Fusion for Fedora 32 - Nonfree - Updates        21 kB/s | 3.6 kB     00:00
RPM Fusion for Fedora 32 - Nonfree                     kB/s | 3.7 kB     00:00
slack                                              427  B/s | 1.0 kB     00:02
Visual Studio Code                                 1.7 kB/s | 3.0 kB     00:01
Yarn Repository                                    4.7 kB/s | 2.9 kB     00:00
Modular dependency problems:

 Problem 1: conflicting requests
  - nothing provides module(platform:f31) needed by module meson:latest:3120191009081836:dc56099c-0.x86_64
 Problem 2: conflicting requests
  - nothing provides module(platform:f31) needed by module ninja:latest:3120190304180949:f636be4b-0.x86_64
 Problem 3: conflicting requests
  - nothing provides module(platform:f31) needed by module ripgrep:latest:3120190803131619:22d7e2a5-0.x86_64
Dependencies resolved.
==============================================================================================================================================================================================================================================
 Package                                                                  Architecture                        Version                                                                Repository                                          Size
==============================================================================================================================================================================================================================================
Installing:
 kernel                                                                   x86_64                              5.6.6-300.fc32                                                         fedora                                              21 k
 ...... 此处省略
 yum                                                                      noarch                              4.2.19-1.fc32                                                          fedora                                              46 k
 zimg                                                                     x86_64                              2.9.2-1.fc32                                                           fedora                                             271 k
Resetting modules:
 meson
 ninja
 ripgrep

Transaction Summary
==============================================================================================================================================================================================================================================
Install      49 Packages
Upgrade    2191 Packages
Remove        7 Packages
Downgrade    34 Packages

Total download size: 2.6 G
DNF will only download packages, install gpg keys, and check the transaction.
Is this ok [y/N]:

然后输入y 回车即开始下载了。 可以看到上面其实有个Modular dependency problems,但是被dnf自动解决了。

我安装了挺多东西的,详细的记录可点击这里查看 2020-04-28-f32-upgrade-log.txt

f32-upgrade-download-ok

下载OK了,就可以执行以下命令开始升级

sudo dnf system-upgrade reboot

更新F32系统到最新

这不是刚升级的系统么,怎么还要更新? 没错, 离F32发布其实已经有很多个小时了。在这段时间,有一些包可能已经有新版本了, 因此安装完系统,第一件事,就是把系统更新到最新。

Gnome 扩展更新

由于Gnome版本更新了,很多旧的扩展如果不更新会无法使用。 一般来说会自动更新的,如果没有自动,可以自行用Firefox打开 https://extensions.gnome.org/local/ 选择需要更新的扩展进行更新。

Gnome 默认软件安装

前面有提到GNOME 3.36默认app变更。 由于我是升级过来的,因此新版本的GNOME默认软件并没有安装(比如 GNOME Music)。 F31默认的图片浏览器已经是gnome-photos了,因此不必重复安装。 邮件客户端Geary可以选择性地安装,老灯试用了下感觉非常不错。 官方说这是“Email for humans”,我觉得符合实际。Geary非常轻量级,简洁,易用。Wikipedia也有介绍: https://en.wikipedia.org/wiki/Geary_(e-mail_client) Rhythmbox的默认地位已经被GNOME Music取代了,因此,当然是卸载Rhythmbox安装GNOME Music啦。

sudo dnf remove -y rhythmbox
sudo dnf install -y gnome-music gnome-extensions-app geary

Geary 默认是三栏模式,最左边一栏默认的宽度下,导致Outlook的tags没法显示全,需要调宽一些。 这个最大宽度调整有些技巧,有时候你会发现无法向右拖动了,解决办法就是:将第二栏向右拖动了些。 然后第一栏就可以继续向右拖动了。

另外,由于我之前在GNOME Settings里的Online Accounts配置过Microsoft的账号,然后打开Geary惊喜地发现, 它可以直接使用Online Accounts里的账号,默认就打开了我的Outlook邮箱,体验还是挺不错的。

geary-mail-client
geary-email-list-style

F1可以查看帮助文档(Geary’s built-in manual),文档挺全的,比较实用的是搜索相关的,比如:

搜索说明
is:read已读邮件
is:unread未读邮件
is:starred星标邮件
subject:text查找标题包含text的邮件
from:sender查找发件人是sender的邮件
to:recipient查找收件人是recipient的邮件
body:text查找正文包含text的邮件

默认只会下载最近2周的邮件,如果要下载更多,比如6个月,可以去Accounts里选择相应的邮箱账号 然后调整。

参考文档

https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/

https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/

https://fedoramagazine.org/whats-new-fedora-32-workstation/

https://fedoraproject.org/wiki/Releases/32/ChangeSet

https://www.kernel.org/doc/gorman/html/understand/understand016.html

https://linux-mm.org/OOM

https://dev.to/rrampage/surviving-the-linux-oom-killer-2ki9

https://serverfault.com/questions/571319/how-is-kernel-oom-score-calculated