0

Problem:

  • Running sudo commands take up to 30 seconds to execute. Time it takes is not consistent, sometimes the command returns quickly if it was previously called, but most of the time it takes much longer than it should. Additionally, when sudo is run while off the network, it responds instantly, but as soon as I connect the machine to my WIFI, it becomes slow.

Environment

  • OS: Redhat7 Enterprise Linux
  • Hardware: HP Zbook G3
  • Smart card authentication is enabled
  • sudo -V:
  Sudo version 1.8.6p7
  Sudoers policy plugin version 1.8.6p7
  Sudoers file grammar version 42
  Sudoers I/O plugin version 1.8.6p7

Solutions tried but failed:

  • Hostname is on both lines in /etc/hosts
  • Running sudo strace -f -t sudo echo proved that the first sudo is the one that hangs, the second sudo command executes normally as expected.
  • I changed the permissions of strace so I could run it as my username, so I ran strace -f -t sudo echo and lo and behold the command returns instantly, and does not hang. This is unfortunate because I can't seem to run strace on the sudo command to see where I am getting stuck.

closed as too broad by Kusalananda, Stephen Rauch, Philippos, Romeo Ninov, Braiam Sep 26 '17 at 20:57

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Hi. You say this happens with any sudo command, but the subject line includes "yum". This is confusing. Could you please clarify with a specific command you tried, which is simpler than sudo yum (and is also delayed). E.g. time sudo echo Hello world. If so, it would be great to remove "yum" from the subject line & tags. – sourcejedi May 17 '17 at 12:28
  • Sorry, it is not any Sudo command, only sudo yum commands – user985030 May 17 '17 at 12:30
  • 2
    Judging from the output you provided of the two commands, they're not even doing the same thing. I would first focus on why they're not doing the same thing before I worry about why one is slower than the other. – Patrick May 17 '17 at 12:37
  • 1
    Your output is still different between the two commands. If you're saying you provided the wrong output, we will be unable to help you unless we get accurate information. – Patrick May 23 '17 at 1:08
  • 1
    This question is very unclear and internally inconsistent. I'd recommend a complete re-edit, taking on board the above comments. I'd also suggest clarifying what you mean by "connect to my own network". I presume you are referring to system changes made by Network Manager (but you haven't given enough information to know for sure). If so, you should check what those changes are, e.g., changing the contents of /etc/nsswitch.conf could cause problems with authentication. – Anthony Geoghegan May 23 '17 at 8:54
2

sudo delays have often been caused by DNS issues.

http://forums.fedoraforum.org/showthread.php?t=210503

One user had a similar 2 minutes delay caused by the issue: http://forums.fedoraforum.org/showpost.php?s=93387b186c8850e6837cea5f7a43457c&p=1194582&postcount=2

Therefore this is my first line of investigation. You could try checking time getent hosts $(hostname), and seeing if there's a delay there.

Note: my understanding is the reason this kept happening had been fixed upstream. It would be very interesting if you could note the version of sudo used by your distribution. https://bugzilla.redhat.com/show_bug.cgi?id=479464#c9

Otherwise, confirm the problem happens with the inner sudo of sudo time sudo echo. Then you could try running sudo strace -t -f sudo echo. There will be a lot of output, but it will be timestamped. You will see some system call where the delay is spent, e.g. recvmsg (receive message, possibly waiting with a timeout, possibly a DNS response). Full interpretation requires programming knowledge. If something goes via dbus then I guess it won't show which dbus service specifically. (Feel free to post the full output somewhere and link to it - dropbox.com, gist.github.com, etc).

  • I've updated my question with some results from your suggestions. Still not having any luck though. – user985030 May 20 '17 at 16:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.