Summary

I was stuck with a systemd issue today, so I went to Github to raise the issue, but they said the version was too old, and asked me to upgrade the version first, so I decided to upgrade systemd in order to prove that it was.


2020-11-02

Reluctantly, I started over again and eventually managed to upgrade to the current latest version of 246! the following steps are available. Just in case anything else came up, I reinstalled a minimized installation of CentOS 7 and updated the kernel to the latest 5.9.1, and then the rest of the story is documented below.

If you’d like to update the kernel, I’ve also documented another article:Upgrading CentOS Kernel

2019-11-21

Note: This is a record of a failed upgrade article, I tried to upgrade the latest Systemd in CentOS 7.6 and it failed because I couldn’t upgrade the system’s glibc to 2.34, thus making it impossible to continue!

Download Code

You can download it directly from the Release page:

I downloaded the V246 version.

Environmental pretreatment

Since there are some compilation tools that need to be installed later, and then you may need a 3.5 or higher version of Python, if you don’t have one installed on your system, you can follow my other piece of guidance to install one first:

And then other software will be installed as well:

[[email protected]]# yum install http://repo.okay.com.mx/centos/7/x86_64/release/okay-release-1-1.noarch.rpm
[[email protected]]# yum groupinstall -y 'Development Tools'
[[email protected]]# pip3 install meson
[[email protected]]# yum install -y libcap-devel libmount-devel ninja-build
[[email protected]]# wget http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz
[[email protected]]# tar zxf gperf-3.1.tar.gz && cd gperf-3.1 && ./configure && make && make install
[[email protected]]# wget https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4-Linux-x86_64.tar.gz
[[email protected]]# tar zxf cmake-3.18.4-Linux-x86_64.tar.gz
[[email protected]]# export PATH=$PATH:`pwd`/cmake-3.18.4-Linux-x86_64/bin
[[email protected]]# wget https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.30/util-linux-2.30.2.tar.gz
[[email protected]]# tar zxf util-linux-2.30.2.tar.gz && cd util-linux-2.30.2 && ./configure --disable-all-programs --enable-mount --enable-libmount \
                    --enable-libblkid --enable-libuuid && make && make install

Compile

[[email protected]]# wget https://github.com/systemd/systemd/archive/v246.tar.gz
[[email protected]]# tar zxf v246.tar.gz
[[email protected]]# cd systemd-246/
[[email protected]]# ./configure && make && make install

Test

At this point if there are no errors, it’s considered a success, so next verify that it’s working properly:

[[email protected]]# reboot  # Here's a restart for the insurance period.
[[email protected]]# uname -a
Linux localhost.localdomain 5.9.3-1.el7.elrepo.x86_64 #1 SMP Sat Oct 31 09:41:18 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
[[email protected]]# systemctl --version
systemd 246 (246)
-PAM -AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS -ACL -XZ -LZ4 -ZSTD -SECCOMP +BLKID -ELFUTILS -KMOD -IDN2 -IDN -PCRE2 default-hierarchy=unified

OK, Without a doubt, the upgrade was successful.

Problems experienced

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

It looks like there’s a build tool that’s not installed, so install one, because meson relies on Python3, so unfortunately I’ll have to install Python3 first, but luckily I have a tutorial:Install python3.8 in CentOS,It’ll be easy once you’re done:

[[email protected]]# pip3 install meson

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

Looks like a lack of tools again:

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

3. Upgrade Make

[[email protected]]# cd /tmp
[[email protected]]# wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gz
[[email protected]]# tar xvf make-4.1.tar.gz
[[email protected]]# cd make-4.1/
[[email protected]]# ./configure
[[email protected]]# make
[[email protected]]# sudo make install
[[email protected]]# cp /usr/bin/make /usr/bin/make3
[[email protected]]# cp /usr/local/bin/make /usr/bin/make
[[email protected]]# make -v

4. Upgrade glibc

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

This one had some problems at the end:

/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

Solution is:

cp  /etc/ld.so.c* /opt/glibc-2.28/etc/
!!! Hint, what if the upgrade falls apart??

That command saved me.:

[[email protected]]# ldconfig

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

Problems with the install:

... ...
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/
/usr/bin/ld: cannot find -lnss_test2
collect2: error: ld returned 1 exit status
... ...

It can be ignored.

Problem encountered: POSIX caps headers not found

View the dependent packages with yum provides, then install it:

[[email protected]]# yum provides '*sys/capability.h'
libcap-devel-2.22-11.el7.x86_64 : Development files for libcap
Repo        : @base
Matched from:
Filename    : /usr/include/sys/capability.h
[[email protected]]# yum install -y libcap-devel

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

Direct compilation and installation of util-linux solutions.

Thanks To