0

I have created an override.conf file for systemd-journal-catalog-update.service and placed it in systemd-journal-catalog-update.service.d/ directory. The purpose it to remove systemd-tmpfiles-setup.service from the systemd-journal-catalog-update.service file.

The file has this in it now:

[Unit]
After=local-fs.target systemd-tmpfiles-setup.service

My override.conf file has this:

[Unit]
After=
After=local-fs.target

However, the systemd-journal-catalog-update.service file does not seem to be changing. Am I misunderstanding how the override.conf file works? I know that I can manually modify the original service file but project circumstances are limiting this as an option. Any assistance/advice you guys can give is greatly appreciated.

1 Answer 1

1

What you want (removing a dependency from the unit via a drop-in file) is not possible, according to the systemd.unit man page:

Dependencies (After=, etc.) cannot be reset to an empty list, so dependencies can only be added in drop-ins. If you want to remove dependencies, you have to override the entire unit.

Overriding an entire unit file can be done by following Example two in the man page:

There are two methods of overriding vendor settings in unit files: copying the unit file from /usr/lib/systemd/system to /etc/systemd/system and modifying the chosen settings. [...] The advantage of the first method is that one easily overrides the complete unit, the vendor unit is not parsed at all anymore. It has the disadvantage that improvements to the unit file by the vendor are not automatically incorporated on updates.

In your case, you must (as root)

  • cp /usr/lib/systemd/system/systemd-journal-catalog-update.service /etc/systemd/system
  • systemctl daemon-reload
  • systemctl restart systemd-journal-catalog-update

After that, systemctl status will point to the service file in /etc:

# systemctl status systemd-journal-catalog-update
● systemd-journal-catalog-update.service - Rebuild Journal Catalog
     Loaded: loaded (/etc/systemd/system/systemd-journal-catalog-update.service; static)
     Active: active (exited) since Sat 2021-05-22 16:27:07 CEST; 3 weeks 2 days ago
[...]

The aforementioned systemctl cat will not also show the file in /etc/:

# systemctl cat systemd-journal-catalog-update
# /etc/systemd/system/systemd-journal-catalog-update.service
#  SPDX-License-Identifier: LGPL-2.1-or-later
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Rebuild Journal Catalog
[...]

You can now edit the file in /etc as you wish, run systemctl daemon-reload again and systemctl restart systemd-journal-catalog-update to run the service with your custom unit file and its settings.

Note the following mentioned in the man page:

It has the disadvantage that improvements to the unit file by the vendor are not automatically incorporated on updates.

Since systemd now reads a completely different unit file from what is in the systemd package of your distribution, you must manually apply any updates from the file in /usr/lib to your own copy. .rpmnew (from RPM-based distributions) or .pacnew (from pacman-based ones) files that are usually generated if a configuration file tracked by the package manager has been modified by both the local administrator and the package will not be generated in this case.

4
  • so since I am trying to remove the systemd-tmpfiles-setup.service portion from the systemd-journal-catalog-update.service my override.conf file for it is not going to work? I used your command and can see that the override.conf file I created is being read. Jun 11, 2021 at 17:16
  • @RickEasley I somehow managed to miss the most important part of your question. I've updated my answer.
    – Wieland
    Jun 11, 2021 at 18:21
  • Thanks Wieland. That helps. So when it says "...you have to override the entire unit." is it meaning the entire service conf file? What would be an example of how you would do that? Is it simply using commands like sed to re-write the original service conf file? Jun 14, 2021 at 12:47
  • I've updated the answer again :)
    – Wieland
    Jun 14, 2021 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .