Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rafaelcalleja/06bb735c0b671c00acc0ff20a865d50c to your computer and use it in GitHub Desktop.

Select an option

Save rafaelcalleja/06bb735c0b671c00acc0ff20a865d50c to your computer and use it in GitHub Desktop.
Upgrade systemd on Ubuntu 18.04

Upgrade systemd on Ubuntu 18.04

In this document, I will explain how to upgrade the default systemd version from 237 to 242.

Install required dependencies

# Install required dependencies
sudo apt install build-essential devscripts python3-pip cmake libssl-dev libpcre2-dev
sudo apt purge meson -yq
sudo apt install python3-pip -yq
sudo pip3 install meson


# Upgrade Meson version
sudo -H pip3 install --target=/usr/bin --upgrade meson

# Install new user Meson version
pip3 install --user meson

# Reboot to complete changes
sudo reboot

Enable source repositories

# Patch sources file
sudo sed -e 's/# deb-src/deb-src/' -i /etc/apt/sources.list

# Update package cache
sudo apt update --fix-missing -y

Install build dependencies

sudo apt build-dep systemd

Download required sources

wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/systemd/242-7ubuntu3.11/systemd_242.orig.tar.gz
wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/systemd/242-7ubuntu3.11/systemd_242-7ubuntu3.11.debian.tar.xz
wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/systemd/242-7ubuntu3.11/systemd_242-7ubuntu3.11.dsc

It won't work with later versions

Unpack downloaded sources

# Move to home
cd $HOME

# Uncompress orig archive
tar xvzf systemd_242.orig.tar.gz

# Move to decompressed folder
cd systemd-242

# Uncompress debian files
tar xvJf ../systemd_242-7ubuntu3.11.debian.tar.xz

Compile everything

This will also generate debian packages to install in next step.

dpkg-buildpackage -us -uc -d

This step is pretty long so be patient if you don't have a lot of CPU cores.

The argument -d is required to bypass the requested Meson version.

Install generated packages

Now we will install the new compiled systemd version.

# Move back to home
cd $HOME

# List generated debian packages
ll | grep deb

# Create dedicated folder for debian packages
mkdir -v systemd-242-debs

# Move all created packages
mv -v *.*deb systemd-242-debs/

# Move to debian packages folder
cd systemd-242-debs

# Install generated packages
sudo dpkg --auto-deconfigure -i *.deb

# Reboot to apply changes
sudo reboot

You can safely ignore this error:

Errors were encountered while processing:
systemd-coredump_242-7ubuntu3.11_amd64.deb

Verify installed version

systemd --version

It should return something similar:

systemd 242 (242)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

References

@rafaelcalleja

Copy link
Copy Markdown
Author

Cross compiler
sudo qemu-debootstrap --arch armhf buster /mnt/data/armhf http://deb.debian.org/debian/
sudo chroot /mnt/data/armhf

https://stackoverflow.com/questions/58348139/how-to-install-dependencies-for-a-project-that-is-being-cross-compiled-on-an-x86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment