Bug 90277

Summary: "Failed to execute operation: File exists" when enabling a service that is already enabled via symlink to /lib (rather than /usr/lib)
Product: systemd Reporter: Adam Williamson <adamw>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: minor    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Adam Williamson 2015-05-01 19:09:29 UTC
Saw this on 'dnf update' on Fedora 22 today:

Failed to execute operation: File exists
warning: %triggerun(rpcbind-0.2.3-0.0.fc22.x86_64) scriptlet failed, exit status 1
Non-fatal <unknown> scriptlet failure in rpm package rpcbind

This is caused by:

%triggerun -- rpcbind > 0.2.2-2.0
/bin/systemctl enable rpcbind.socket

I can reproduce it by running the command manually:

[adamw@adam rpcbind (f22)]$ sudo systemctl enable rpcbind.socket
Failed to execute operation: File exists

However, some others said they couldn't. Eventually I figured out the difference. Services are 'enabled' via symlinks in special directories. Note where the symlink for rpcbind.socket points on my system:

[root@adam system]# ls -l /etc/systemd/system/sockets.target.wants/rpcbind.socket 
lrwxrwxrwx. 1 root root 34 Sep 13  2011 /etc/systemd/system/sockets.target.wants/rpcbind.socket -> /lib/systemd/system/rpcbind.socket

the target is in /lib, not /usr/lib - because this is an old install that has been updated all the way to F22, rpcbind.socket was originally enabled before the /usr move. If I disable and re-enable the service manually, the symlink target is updated to /usr/lib:

[root@adam system]# systemctl disable rpcbind.socket
Removed symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket.
[root@adam system]# systemctl enable rpcbind.socket
Created symlink from /etc/systemd/system/sockets.target.wants/rpcbind.socket to /usr/lib/systemd/system/rpcbind.socket.
[root@adam system]# ls -l /etc/systemd/system/sockets.target.wants/rpcbind.socket
lrwxrwxrwx. 1 root root 38 May  1 12:07 /etc/systemd/system/sockets.target.wants/rpcbind.socket -> /usr/lib/systemd/system/rpcbind.socket

and now the bug doesn't happen any more:

[root@adam system]# systemctl enable rpcbind.socket
[root@adam system]# 

Still, this could be an annoyance to users who have older installs, if it can be fixed somehow that'd be good.
Comment 1 Zbigniew Jedrzejewski-Szmek 2017-01-31 19:23:16 UTC
PR #4390 should take care of this.
//github.com/systemd/systemd/commit/e6fa8681dc.

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.