Bug 1753037

Summary: unable to paste anything with systemctl or service start, stop, restart commands in terminal session
Product: Red Hat Enterprise Linux 7 Reporter: tech
Component: polkitAssignee: Polkit Maintainers <polkit-devel>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.7CC: alexey, dtardon, emil, jrybar, me, msekleta, nenad, systemd-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: polkit-0.112-24.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1757853 (view as bug list) Environment:
Last Closed: 2020-03-31 20:05:49 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:
Bug Depends On:    
Bug Blocks: 1757853    
Attachments:
Description Flags
drain instead of flush on terminal setattr none

Description tech 2019-09-17 21:54:25 UTC
Description of problem:

Updated a CentOS 7.6 system to CentOS 7.7 today and now pasting multiple lines in SSH bash terminal session does not paste commands after a systemctl/service start,stop,restart 

[root@server ~]# cat /etc/*release*
CentOS Linux release 7.7.1908 (Core)
...
[root@server ~]#
[root@server ~]# uname -r
3.10.0-1062.1.1.el7.x86_64
[root@server ~]#
[root@server ~]# rpm -qa | grep systemd
systemd-sysv-219-67.el7_7.1.x86_64
systemd-libs-219-67.el7_7.1.x86_64
systemd-219-67.el7_7.1.x86_64
[root@server ~]#

How reproducible:
every time when either systemctl or service start, stop, restart cmds are in the pasted group of cmds.

Steps to reproduce:
1. install CentOS 7 1810 minimal
2. paste multiple commands to test

#example
systemctl restart tuned.service
1
2
3

This will work on CentOS 7.6

3. yum update, reboot

4. paste multiple commands to test again

#example
systemctl restart tuned.service
1
2
3

This will no longer work on CentOS 7.7 pasting all commands

Actual results:
only the 1st command systemctl/service start, stop, restart will paste. No commands following it.

Expected results:
all commands to paste to the SSH terminal session

Comment 2 David Tardon 2019-09-18 06:32:56 UTC
I'm not quite sure what you're talking about... Do the numbers in your example represent other commands? If yes, why didn't you write some other commands instead (e.g., "echo 1" etc.)? I don't like to play guessing games in the morning... Anyway, I can imagine only two scenarios which could lead to this situation:

1. systemctl hangs, so the following commands are not executed at all
2. systemctl mangles the terminal so badly that the output of the following commands is not visible

In both cases the shell is not usable without further action (^C or "reset", respectively). But you didn't mention that...

Comment 3 Dico Emil 2019-09-18 12:28:54 UTC
Hi David,

The issue appears after polkit upgrade. 

The systemctl does not hang, exits properly etc, but the whole buffer of copy/pasted commands following the systemctl command is gone. This is triggered only when you do a systemctl stop/start/restart etc of whatever service, because polkit is involved. 

In case of emergency (which of course will cause probably other issues with deps and X related etc):
rpm -e polkit.x86_64 --nodeps

Comment 4 tech 2019-09-18 15:25:35 UTC
Hi David,

yes its representing 4 lines of any commands being pasted with a systemctl or service command.  In this example below only the 1st command will paste.  It stops after the 1st systemctl command.  I've tried 3 different ssh terminal apps - putty, kitty, mobaxterm all same results.

#example
systemctl restart tuned.service
echo "1"
echo "2"
echo "3"

Comment 5 Michal Sekletar 2019-09-24 12:48:59 UTC
Can you please try downgrade polkit to version from CentOS 7.6 and try to reproduce again?

Comment 6 phroton 2019-09-24 14:51:29 UTC
A downgrade to polkit-0.112-18.el7_6.1 fixes the problem

Comment 7 phroton 2019-09-24 15:08:11 UTC
I think you can change the affected component of this bug to polkit.



We are pasting the following lines as example:
systemctl mask firewalld.service
systemctl stop firewalld.service
echo Test



Result with polkit-0.112-22.el7_7.1 (After Upgrade to 7.7):
[root@copernicus ~]# systemctl mask firewalld.service
[root@copernicus ~]# 



Result with polkit-0.112-18.el7_6.1 (Downgraded):
[root@copernicus ~]# systemctl mask firewalld.service
[root@copernicus ~]# systemctl stop firewalld.service
[root@copernicus ~]# echo Test
Test

Comment 8 tech 2019-09-24 17:23:56 UTC
Hello,

CentOS 7 does not allow downgrade past this version unfortunately.

[root@centos7kvmtest1 ~]# yum downgrade polkit
...
Only Upgrade available on package: polkit-0.112-22.el7_7.1.x86_64
Nothing to do
[root@centos7kvmtest1 ~]#

Pasting these lines
systemctl restart tuned.service
echo "1"
echo "2"
echo "3"

Result with polkit-0.112-22.el7.x86_64
[root@centos7kvmtest1 ~]# systemctl restart tuned.service
[root@centos7kvmtest1 ~]#

It works on older version though.
[root@centos7kvmtest5 ~]# systemctl restart tuned.service
[root@centos7kvmtest5 ~]# echo "1"
1
[root@centos7kvmtest5 ~]# echo "2"
2
[root@centos7kvmtest5 ~]# echo "3"
3
[root@centos7kvmtest5 ~]#
[root@centos7kvmtest5 ~]# rpm -qa |grep polkit
polkit-pkla-compat-0.1-4.el7.x86_64
polkit-0.112-18.el7_6.1.x86_64
[root@centos7kvmtest5 ~]#

Comment 9 phroton 2019-09-25 06:19:06 UTC
> CentOS 7 does not allow downgrade past this version unfortunately.

rpm -Uvh https://rpmfind.net/linux/centos/7.6.1810/updates/x86_64/Packages/polkit-0.112-18.el7_6.1.x86_64.rpm --force

Can also work with an active CentOS 7.6 updates-repo.

Comment 10 Jan Rybar 2019-09-25 15:50:09 UTC
Hello,

in rhel-7.7 we fixed a problem that if user doesn't provide password during authorization and lets it time out, it used to leave the echoing off and user could not see anything any more. With the patch, which fixes this issue, it seems that resetting the terminal blanks the clipboard somehow (even under root in which pkttyagent resets the terminal anyway).
I'll dig into it some more.

Comment 11 tech 2019-09-25 18:51:57 UTC
Hello again,

On a test VM this force downgrade did show it worked again.  

[root@localhost ~]# rpm -Uvh http://vault.centos.org/7.6.1810/updates/x86_64/Packages/polkit-0.112-18.el7_6.1.x86_64.rpm --force
Retrieving http://vault.centos.org/7.6.1810/updates/x86_64/Packages/polkit-0.112-18.el7_6.1.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:polkit-0.112-18.el7_6.1          ################################# [ 50%]
Cleaning up / removing...
   2:polkit-0.112-22.el7_7.1          ################################# [100%]
[root@localhost ~]#
[root@localhost ~]# systemctl restart tuned.service
[root@localhost ~]# echo "1"
1
[root@localhost ~]# echo "2"
2
[root@localhost ~]# echo "3"
3
[root@localhost ~]#

Comment 12 Alex Grebenschikov 2019-10-02 06:55:04 UTC
Hello,

Facing the same issue here. And here is what I've noticed.

If I copy/paste the command using Putty with semicolons, they all get executed:

```
systemctl daemon-reload; service mysqld restart
```

but if I copy/paste commands separated with a line-break:

```
systemctl daemon-reload
service mysqld restart
```

the second command will be never executed, as never entered.

And by the way CentOS 8 is not affected here: `CentOS Linux release 8.0.1905 (Core)`:

```
# rpm -qa | grep polkit
polkit-libs-0.115-6.el8.x86_64
polkit-0.115-6.el8.x86_64
polkit-pkla-compat-0.1-12.el8.x86_64
```

Kindly advise.

Regards,
Alex.

Comment 13 Jan Rybar 2019-10-02 14:48:57 UTC
The issue has been fixed in Fedora Rawhide now and is coming to F30.
It is also scheduled for next release of RHEL7 and RHEL8.

Comment 14 Jan Rybar 2019-10-02 14:50:35 UTC
Created attachment 1621887 [details]
drain instead of flush on terminal setattr

Comment 19 errata-xmlrpc 2020-03-31 20:05:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1135