Bug 1206007

Summary: systemd seems not to search template with "systemctl enable"
Product: Red Hat Enterprise Linux 7 Reporter: Kazuo Moriwaka <kmoriwak>
Component: systemdAssignee: systemd-maint
Status: CLOSED CURRENTRELEASE QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: admiller, kevin, lnykryn, msekleta, pbrobinson, systemd-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-02 08:02:36 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:
Attachments:
Description Flags
strace -p 1 -e file in F21
none
strace -p 1 -e file in RHEL7.1 none

Description Kazuo Moriwaka 2015-03-26 06:14:01 UTC
Created attachment 1006675 [details]
strace -p 1 -e file in F21

Description of problem:

When I do "systemctl enable serial-getty", 
systemd doesn't find template /usr/lib/systemd/system/serial-getty@.service


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

systemd-208-20.el7.x86_64

How reproducible:

Always

Steps to Reproduce:
1. clean install rhel7.1
2. # systemctl enable serial-getty 

Actual results:

output "Failed to issue method call: No such file or directory" and link is not created.

Expected results:

symlink to enable serial-getty is created.

With my F21 environment, same command cause following message and made link.
"Created symlink from /etc/systemd/system/getty.target.wants/serial-getty to /usr/lib/systemd/system/serial-getty@.service."


Additional info:

With this reproducing, I took systemd's file operations with strace like following.
# strace -p 1 -e file -o systemd.strace

and the output seems systemd in RHEL7 doesn't search template.  

RHEL7# grep serial-getty systemd.strace
-----------------------------------------------------------
getxattr("/usr/lib/systemd/system/serial-getty@.service", "security.selinux", "system_u:object_r:getty_unit_file_t:s0", 255) = 39
lstat("/etc/systemd/system/serial-getty", 0x7ffff2387d20) = -1 ENOENT (No such file or directory)
open("/etc/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/run/systemd/system/serial-getty", 0x7ffff2387d20) = -1 ENOENT (No such file or directory)
open("/run/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/usr/local/lib/systemd/system/serial-getty", 0x7ffff2387d20) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/usr/lib/systemd/system/serial-getty", 0x7ffff2387d20) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
-----------------------------------------------------------

F21# grep serial-getty systemd.strace
-----------------------------------------------------------
lstat("/etc/systemd/system/serial-getty", 0x7ffdd495d6e0) = -1 ENOENT (No such file or directory)
open("/etc/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/run/systemd/system/serial-getty", 0x7ffdd495d6e0) = -1 ENOENT (No such file or directory)
open("/run/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/usr/local/lib/systemd/system/serial-getty", 0x7ffdd495d6e0) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/usr/lib/systemd/system/serial-getty", 0x7ffdd495d6e0) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/etc/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/run/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/system/serial-getty", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/etc/systemd/system/serial-getty@.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/run/systemd/system/serial-getty@.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/systemd/system/serial-getty@.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/system/serial-getty@.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = 16
symlink("/usr/lib/systemd/system/serial-getty@.service", "/etc/systemd/system/getty.target.wants/serial-getty") = 0
open("/etc/systemd/system/getty.target.wants/serial-getty", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ELOOP (Too many levels of symbolic links)
readlinkat(AT_FDCWD, "/etc/systemd/system/getty.target.wants/serial-getty", "/usr/lib/systemd/system/serial-g"..., 99) = 45
open("/usr/lib/systemd/system/serial-getty@.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = 14
-----------------------------------------------------------

Comment 1 Kazuo Moriwaka 2015-03-26 06:14:45 UTC
Created attachment 1006677 [details]
strace -p 1 -e file in RHEL7.1

Comment 3 Kazuo Moriwaka 2015-03-26 06:43:15 UTC
I understand that systemd-208 will have function to make symlink to template.

Followings are quotation from Lennart's blog.
http://0pointer.de/blog/projects/serial-console.html

-----------------------------------------------------------
In many cases, this automatic logic should already suffice to get you a login prompt when you need one, without any specific configuration of systemd. However, sometimes there's the need to manually configure a serial getty, for example, if more than one serial login prompt is needed or the kernel console should be redirected to a different terminal than the login prompt. To facilitate this it is sufficient to instantiate serial-getty@.service once for each serial port you want it to run on[7]:

# systemctl enable serial-getty
# systemctl start serial-getty
-----------------------------------------------------------

-----------------------------------------------------------
[7] Note that this systemctl enable syntax only works with systemd 188 and newer (i.e. F18). On older versions use ln -s /usr/lib/systemd/system/serial-getty@.service /etc/systemd/system/getty.target.wants/serial-getty ; systemctl daemon-reload instead.
-----------------------------------------------------------

Comment 4 Lukáš Nykrýn 2015-03-26 08:16:39 UTC
That should work -> devel_ack.

Comment 5 Kevin Fenzi 2015-03-26 13:34:53 UTC
I'll note we are hitting this also with openvpn. ;( 

# systemctl enable openvpn@openvpn
Failed to issue method call: No such file or directory

# systemctl status openvpn@openvpn                                                   
openvpn - OpenVPN Robust And Highly Flexible Tunneling Application On openvpn
   Loaded: loaded (/usr/lib/systemd/system/openvpn@.service; enabled)
   Active: active (running) since Thu 2015-03-26 13:15:00 UTC; 19min ago
  Process: 32117 ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf (code=exited, status=0/SUCCESS)
 Main PID: 32131 (openvpn)
   CGroup: /system.slice/system-openvpn.slice/openvpn
           └─32131 /usr/sbin/openvpn --daemon --writepid /var/run/openvpn/openvpn.pid --cd /etc/openvpn/ --c...

Comment 6 Michal Sekletar 2015-04-02 08:02:36 UTC
This is now fixed in systemd-208-20.el7_1.2.