Bug 85899

Summary: Duplicate file after creating presets
Product: systemd Reporter: Umut Tezduyar <umut>
Component: generalAssignee: systemd-bugs
Status: NEW --- QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Umut Tezduyar 2014-11-05 07:51:27 UTC
systemd 216:

I have noticed that unit_file_preset_all() in src/core/main.c creates a duplicate symb link for a rsyslog service. rsyslog.service looks like this:

# cat /usr/lib/systemd/system/rsyslog.service
[Unit]
Description=System Logging Service

[Service]
ExecStartPre=-/bin/systemctl stop systemd-kmsg-syslogd.service
ExecStart=/usr/sbin/rsyslogd -n -c5
Sockets=syslog.socket
StandardOutput=null

[Install]
WantedBy=multi-user.target
Alias=syslog.service

systemd-delta shows that we have extra link popping up in /etc

# systemd-delta 
[EQUIVALENT] /etc/systemd/system/syslog.service -> /usr/lib/systemd/system/syslog.service

1 overridden configuration files found.

And both of the are pointing to the same file:

# readlink /etc/systemd/system/syslog.service
/usr/lib/systemd/system/rsyslog.service
# readlink /usr/lib/systemd/system/syslog.service
rsyslog.service
Comment 1 Zbigniew Jedrzejewski-Szmek 2014-11-06 02:05:16 UTC
The [Install] section contains two stanzas, so I would expect two symlinks. One to pull in rsyslog.service into m-u.target, and the other one two cause rsyslog.service to be linked to with the syslog.service name.

Are you talking about the symlink /usr/lib/systemd/system/syslog.service? I don't think systemctl or systemd create it, maybe it comes from the packaging system?
Comment 2 Umut Tezduyar 2014-11-06 07:35:04 UTC
All the things that are in [Install] are available in /usr/lib/ before systemd boots (in the file system). When systemd boots, it decides to create (by unit_file_preset_all() function) "/etc/systemd/system/syslog.service" even though we have "/usr/lib/systemd/system/syslog.service" in the file system. 

Note: It doesn't create link under /etc/systemd/system/multi-user.target.wants. Somehow it is smart to understand that there is already a link in /usr/lib/systemd/system/multi-user.target.wants. 

I suspect, we are failing on Alias= somehow.
Comment 3 Zbigniew Jedrzejewski-Szmek 2019-08-22 10:55:01 UTC
Still the same issue in systemd-243-rc2 ;(

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.