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.


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


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:

[]# yum install
[]# yum groupinstall -y 'Development Tools'
[]# pip3 install meson
[]# yum install -y libcap-devel libmount-devel ninja-build
[]# wget
[]# tar zxf gperf-3.1.tar.gz && cd gperf-3.1 && ./configure && make && make install
[]# wget
[]# tar zxf cmake-3.18.4-Linux-x86_64.tar.gz
[]# export PATH=$PATH:`pwd`/cmake-3.18.4-Linux-x86_64/bin
[]# wget
[]# 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


[]# wget
[]# tar zxf v246.tar.gz
[]# cd systemd-246/
[]# ./configure && make && make install


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

[]# reboot  # Here's a restart for the insurance period.
[]# 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
[]# systemctl --version
systemd 246 (246)

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:

[]# pip3 install meson

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

Looks like a lack of tools again:

[]# wget
[]# tar zxf gperf-3.1.tar.gz
[]# cd gperf-3.1
[]# ./configure
[]# make && make install

3. Upgrade Make

[]# cd /tmp
[]# wget
[]# tar xvf make-4.1.tar.gz
[]# cd make-4.1/
[]# ./configure
[]# make
[]# sudo make install
[]# cp /usr/bin/make /usr/bin/make3
[]# cp /usr/local/bin/make /usr/bin/make
[]# make -v

4. Upgrade glibc

[]# wget wget
[]# tar zxf glibc-2.28.tar.gz
[]# cd glibc-2.28
[]# mkdir build
[]# cd build
[]# ../configure --prefix=/opt/glibc-2.28 --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
[]# make
[]# make install
[]# 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
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/ No such file or directory

Solution is:

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

That command saved me.:

[]# ldconfig

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

Problems with the install:

... ... CC="gcc -B/usr/bin/" /usr/bin/perl scripts/ /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:

[]# 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
[]# yum install -y libcap-devel

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

Direct compilation and installation of util-linux solutions.

Thanks To