Bug 1206007 - systemd seems not to search template with "systemctl enable"
Summary: systemd seems not to search template with "systemctl enable"
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.1
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-26 06:14 UTC by Kazuo Moriwaka
Modified: 2015-04-02 08:02 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-04-02 08:02:36 UTC
Target Upstream Version:


Attachments (Terms of Use)
strace -p 1 -e file in F21 (272.08 KB, text/plain)
2015-03-26 06:14 UTC, Kazuo Moriwaka
no flags Details
strace -p 1 -e file in RHEL7.1 (99.81 KB, text/plain)
2015-03-26 06:14 UTC, Kazuo Moriwaka
no flags Details

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@ttyS0.service", 
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@ttyS0.service 

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@ttyS0.service 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@ttyS0.service 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@ttyS0.service", 0x7ffff2387d20) = -1 ENOENT (No such file or directory)
open("/etc/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/run/systemd/system/serial-getty@ttyS0.service", 0x7ffff2387d20) = -1 ENOENT (No such file or directory)
open("/run/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/usr/local/lib/systemd/system/serial-getty@ttyS0.service", 0x7ffff2387d20) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/usr/lib/systemd/system/serial-getty@ttyS0.service", 0x7ffff2387d20) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/system/serial-getty@ttyS0.service", 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@ttyS0.service", 0x7ffdd495d6e0) = -1 ENOENT (No such file or directory)
open("/etc/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/run/systemd/system/serial-getty@ttyS0.service", 0x7ffdd495d6e0) = -1 ENOENT (No such file or directory)
open("/run/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/usr/local/lib/systemd/system/serial-getty@ttyS0.service", 0x7ffdd495d6e0) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
lstat("/usr/lib/systemd/system/serial-getty@ttyS0.service", 0x7ffdd495d6e0) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/etc/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/run/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/systemd/system/serial-getty@ttyS0.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/system/serial-getty@ttyS0.service", 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@ttyS0.service") = 0
open("/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service", 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@ttyS0.service", "/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@ttyS2.service
# systemctl start serial-getty@ttyS2.service
-----------------------------------------------------------

-----------------------------------------------------------
[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@ttyS2.service ; 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.service - 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@openvpn.service
           └─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.


Note You need to log in before you can comment on or make changes to this bug.