Bug 66643

Summary: systemctl creates the incorrect symlink when using parameter units (e.g. file@param.service).
Product: systemd Reporter: trusktr <jp>
Component: generalAssignee: systemd-bugs
Status: RESOLVED NOTABUG QA Contact: systemd-bugs
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=66889
Whiteboard:
i915 platform: i915 features:

Description trusktr 2013-07-06 12:09:25 UTC
I have a unit file named kmsconvt@.service for starting kmscon (a linux console replacement) in a tty. If I run "systemctl enable kmsconvt@tty3.service", systemd creates a symlink called kmsconvt@tty1.service instead of kmsconvt@tty3.service. Is this a bug?

This is example output:
┌─[05:08:11/starlancer/root/~]
└─╼ systemctl enable kmsconvt@tty3.service
ln -s '/usr/lib/systemd/system/kmsconvt@.service' '/etc/systemd/system/getty.target.wants/kmsconvt@tty1.service'

I would expect for the output to look like this:
┌─[05:08:11/starlancer/root/~]
└─╼ systemctl enable kmsconvt@tty3.service
ln -s '/usr/lib/systemd/system/kmsconvt@.service' '/etc/systemd/system/getty.target.wants/kmsconvt@tty3.service'
Comment 1 trusktr 2013-07-06 12:12:51 UTC
The file kmsconvt@.service looks like this:

## BEGIN FILE
[Unit]
Description=KMS System Console on %I
Documentation=man:kmscon(1)
After=systemd-user-sessions.service
After=plymouth-quit-wait.service
Before=getty.target
Conflicts=getty@%i.service
OnFailure=getty@%i.service
IgnoreOnIsolate=yes
ConditionPathExists=/dev/tty0

[Service]
ExecStart=/usr/bin/kmscon "--vt=%I" --seats=seat0 --no-switchvt
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes

[Install]
Alias=getty.target.wants/kmsconvt@tty1.service
## END FILE

Is it the Alias line that causes this issue? Is there a mistake in the file? Or is this indeed a bug?
Comment 2 Zbigniew Jedrzejewski-Szmek 2013-07-14 02:41:29 UTC
> Alias=getty.target.wants/kmsconvt@tty1.service
> Is it the Alias line that causes this issue? Is there a mistake in the file? Or is this indeed a bug?

This syntax is a leftover from before enabling of instantiated units was supported. Please change this to 'WantedBy=getty.target', and 'systemctl enable kmsconvt@tty1.service' and  'systemctl enable kmsconvt@tty3.service' should both do the right thing.

Incidentally, I removed this syntax from getty@.service unit file just a few hours ago :) (See http://cgit.freedesktop.org/systemd/systemd/commit/?id=7aa4fa3).

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.