Bug 1464364 - systemctl status does not return prompt in terminal and starts pager
systemctl status does not return prompt in terminal and starts pager
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
rawhide
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-23 05:07 EDT by Patrik Kis
Modified: 2017-07-11 01:15 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-07-11 01:15:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Patrik Kis 2017-06-23 05:07:40 EDT
Description of problem:
There is a change in behavior compared to older systemd releases. The change clearly happened between F23 and F24 (systemd-222-17.fc23 - systemd-229-16.fc24).
When running systemctl status on F24 and higher (tested on F25 and F26) starts pages also in conditions when it did not in F23.

Version-Release number of selected component (if applicable):
systemd-229-16.fc24

How reproducible:
always

Steps to Reproduce:

[root@fedora23 ~]# cat /etc/fedora-release 
Fedora release 23 (Twenty Three)
[root@fedora23 ~]# rpm -qa systemd\*
systemd-222-17.fc23.x86_64
systemd-libs-222-17.fc23.x86_64
[root@fedora23 ~]# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-06-23 07:20:24 EDT; 3h 35min left
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 867 ExecStart=/usr/sbin/sshd $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 869 (sshd)
   CGroup: /system.slice/sshd.service
           └─869 /usr/sbin/sshd

Jun 23 07:20:24 fedora23.mydomain.com systemd[1]: Starting OpenSSH server daemon...
Jun 23 07:20:24 fedora23.mydomain.com systemd[1]: sshd.service: PID file /var/run/sshd.pid not ...ory
Jun 23 07:20:24 fedora23.mydomain.com sshd[869]: Server listening on 0.0.0.0 port 22.
Jun 23 07:20:24 fedora23.mydomain.com sshd[869]: Server listening on :: port 22.
Jun 23 07:20:24 fedora23.mydomain.com systemd[1]: Started OpenSSH server daemon.
Jun 23 03:21:42 fedora23.mydomain.com sshd[3103]: Authorized to alice, krb5 principal alice@ZMR...ok)
Jun 23 03:21:42 fedora23.mydomain.com sshd[3103]: Accepted gssapi-with-mic for alice from 2620:...sh2
Jun 23 03:26:51 fedora23.mydomain.com sshd[4334]: Accepted publickey for root from 10.43.21.187.../XQ
Hint: Some lines were ellipsized, use -l to show in full.
[root@fedora23 ~]# 



[root@fedora23 systemd]# dnf update *rpm
Last metadata expiration check: 0:02:38 ago on Fri Jun 23 03:43:51 2017.
Package systemd-compat-libs not installed, cannot update it.
Package systemd-container not installed, cannot update it.
Package systemd-debuginfo not installed, cannot update it.
Package systemd-devel not installed, cannot update it.
Package systemd-journal-remote not installed, cannot update it.
Package systemd-udev not installed, cannot update it.
Dependencies resolved.
=====================================================================================================================
 Package                          Arch                  Version                    Repository                   Size
=====================================================================================================================
Installing:
 systemd-container                x86_64                229-16.fc24                @commandline                1.0 M
     replacing  systemd.x86_64 222-17.fc23
 systemd-udev                     x86_64                229-16.fc24                @commandline                1.2 M
     replacing  systemd.x86_64 222-17.fc23
Upgrading:
 systemd                          x86_64                229-16.fc24                @commandline                5.1 M
 systemd-libs                     x86_64                229-16.fc24                @commandline                456 k

Transaction Summary
=====================================================================================================================
Install  2 Packages
Upgrade  2 Packages

Total size: 7.7 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Upgrading   : systemd-libs-229-16.fc24.x86_64                                                                  1/6 
  Upgrading   : systemd-229-16.fc24.x86_64                                                                       2/6 
  Installing  : systemd-udev-229-16.fc24.x86_64                                                                  3/6 
  Installing  : systemd-container-229-16.fc24.x86_64                                                             4/6 
  Cleanup     : systemd-222-17.fc23.x86_64                                                                       5/6 
  Cleanup     : systemd-libs-222-17.fc23.x86_64                                                                  6/6 
  Verifying   : systemd-udev-229-16.fc24.x86_64                                                                  1/6 
  Verifying   : systemd-container-229-16.fc24.x86_64                                                             2/6 
  Verifying   : systemd-229-16.fc24.x86_64                                                                       3/6 
  Verifying   : systemd-libs-229-16.fc24.x86_64                                                                  4/6 
  Verifying   : systemd-libs-222-17.fc23.x86_64                                                                  5/6 
  Verifying   : systemd-222-17.fc23.x86_64                                                                       6/6 

Installed:
  systemd-container.x86_64 229-16.fc24                        systemd-udev.x86_64 229-16.fc24                       

Upgraded:
  systemd.x86_64 229-16.fc24                             systemd-libs.x86_64 229-16.fc24                            

Complete!
[root@fedora23 systemd]# 
[root@fedora23 systemd]# 
[root@fedora23 systemd]# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-06-23 07:20:24 EDT; 3h 33min left
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 869 (sshd)
   CGroup: /system.slice/sshd.service
           └─869 /usr/sbin/sshd

Jun 23 07:20:24 fedora23.mydomain.com systemd[1]: Starting OpenSSH server daemon...
Jun 23 07:20:24 fedora23.mydomain.com systemd[1]: sshd.service: PID file /var/run/sshd.pid not readab
Jun 23 07:20:24 fedora23.mydomain.com sshd[869]: Server listening on 0.0.0.0 port 22.
Jun 23 07:20:24 fedora23.mydomain.com sshd[869]: Server listening on :: port 22.
Jun 23 07:20:24 fedora23.mydomain.com systemd[1]: Started OpenSSH server daemon.
Jun 23 03:21:42 fedora23.mydomain.com sshd[3103]: Authorized to alice, krb5 principal alice@ZMRAZ.COM
Jun 23 03:21:42 fedora23.mydomain.com sshd[3103]: Accepted gssapi-with-mic for alice from 2620:52:0:1
Jun 23 03:26:51 fedora23.mydomain.com sshd[4334]: Accepted publickey for root from 10.43.21.187 port 
lines 1-17/17 (END)
Comment 1 Zbigniew Jędrzejewski-Szmek 2017-06-23 07:48:57 EDT
Yes, this seems to be on purpose. Why do you think it's a bug?
Comment 2 Jan Synacek 2017-06-29 10:40:23 EDT
I think that the main point, which is not obvious here, is that the pager is started, when the output does not fit into the *width* of the terminal, not its height.
Comment 3 Michal Sekletar 2017-07-03 04:02:20 EDT
(In reply to Jan Synacek from comment #2)
> I think that the main point, which is not obvious here, is that the pager is
> started, when the output does not fit into the *width* of the terminal, not
> its height.

I've observed different behavior on F25. Pager is started when output doesn't fit  width OR height of the terminal window.

However, in this specific case (I discussed the issue with Patrik in person) systemctl command is called from script via some wrapper function. Because of change in behavior script never finishes since its gets stuck and there is no one on the terminal to hit the 'q' to exit the pager.
Comment 4 Michal Sekletar 2017-07-03 04:15:07 EDT
Very quick git log search revealed this commit,

https://github.com/systemd/systemd/commit/45090bf2ff43217116fc2497b4442320dffabf86

That commit introduced change in behavior. However, current behavior seems to be fine, in a sense that pager is really desirable when systemctl output gets very long.
Comment 5 Zbigniew Jędrzejewski-Szmek 2017-07-11 01:15:16 EDT
Yes, --no-pager should be used if the output is connected to a tty and a pager is not desired. Normally this doesn't come up because when the output is piped to a file or another program, the pager is not started. I'll close this as not-a-bug, since things are working as designed here.

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