Bug 2123927

Summary: Enabling a service with Alias fails with "Invalid cross-device link"
Product: Red Hat Enterprise Linux 9 Reporter: Takashi Kajinami <tkajinam>
Component: systemdAssignee: Jacek Migacz <jmigacz>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, dtardon, jamacku, jwboyer, msekleta, systemd-maint-list
Target Milestone: rcKeywords: Reopened, TestOnly, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: systemd-252-2.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 08:21:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Takashi Kajinami 2022-09-03 06:22:35 UTC
Description of problem:

This was initially reported in bz 2123742 .

Since systemd-250-11.el9 was released, enabling a service with Alias fails with the "Invalid cross-device link" error.
The command fails but the service is actually enabled.

The problem is not reproduced when systemd-250-07.el9 is used.

```
[vagrant@localhost ~]$ sudo systemctl status neutron-ovn-metadata-agent.service --no-pager
○ neutron-ovn-metadata-agent.service - OpenStack Neutron OVN Metadata Agent
     Loaded: loaded (/usr/lib/systemd/system/neutron-ovn-metadata-agent.service; disabled; vendor preset: disabled)
     Active: inactive (dead)

Sep 03 06:06:09 localhost.localdomain systemd[1]: Stopping OpenStack Neutron OVN Metadata Agent...
Sep 03 06:06:09 localhost.localdomain systemd[1]: neutron-ovn-metadata-agent.service: Deactivated successfully.
Sep 03 06:06:09 localhost.localdomain systemd[1]: Stopped OpenStack Neutron OVN Metadata Agent.
Sep 03 06:06:09 localhost.localdomain systemd[1]: neutron-ovn-metadata-agent.service: Consumed 1.951s CPU time.
Sep 03 06:06:09 localhost.localdomain systemd[1]: Started OpenStack Neutron OVN Metadata Agent.
Sep 03 06:06:11 localhost.localdomain sudo[31446]:  neutron : PWD=/ ; USER=root ; COMMAND=/usr/bin/neutron-rootwrap /…
Sep 03 06:06:21 localhost.localdomain systemd[1]: Stopping OpenStack Neutron OVN Metadata Agent...
Sep 03 06:06:22 localhost.localdomain systemd[1]: neutron-ovn-metadata-agent.service: Deactivated successfully.
Sep 03 06:06:22 localhost.localdomain systemd[1]: Stopped OpenStack Neutron OVN Metadata Agent.
Sep 03 06:06:22 localhost.localdomain systemd[1]: neutron-ovn-metadata-agent.service: Consumed 1.955s CPU time.
Hint: Some lines were ellipsized, use -l to show in full.

[vagrant@localhost ~]$ sudo cat /usr/lib/systemd/system/neutron-ovn-metadata-agent.service 
[Unit]
Description=OpenStack Neutron OVN Metadata Agent
After=syslog.target network.target openvswitch.service
Requires=openvswitch.service

[Service]
Type=simple
User=neutron
PermissionsStartOnly=true
ExecStart=/usr/bin/neutron-ovn-metadata-agent --config-file /etc/neutron/neutron_ovn_metadata_agent.ini --config-dir /etc/neutron/conf.d/neutron-ovn-metadata-agent --log-file /var/log/neutron/neutron-ovn-metadata-agent.log
PrivateTmp=false
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
# (TODO) - Backwards compatibility in systemd service
Alias=networking-ovn-metadata-agent
[vagrant@localhost ~]$ sudo ls -lah /usr/lib/systemd/system/neutron-ovn-metadata-agent.service 
-rw-r--r--. 1 root root 606 Oct 12  2021 /usr/lib/systemd/system/neutron-ovn-metadata-agent.service                     
[vagrant@localhost ~]$ sudo ls -lah /usr/lib/systemd/system/networking-ovn-metadata-agent.service 
lrwxrwxrwx. 1 root root 58 Aug 30 17:14 /usr/lib/systemd/system/networking-ovn-metadata-agent.service -> /usr/lib/systemd/system/neutron-ovn-metadata-agent.service
[vagrant@localhost ~]$ sudo systemctl enable neutron-ovn-metadata-agent.service
Failed to enable unit: File networking-ovn-metadata-agent: Invalid cross-device link
[vagrant@localhost ~]$ echo $?
1
[vagrant@localhost ~]$ sudo systemctl status neutron-ovn-metadata-agent.service --no-pager
○ neutron-ovn-metadata-agent.service - OpenStack Neutron OVN Metadata Agent
     Loaded: loaded (/usr/lib/systemd/system/neutron-ovn-metadata-agent.service; enabled; vendor preset: disabled)
     Active: inactive (dead)

Sep 03 06:06:09 localhost.localdomain systemd[1]: Stopping OpenStack Neutron OVN Metadata Agent...
Sep 03 06:06:09 localhost.localdomain systemd[1]: neutron-ovn-metadata-agent.service: Deactivated successfully.
Sep 03 06:06:09 localhost.localdomain systemd[1]: Stopped OpenStack Neutron OVN Metadata Agent.
Sep 03 06:06:09 localhost.localdomain systemd[1]: neutron-ovn-metadata-agent.service: Consumed 1.951s CPU time.
Sep 03 06:06:09 localhost.localdomain systemd[1]: Started OpenStack Neutron OVN Metadata Agent.
Sep 03 06:06:11 localhost.localdomain sudo[31446]:  neutron : PWD=/ ; USER=root ; COMMAND=/usr/bin/neutron-rootwrap /…
Sep 03 06:06:21 localhost.localdomain systemd[1]: Stopping OpenStack Neutron OVN Metadata Agent...
Sep 03 06:06:22 localhost.localdomain systemd[1]: neutron-ovn-metadata-agent.service: Deactivated successfully.
Sep 03 06:06:22 localhost.localdomain systemd[1]: Stopped OpenStack Neutron OVN Metadata Agent.
Sep 03 06:06:22 localhost.localdomain systemd[1]: neutron-ovn-metadata-agent.service: Consumed 1.955s CPU time.
Hint: Some lines were ellipsized, use -l to show in full.
```


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Create a service with Alias
2. Enable the service by
 $ systemctl enable <service name>.service

Actual results:
systemctl command fails

Expected results:
systemctl command does not fail

Additional info:

Comment 1 David Tardon 2022-09-05 11:52:35 UTC
(In reply to Takashi Kajinami from comment #0)
> [Install]
> WantedBy=multi-user.target
> # (TODO) - Backwards compatibility in systemd service
> Alias=networking-ovn-metadata-agent

Add .service suffix and it will work as expected. I'm not even sure this is a bug--and if it is, what the correct behavior should be...

Comment 2 Takashi Kajinami 2022-09-05 12:25:55 UTC
Thanks David. I totally missed that and I don't know how it has been working until now...

I've locally tested the edit and confirmed it resolves the error. I'll fix the service file in the package accordingly.

Thanks for your quick help !

Comment 8 errata-xmlrpc 2023-05-09 08:21:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (systemd bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2531