注:这是一篇升级失败的文章记录,我试图在 CentOS 7.6 中升级最新的 Systemd,最终失败,原因在于无法将系统的 glibc 升级到 2.34,从而导致后续无法继续!


今天被一个 systemd 的问题缠住了,于是就去 Github 上提 issue,没想到人家上来就说版本太老,让我先升级了版本再说,没办法,为了证明是 systemd 确实如此,我决定升级 systemd。

下载代码

直接再 Release 页面中下载就可以了:

我下载了 V243 版本

编译

  1. [[email protected].io]# wget https://github.com/systemd/systemd/archive/v243.tar.gz
  2. [[email protected].io]# tar zxf v243.tar.gz
  3. [[email protected].io]# cd systemd-243/
  4. [[email protected].io]# ./configure
  5. 然而,这里崩了,我尝试解决,然而发现事情比我想象的复杂太多,所以。。。放弃了!

问题

1. ./configure: line 21: exec: meson: not found

看上去是有个构建工具没装,那就装一个,因为 meson 依赖于 Python3,所以很不幸,还得装个 Python3 先,还好我以前有教程:CentOS 安装 Python3.8,装完之后就简单了:

  1. [[email protected].io]# pip3 install meson

2. Program(s) [‘gperf’] not found or not executable

看上去又缺少工具:

  1. [[email protected].io]# wget http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz
  2. [[email protected].io]# tar zxf gperf-3.1.tar.gz
  3. [[email protected].io]# cd gperf-3.1
  4. [[email protected].io]# ./configure
  5. [[email protected].io]# make && make install

3. 升级 Make

  1. [[email protected].io]# cd /tmp
  2. [[email protected].io]# wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gz
  3. [[email protected].io]# tar xvf make-4.1.tar.gz
  4. [[email protected].io]# cd make-4.1/
  5. [[email protected].io]# ./configure
  6. [[email protected].io]# make
  7. [[email protected].io]# sudo make install
  8. [[email protected].io]# cp /usr/bin/make /usr/bin/make3
  9. [[email protected].io]# cp /usr/local/bin/make /usr/bin/make
  10. [[email protected].io]# make -v

4. 升级 glibc

  1. [[email protected].io]# wget wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
  2. [[email protected].io]# tar zxf glibc-2.28.tar.gz
  3. [[email protected].io]# cd glibc-2.28
  4. [[email protected].io]# mkdir build
  5. [[email protected].io]# cd build
  6. [[email protected].io]# ../configure --prefix=/opt/glibc-2.28 --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
  7. [[email protected].io]# make
  8. [[email protected].io]# make install
  9. [[email protected].io]# ldd --version
  10. ldd (GNU libc) 2.28
  11. Copyright (C) 2018 Free Software Foundation, Inc.
  12. This is free software; see the source for copying conditions. There is NO
  13. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. Written by Roland McGrath and Ulrich Drepper.

这个在最后阶段遇到了点问题:

  1. /root/systemd/glibc-2.28/build/elf/ldconfig: Warning: ignoring configuration file that cannot be opened: /opt/glibc-2.28/etc/ld.so.conf: No such file or directory

解决方式为:

  1. cp /etc/ld.so.c* /opt/glibc-2.28/etc/
!!! 温馨提示,如果升级崩了怎么办?

这条命令救了我:

  1. [[email protected].io]# ldconfig

5. /usr/bin/ld: cannot find -lnss_test2

在 install 的时候遇到了问题:

  1. ... ...
  2. LD_SO=ld-linux-x86-64.so.2 CC="gcc -B/usr/bin/" /usr/bin/perl scripts/test-installation.pl /root/systemd/glibc-2.28/build/
  3. /usr/bin/ld: cannot find -lnss_test2
  4. collect2: error: ld returned 1 exit status
  5. ... ...

可以忽略

6. Dependency “mount” not found, tried pkgconfig and cmake

是的,我挂在这了,继续不下去了,sorry!

  1. [[email protected].io]# wget https://www.rpmfind.net/linux/fedora/linux/releases/31/Everything/x86_64/os/Packages/l/libmount-2.34-3.fc31.x86_64.rpm
  2. [[email protected].io]# wget https://www.rpmfind.net/linux/fedora/linux/releases/31/Everything/x86_64/os/Packages/l/libmount-devel-2.34-3.fc31.x86_64.rpm

Thanks To