Bug 1223617

Summary: systemd-tmpfiles-setup finds configuration in /etc/tmpfiles.d as duplicate instead of overridding base config
Product: [openSUSE] openSUSE Distribution Reporter: Ethan Bonick <ethan.bonick>
Component: BasesystemAssignee: systemd maintainers <systemd-maintainers>
Status: RESOLVED INVALID QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: radoslav.kolev
Version: Leap 15.5   
Target Milestone: ---   
Hardware: x86-64   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Ethan Bonick 2024-05-01 19:41:12 UTC
Systemd is not overwriting but marking as duplicate and ignores desired changes in configuration files. This is also seen on SUSE 15.SP5 as both are using the same version of systemd.

foobar:~ # rpm -qa |grep systemd
systemd-lang-249.17-150400.8.40.1.noarch
systemd-presets-common-SUSE-15-150500.20.6.1.noarch
systemd-default-settings-branding-openSUSE-0.10-150300.3.7.1.noarch
python3-systemd-234-5.3.5.x86_64
systemd-default-settings-0.10-150300.3.7.1.noarch
systemd-249.17-150400.8.40.1.x86_64
systemd-sysvinit-249.17-150400.8.40.1.x86_64
systemd-rpm-macros-15-150000.7.39.1.noarch
libsystemd0-249.17-150400.8.40.1.x86_64
util-linux-systemd-2.37.4-150500.9.6.1.x86_64
systemd-presets-branding-openSUSE-12.2-lp155.4.5.noarch
systemd-network-249.17-150400.8.40.1.x86_64
grub2-systemd-sleep-plugin-2.06-150500.29.25.12.noarch
systemd-doc-249.17-150400.8.40.1.x86_64

foobar:~ # uname -r
5.14.21-150500.55.59-default


● systemd-tmpfiles-setup.service - Create Volatile Files and Directories
     Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-setup.service; static)
     Active: active (exited) since Wed 2024-05-01 13:10:13 CDT; 59min ago
       Docs: man:tmpfiles.d(5)
             man:systemd-tmpfiles(8)
    Process: 795 ExecStart=systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev (code=exited, status=0/SUCCESS)
   Main PID: 795 (code=exited, status=0/SUCCESS)

May 01 13:10:13 foobar systemd[1]: Starting Create Volatile Files and Directories...
May 01 13:10:13 foobar systemd-tmpfiles[795]: /usr/lib/tmpfiles.d/systemd-resolve.conf:10: Duplicate line for path "/etc/resolv.conf", ignoring.
May 01 13:10:13 foobar systemd-tmpfiles[795]: /etc/tmpfiles.d/var.conf:14: Duplicate line for path "/var/log", ignoring.
May 01 13:10:13 foobar systemd-tmpfiles[795]: /etc/tmpfiles.d/var.conf:15: Duplicate line for path "/var/log/wtmp", ignoring.
May 01 13:10:13 foobar systemd-tmpfiles[795]: /etc/tmpfiles.d/var.conf:16: Duplicate line for path "/var/log/btmp", ignoring.
May 01 13:10:13 foobar systemd-tmpfiles[795]: /etc/tmpfiles.d/var.conf:17: Duplicate line for path "/var/log/lastlog", ignoring.
May 01 13:10:13 foobar systemd-tmpfiles[795]: /etc/tmpfiles.d/var.conf:19: Duplicate line for path "/var/cache", ignoring.
May 01 13:10:13 foobar systemd-tmpfiles[795]: /etc/tmpfiles.d/var.conf:21: Duplicate line for path "/var/lib", ignoring.
May 01 13:10:13 foobar systemd-tmpfiles[795]: /etc/tmpfiles.d/var.conf:23: Duplicate line for path "/var/spool", ignoring.
May 01 13:10:13 foobar systemd[1]: Finished Create Volatile Files and Directories.
Comment 1 Radoslav Kolev 2024-05-22 14:57:44 UTC
Hello!

Where does the file /etc/tmpfiles.d/var.conf come from?

Can you share its contents?

It is expected to get the duplicate warning in the log if multiple files specify the same path. See CONFIGURATION DIRECTORIES AND PRECEDENCE section of 'man tmpfiles.d'.

If you want to override some settings from a system supplied file found under  
/usr/lib/tmpfiles.d/ then you have to create a file with the same name under /etc/tmpfiles.d/ and in this way the on under /usr/lib/tmpfiles.d/ will be ignored.
Comment 2 Radoslav Kolev 2024-06-12 11:23:38 UTC
Hello, any development on this issue or we can consider it solved?
Comment 3 Ethan Bonick 2024-06-12 13:01:56 UTC
My IDP login isn't working and no one responds to emails sent to the bugzilla admin email address. I just had to create another account using another email address.

I created /etc/tmpfiles.d/var/conf and it contains
#  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.

# See tmpfiles.d(5) for details

q /var 0755 - - -

L /var/run - - - - ../run

d /var/log 0755 - - -
f /var/log/wtmp 0640 root utmp -
f /var/log/btmp 0640 root utmp -
f /var/log/lastlog 0640 root utmp -
f /var/log/boot.msg 0640 root root -
f /var/log/boot.omsg 0640 root root -

d /var/cache 0755 - - -

d /var/lib 0755 - - -

d /var/spool 0755 - - -

Below is the output from the opensuse box before reboot and then after reboot. The files defined in the /etc/tmpfiles.d/var.conf do not have the permissions defined.

user@foohost:~> date
Wed 12 Jun 2024 07:41:46 AM CDT
user@foohost:~> sudo systemctl status systemd-tmpfiles-setup
● systemd-tmpfiles-setup.service - Create Volatile Files and Directories
     Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-setup.service; static)
     Active: active (exited) since Thu 2024-05-16 08:19:43 CDT; 3 weeks 5 days ago
       Docs: man:tmpfiles.d(5)
             man:systemd-tmpfiles(8)
    Process: 793 ExecStart=systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev (code=exited, status=0/SUCCESS)
   Main PID: 793 (code=exited, status=0/SUCCESS)

May 16 08:19:43 foohost systemd[1]: Starting Create Volatile Files and Directories...
May 16 08:19:43 foohost systemd-tmpfiles[793]: /usr/lib/tmpfiles.d/systemd-resolve.conf:10: Duplicate line for path "/etc/resolv.conf", ignoring.
May 16 08:19:43 foohost systemd-tmpfiles[793]: /etc/tmpfiles.d/var.conf:14: Duplicate line for path "/var/log", ignoring.
May 16 08:19:43 foohost systemd-tmpfiles[793]: /etc/tmpfiles.d/var.conf:15: Duplicate line for path "/var/log/wtmp", ignoring.
May 16 08:19:43 foohost systemd-tmpfiles[793]: /etc/tmpfiles.d/var.conf:16: Duplicate line for path "/var/log/btmp", ignoring.
May 16 08:19:43 foohost systemd-tmpfiles[793]: /etc/tmpfiles.d/var.conf:17: Duplicate line for path "/var/log/lastlog", ignoring.
May 16 08:19:43 foohost systemd-tmpfiles[793]: /etc/tmpfiles.d/var.conf:19: Duplicate line for path "/var/cache", ignoring.
May 16 08:19:43 foohost systemd-tmpfiles[793]: /etc/tmpfiles.d/var.conf:21: Duplicate line for path "/var/lib", ignoring.
May 16 08:19:43 foohost systemd-tmpfiles[793]: /etc/tmpfiles.d/var.conf:23: Duplicate line for path "/var/spool", ignoring.
May 16 08:19:43 foohost systemd[1]: Finished Create Volatile Files and Directories.
user@foohost:~> sudo ls -la /var/log/wtmp
-rw-rw-r-- 1 root utmp 82176 Jun 12 07:40 /var/log/wtmp
user@foohost:~> cat /etc/tmpfiles.d/var.conf
#  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.

# See tmpfiles.d(5) for details

q /var 0755 - - -

L /var/run - - - - ../run

d /var/log 0755 - - -
f /var/log/wtmp 0640 root utmp -
f /var/log/btmp 0640 root utmp -
f /var/log/lastlog 0640 root utmp -

d /var/cache 0755 - - -

d /var/lib 0755 - - -

d /var/spool 0755 - - -

REBOOT

user@foohost:~> date
Wed 12 Jun 2024 07:57:30 AM CDT
user@foohost:~> uptime
 07:57:33  up   0:04,  1 user,  load average: 0.78, 0.91, 0.45
user@foohost:~> sudo ls -la /var/log/wtmp
[sudo] password for user:
-rw-rw-r-- 1 root utmp 84864 Jun 12 07:57 /var/log/wtmp
user@foohost:~> cat /etc/tmpfiles.d/var.conf
#  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.

# See tmpfiles.d(5) for details

q /var 0755 - - -

L /var/run - - - - ../run

d /var/log 0755 - - -
f /var/log/wtmp 0640 root utmp -
f /var/log/btmp 0640 root utmp -
f /var/log/lastlog 0640 root utmp -

d /var/cache 0755 - - -

d /var/lib 0755 - - -

d /var/spool 0755 - - -
user@foohost:~> sudo systemctl status systemd-tmpfiles-setup
● systemd-tmpfiles-setup.service - Create Volatile Files and Directories
     Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-setup.service; static)
     Active: active (exited) since Wed 2024-06-12 07:53:27 CDT; 4min 37s ago
       Docs: man:tmpfiles.d(5)
             man:systemd-tmpfiles(8)
    Process: 811 ExecStart=systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev (code=exited, status=0/SUCCESS)
   Main PID: 811 (code=exited, status=0/SUCCESS)

Jun 12 07:53:27 foohost systemd[1]: Starting Create Volatile Files and Directories...
Jun 12 07:53:27 foohost systemd-tmpfiles[811]: /usr/lib/tmpfiles.d/systemd-resolve.conf:10: Duplicate line for path "/etc/resolv.conf", ignoring.
Jun 12 07:53:27 foohost systemd-tmpfiles[811]: /etc/tmpfiles.d/var.conf:14: Duplicate line for path "/var/log", ignoring.
Jun 12 07:53:27 foohost systemd-tmpfiles[811]: /etc/tmpfiles.d/var.conf:15: Duplicate line for path "/var/log/wtmp", ignoring.
Jun 12 07:53:27 foohost systemd-tmpfiles[811]: /etc/tmpfiles.d/var.conf:16: Duplicate line for path "/var/log/btmp", ignoring.
Jun 12 07:53:27 foohost systemd-tmpfiles[811]: /etc/tmpfiles.d/var.conf:17: Duplicate line for path "/var/log/lastlog", ignoring.
Jun 12 07:53:27 foohost systemd-tmpfiles[811]: /etc/tmpfiles.d/var.conf:19: Duplicate line for path "/var/cache", ignoring.
Jun 12 07:53:27 foohost systemd-tmpfiles[811]: /etc/tmpfiles.d/var.conf:21: Duplicate line for path "/var/lib", ignoring.
Jun 12 07:53:27 foohost systemd-tmpfiles[811]: /etc/tmpfiles.d/var.conf:23: Duplicate line for path "/var/spool", ignoring.
Jun 12 07:53:27 foohost systemd[1]: Finished Create Volatile Files and Directories.
user@foohost:~>
Comment 4 Ethan Bonick 2024-06-12 13:32:12 UTC
I wasn't reading carefully enough and didn't realize the config files had to be the same name as the original to overwrite. I did an initial test and it seems to be working. Do we know the logic behind the decision to force the file name to match for an override vs creating your own configuration file and matching off the contents?
Comment 5 Radoslav Kolev 2024-07-05 07:48:35 UTC
I don't know the exact reasons, but it's the upstream behaviour.
Comment 6 Radoslav Kolev 2024-07-05 07:50:39 UTC
Closing as invalid, as it's the expected behaviour.