Bug 73290 - RFE: Make linking an instance service to a non-instance name possible
Summary: RFE: Make linking an instance service to a non-instance name possible
Status: RESOLVED INVALID
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium enhancement
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-04 23:18 UTC by calimeroteknik
Modified: 2019-08-22 10:48 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description calimeroteknik 2014-01-04 23:18:39 UTC
** Description: **

Say we have /etc/systemd/system/mydisplaymanager@.service, that contains:
[Install]
Alias=display-manager.service

I would find very useful that such a thing would work:

# systemctl enable mydisplaymanager@myuser.service
ln -sf '/etc/systemd/system/mydisplaymanager@myuser.service' '/etc/systemd/system/display-manager.service'

The use case here is pretty obvious: it's a user-bound login manager.



** Present situation: **
# systemctl enable mydisplaymanager@myuser.service
ln -sf '/etc/systemd/system/mydisplaymanager@.service' '/etc/systemd/system/display-manager.service'

I tried creating the symlink by hand:
# ln -sf '/etc/systemd/system/mydisplaymanager@myuser.service' '/etc/systemd/system/display-manager.service'

And:
# systemctl status display-manager.service
display-manager.service
   Loaded: not-found (Reason: No such file or directory)
   Adrive: inactive (dead)


Looking forward to this feature in v209!
Comment 1 naroyce 2015-06-20 13:07:40 UTC
+1 on this for me.
I just encountered this issue where I keep my scripts and service/timer files in my Documents folder and simply want to link to the files in that folder.

It would just make things easier to have the file linked so I can make changes to the file and have it reflected to a location that gets backed-up.
Comment 2 Zbigniew Jedrzejewski-Szmek 2019-08-22 10:48:06 UTC
Nope, can't do that. We'd have a situation where the unit would both have an instance and not have an instance. This would confuse things to no end.

That said, it is possible to link an instance name to a unit file outside of the unit search path, and then the symlink target can be arbitrary, it doesn't even have to be a valid unit name:

$ ln -sf '/etc/systemd/system/mydisplaymanager@.service' '/etc/systemd/system/display-manager.service' → not OK
$ cp /etc/systemd/system/mydisplaymanager@.service /etc/display_manager_service
$ ln -s /etc/display_manager_service  '/etc/systemd/system/display-manager.service' → OK


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.