Sudo hangs without prompting for password












8















I just did a fresh install of Ubuntu and now when I try to use sudo in the terminal emulator, it just hangs there without even asking me for a password.
If I switch to the terminal (Ctrl + Alt + F1) and login, sudo works as expected.
Can someone help me to figure this out?










share|improve this question























  • Just a thought, have you changed the character encoding of your terminal (Open Terminal, menu Terminal -> Set Character Encoding)

    – hytromo
    Jul 29 '13 at 19:21











  • No, I haven't, but I am curious as to why that would change anything.

    – Lawrence
    Jul 29 '13 at 19:53











  • It can be the source of many problems if you change something like this, actually. But this was just a guess.

    – hytromo
    Jul 29 '13 at 20:18











  • I had the same problem. Changing from kernel 4.9 to 4.4 solved it for me.

    – Tom Hale
    Jan 3 '17 at 21:31
















8















I just did a fresh install of Ubuntu and now when I try to use sudo in the terminal emulator, it just hangs there without even asking me for a password.
If I switch to the terminal (Ctrl + Alt + F1) and login, sudo works as expected.
Can someone help me to figure this out?










share|improve this question























  • Just a thought, have you changed the character encoding of your terminal (Open Terminal, menu Terminal -> Set Character Encoding)

    – hytromo
    Jul 29 '13 at 19:21











  • No, I haven't, but I am curious as to why that would change anything.

    – Lawrence
    Jul 29 '13 at 19:53











  • It can be the source of many problems if you change something like this, actually. But this was just a guess.

    – hytromo
    Jul 29 '13 at 20:18











  • I had the same problem. Changing from kernel 4.9 to 4.4 solved it for me.

    – Tom Hale
    Jan 3 '17 at 21:31














8












8








8


3






I just did a fresh install of Ubuntu and now when I try to use sudo in the terminal emulator, it just hangs there without even asking me for a password.
If I switch to the terminal (Ctrl + Alt + F1) and login, sudo works as expected.
Can someone help me to figure this out?










share|improve this question














I just did a fresh install of Ubuntu and now when I try to use sudo in the terminal emulator, it just hangs there without even asking me for a password.
If I switch to the terminal (Ctrl + Alt + F1) and login, sudo works as expected.
Can someone help me to figure this out?







sudo






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 29 '13 at 19:19









LawrenceLawrence

76113




76113













  • Just a thought, have you changed the character encoding of your terminal (Open Terminal, menu Terminal -> Set Character Encoding)

    – hytromo
    Jul 29 '13 at 19:21











  • No, I haven't, but I am curious as to why that would change anything.

    – Lawrence
    Jul 29 '13 at 19:53











  • It can be the source of many problems if you change something like this, actually. But this was just a guess.

    – hytromo
    Jul 29 '13 at 20:18











  • I had the same problem. Changing from kernel 4.9 to 4.4 solved it for me.

    – Tom Hale
    Jan 3 '17 at 21:31



















  • Just a thought, have you changed the character encoding of your terminal (Open Terminal, menu Terminal -> Set Character Encoding)

    – hytromo
    Jul 29 '13 at 19:21











  • No, I haven't, but I am curious as to why that would change anything.

    – Lawrence
    Jul 29 '13 at 19:53











  • It can be the source of many problems if you change something like this, actually. But this was just a guess.

    – hytromo
    Jul 29 '13 at 20:18











  • I had the same problem. Changing from kernel 4.9 to 4.4 solved it for me.

    – Tom Hale
    Jan 3 '17 at 21:31

















Just a thought, have you changed the character encoding of your terminal (Open Terminal, menu Terminal -> Set Character Encoding)

– hytromo
Jul 29 '13 at 19:21





Just a thought, have you changed the character encoding of your terminal (Open Terminal, menu Terminal -> Set Character Encoding)

– hytromo
Jul 29 '13 at 19:21













No, I haven't, but I am curious as to why that would change anything.

– Lawrence
Jul 29 '13 at 19:53





No, I haven't, but I am curious as to why that would change anything.

– Lawrence
Jul 29 '13 at 19:53













It can be the source of many problems if you change something like this, actually. But this was just a guess.

– hytromo
Jul 29 '13 at 20:18





It can be the source of many problems if you change something like this, actually. But this was just a guess.

– hytromo
Jul 29 '13 at 20:18













I had the same problem. Changing from kernel 4.9 to 4.4 solved it for me.

– Tom Hale
Jan 3 '17 at 21:31





I had the same problem. Changing from kernel 4.9 to 4.4 solved it for me.

– Tom Hale
Jan 3 '17 at 21:31










4 Answers
4






active

oldest

votes


















18














Have you changed the hostname recently? I've noticed after a hostname change sudo can hang for a bit. However, if you update your hosts file to reflect the hostname change the hang will go away.



You can do that with this simple one-liner:



hostname | (echo -n "127.0.0.1        " && cat) | sudo tee -a /etc/hosts





share|improve this answer





















  • 1





    It does not hang for 'a bit', it just hangs indefinitely. Also, it works on the terminal, just not in the terminal emulator.

    – Lawrence
    Jul 29 '13 at 19:54











  • This was the exact problem! Thank you!

    – Nemanja Boric
    Mar 24 '15 at 16:52






  • 1





    Give this man a cookie! Thanks when changing the Device Name in Ubuntu's system details utility you effectively break sudo. Great work @Canonical.

    – Flatron
    Feb 1 '17 at 7:32






  • 1





    to fix it make sure to change /etc/hosts also to your new hostname ;)

    – Flatron
    Feb 1 '17 at 7:32











  • Great! I didn't actually notice that it timed out after ~30 sec and then continue with asking for sudo password. Another point: when you is about to change your hostname (maybe you cloned a VM) you might be disconnected to any network to avoid conflicts until you have change the entries. That's is properly also what's causing the timeouts

    – Hulvej
    Apr 23 '18 at 8:18



















4














If you want to check where it hangs, I suggest doing the executing the following command:



 strace sudo 


and then see what system call it is possibly hanging on. This might provide a good clue as to what is happening on your system.



My guess based on what you see is that hostname resolution is problematic on your system. Check out /etc/nsswitch.conf and /etc/resolv.conf files to make sure they are configured properly.



I have assummed that you have already checked your internet connectivity.






share|improve this answer



















  • 1





    Why is internet connectivity required for sudo?

    – grofte
    Jun 17 '17 at 7:05











  • for FQDN information...as you can put host restrictions in your sudoers file.

    – mdpc
    Jun 20 '17 at 18:04











  • I did not understand that. I only know that it makes it tricky to reset the wifi adapter. Which is sometimes necessary after putting the laptop in sleep.

    – grofte
    Jun 25 '17 at 6:20



















1














I am not sure which version of ubuntu you have installed, but there is a bug (race condition) in sudo, which hangs indefinitely blocking on a select.



https://bugzilla.sudo.ws/show_bug.cgi?id=447






share|improve this answer































    0














    I too had this problem with Ubuntu 16.04 . Using "top" command i found that two processes "vnstat" and "NetworkManager" are consuming 100% CPU. So i restarted the system, went to recovery mode and removed the package "vnstat" . After this restarted the system , now system works fine.






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f326194%2fsudo-hangs-without-prompting-for-password%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      18














      Have you changed the hostname recently? I've noticed after a hostname change sudo can hang for a bit. However, if you update your hosts file to reflect the hostname change the hang will go away.



      You can do that with this simple one-liner:



      hostname | (echo -n "127.0.0.1        " && cat) | sudo tee -a /etc/hosts





      share|improve this answer





















      • 1





        It does not hang for 'a bit', it just hangs indefinitely. Also, it works on the terminal, just not in the terminal emulator.

        – Lawrence
        Jul 29 '13 at 19:54











      • This was the exact problem! Thank you!

        – Nemanja Boric
        Mar 24 '15 at 16:52






      • 1





        Give this man a cookie! Thanks when changing the Device Name in Ubuntu's system details utility you effectively break sudo. Great work @Canonical.

        – Flatron
        Feb 1 '17 at 7:32






      • 1





        to fix it make sure to change /etc/hosts also to your new hostname ;)

        – Flatron
        Feb 1 '17 at 7:32











      • Great! I didn't actually notice that it timed out after ~30 sec and then continue with asking for sudo password. Another point: when you is about to change your hostname (maybe you cloned a VM) you might be disconnected to any network to avoid conflicts until you have change the entries. That's is properly also what's causing the timeouts

        – Hulvej
        Apr 23 '18 at 8:18
















      18














      Have you changed the hostname recently? I've noticed after a hostname change sudo can hang for a bit. However, if you update your hosts file to reflect the hostname change the hang will go away.



      You can do that with this simple one-liner:



      hostname | (echo -n "127.0.0.1        " && cat) | sudo tee -a /etc/hosts





      share|improve this answer





















      • 1





        It does not hang for 'a bit', it just hangs indefinitely. Also, it works on the terminal, just not in the terminal emulator.

        – Lawrence
        Jul 29 '13 at 19:54











      • This was the exact problem! Thank you!

        – Nemanja Boric
        Mar 24 '15 at 16:52






      • 1





        Give this man a cookie! Thanks when changing the Device Name in Ubuntu's system details utility you effectively break sudo. Great work @Canonical.

        – Flatron
        Feb 1 '17 at 7:32






      • 1





        to fix it make sure to change /etc/hosts also to your new hostname ;)

        – Flatron
        Feb 1 '17 at 7:32











      • Great! I didn't actually notice that it timed out after ~30 sec and then continue with asking for sudo password. Another point: when you is about to change your hostname (maybe you cloned a VM) you might be disconnected to any network to avoid conflicts until you have change the entries. That's is properly also what's causing the timeouts

        – Hulvej
        Apr 23 '18 at 8:18














      18












      18








      18







      Have you changed the hostname recently? I've noticed after a hostname change sudo can hang for a bit. However, if you update your hosts file to reflect the hostname change the hang will go away.



      You can do that with this simple one-liner:



      hostname | (echo -n "127.0.0.1        " && cat) | sudo tee -a /etc/hosts





      share|improve this answer















      Have you changed the hostname recently? I've noticed after a hostname change sudo can hang for a bit. However, if you update your hosts file to reflect the hostname change the hang will go away.



      You can do that with this simple one-liner:



      hostname | (echo -n "127.0.0.1        " && cat) | sudo tee -a /etc/hosts






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jul 6 '18 at 20:07









      K7AAY

      3,89921644




      3,89921644










      answered Jul 29 '13 at 19:24









      swiftimundoswiftimundo

      18314




      18314








      • 1





        It does not hang for 'a bit', it just hangs indefinitely. Also, it works on the terminal, just not in the terminal emulator.

        – Lawrence
        Jul 29 '13 at 19:54











      • This was the exact problem! Thank you!

        – Nemanja Boric
        Mar 24 '15 at 16:52






      • 1





        Give this man a cookie! Thanks when changing the Device Name in Ubuntu's system details utility you effectively break sudo. Great work @Canonical.

        – Flatron
        Feb 1 '17 at 7:32






      • 1





        to fix it make sure to change /etc/hosts also to your new hostname ;)

        – Flatron
        Feb 1 '17 at 7:32











      • Great! I didn't actually notice that it timed out after ~30 sec and then continue with asking for sudo password. Another point: when you is about to change your hostname (maybe you cloned a VM) you might be disconnected to any network to avoid conflicts until you have change the entries. That's is properly also what's causing the timeouts

        – Hulvej
        Apr 23 '18 at 8:18














      • 1





        It does not hang for 'a bit', it just hangs indefinitely. Also, it works on the terminal, just not in the terminal emulator.

        – Lawrence
        Jul 29 '13 at 19:54











      • This was the exact problem! Thank you!

        – Nemanja Boric
        Mar 24 '15 at 16:52






      • 1





        Give this man a cookie! Thanks when changing the Device Name in Ubuntu's system details utility you effectively break sudo. Great work @Canonical.

        – Flatron
        Feb 1 '17 at 7:32






      • 1





        to fix it make sure to change /etc/hosts also to your new hostname ;)

        – Flatron
        Feb 1 '17 at 7:32











      • Great! I didn't actually notice that it timed out after ~30 sec and then continue with asking for sudo password. Another point: when you is about to change your hostname (maybe you cloned a VM) you might be disconnected to any network to avoid conflicts until you have change the entries. That's is properly also what's causing the timeouts

        – Hulvej
        Apr 23 '18 at 8:18








      1




      1





      It does not hang for 'a bit', it just hangs indefinitely. Also, it works on the terminal, just not in the terminal emulator.

      – Lawrence
      Jul 29 '13 at 19:54





      It does not hang for 'a bit', it just hangs indefinitely. Also, it works on the terminal, just not in the terminal emulator.

      – Lawrence
      Jul 29 '13 at 19:54













      This was the exact problem! Thank you!

      – Nemanja Boric
      Mar 24 '15 at 16:52





      This was the exact problem! Thank you!

      – Nemanja Boric
      Mar 24 '15 at 16:52




      1




      1





      Give this man a cookie! Thanks when changing the Device Name in Ubuntu's system details utility you effectively break sudo. Great work @Canonical.

      – Flatron
      Feb 1 '17 at 7:32





      Give this man a cookie! Thanks when changing the Device Name in Ubuntu's system details utility you effectively break sudo. Great work @Canonical.

      – Flatron
      Feb 1 '17 at 7:32




      1




      1





      to fix it make sure to change /etc/hosts also to your new hostname ;)

      – Flatron
      Feb 1 '17 at 7:32





      to fix it make sure to change /etc/hosts also to your new hostname ;)

      – Flatron
      Feb 1 '17 at 7:32













      Great! I didn't actually notice that it timed out after ~30 sec and then continue with asking for sudo password. Another point: when you is about to change your hostname (maybe you cloned a VM) you might be disconnected to any network to avoid conflicts until you have change the entries. That's is properly also what's causing the timeouts

      – Hulvej
      Apr 23 '18 at 8:18





      Great! I didn't actually notice that it timed out after ~30 sec and then continue with asking for sudo password. Another point: when you is about to change your hostname (maybe you cloned a VM) you might be disconnected to any network to avoid conflicts until you have change the entries. That's is properly also what's causing the timeouts

      – Hulvej
      Apr 23 '18 at 8:18













      4














      If you want to check where it hangs, I suggest doing the executing the following command:



       strace sudo 


      and then see what system call it is possibly hanging on. This might provide a good clue as to what is happening on your system.



      My guess based on what you see is that hostname resolution is problematic on your system. Check out /etc/nsswitch.conf and /etc/resolv.conf files to make sure they are configured properly.



      I have assummed that you have already checked your internet connectivity.






      share|improve this answer



















      • 1





        Why is internet connectivity required for sudo?

        – grofte
        Jun 17 '17 at 7:05











      • for FQDN information...as you can put host restrictions in your sudoers file.

        – mdpc
        Jun 20 '17 at 18:04











      • I did not understand that. I only know that it makes it tricky to reset the wifi adapter. Which is sometimes necessary after putting the laptop in sleep.

        – grofte
        Jun 25 '17 at 6:20
















      4














      If you want to check where it hangs, I suggest doing the executing the following command:



       strace sudo 


      and then see what system call it is possibly hanging on. This might provide a good clue as to what is happening on your system.



      My guess based on what you see is that hostname resolution is problematic on your system. Check out /etc/nsswitch.conf and /etc/resolv.conf files to make sure they are configured properly.



      I have assummed that you have already checked your internet connectivity.






      share|improve this answer



















      • 1





        Why is internet connectivity required for sudo?

        – grofte
        Jun 17 '17 at 7:05











      • for FQDN information...as you can put host restrictions in your sudoers file.

        – mdpc
        Jun 20 '17 at 18:04











      • I did not understand that. I only know that it makes it tricky to reset the wifi adapter. Which is sometimes necessary after putting the laptop in sleep.

        – grofte
        Jun 25 '17 at 6:20














      4












      4








      4







      If you want to check where it hangs, I suggest doing the executing the following command:



       strace sudo 


      and then see what system call it is possibly hanging on. This might provide a good clue as to what is happening on your system.



      My guess based on what you see is that hostname resolution is problematic on your system. Check out /etc/nsswitch.conf and /etc/resolv.conf files to make sure they are configured properly.



      I have assummed that you have already checked your internet connectivity.






      share|improve this answer













      If you want to check where it hangs, I suggest doing the executing the following command:



       strace sudo 


      and then see what system call it is possibly hanging on. This might provide a good clue as to what is happening on your system.



      My guess based on what you see is that hostname resolution is problematic on your system. Check out /etc/nsswitch.conf and /etc/resolv.conf files to make sure they are configured properly.



      I have assummed that you have already checked your internet connectivity.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jul 29 '13 at 21:05









      mdpcmdpc

      8361818




      8361818








      • 1





        Why is internet connectivity required for sudo?

        – grofte
        Jun 17 '17 at 7:05











      • for FQDN information...as you can put host restrictions in your sudoers file.

        – mdpc
        Jun 20 '17 at 18:04











      • I did not understand that. I only know that it makes it tricky to reset the wifi adapter. Which is sometimes necessary after putting the laptop in sleep.

        – grofte
        Jun 25 '17 at 6:20














      • 1





        Why is internet connectivity required for sudo?

        – grofte
        Jun 17 '17 at 7:05











      • for FQDN information...as you can put host restrictions in your sudoers file.

        – mdpc
        Jun 20 '17 at 18:04











      • I did not understand that. I only know that it makes it tricky to reset the wifi adapter. Which is sometimes necessary after putting the laptop in sleep.

        – grofte
        Jun 25 '17 at 6:20








      1




      1





      Why is internet connectivity required for sudo?

      – grofte
      Jun 17 '17 at 7:05





      Why is internet connectivity required for sudo?

      – grofte
      Jun 17 '17 at 7:05













      for FQDN information...as you can put host restrictions in your sudoers file.

      – mdpc
      Jun 20 '17 at 18:04





      for FQDN information...as you can put host restrictions in your sudoers file.

      – mdpc
      Jun 20 '17 at 18:04













      I did not understand that. I only know that it makes it tricky to reset the wifi adapter. Which is sometimes necessary after putting the laptop in sleep.

      – grofte
      Jun 25 '17 at 6:20





      I did not understand that. I only know that it makes it tricky to reset the wifi adapter. Which is sometimes necessary after putting the laptop in sleep.

      – grofte
      Jun 25 '17 at 6:20











      1














      I am not sure which version of ubuntu you have installed, but there is a bug (race condition) in sudo, which hangs indefinitely blocking on a select.



      https://bugzilla.sudo.ws/show_bug.cgi?id=447






      share|improve this answer




























        1














        I am not sure which version of ubuntu you have installed, but there is a bug (race condition) in sudo, which hangs indefinitely blocking on a select.



        https://bugzilla.sudo.ws/show_bug.cgi?id=447






        share|improve this answer


























          1












          1








          1







          I am not sure which version of ubuntu you have installed, but there is a bug (race condition) in sudo, which hangs indefinitely blocking on a select.



          https://bugzilla.sudo.ws/show_bug.cgi?id=447






          share|improve this answer













          I am not sure which version of ubuntu you have installed, but there is a bug (race condition) in sudo, which hangs indefinitely blocking on a select.



          https://bugzilla.sudo.ws/show_bug.cgi?id=447







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 '16 at 20:24









          sujan bolisettisujan bolisetti

          111




          111























              0














              I too had this problem with Ubuntu 16.04 . Using "top" command i found that two processes "vnstat" and "NetworkManager" are consuming 100% CPU. So i restarted the system, went to recovery mode and removed the package "vnstat" . After this restarted the system , now system works fine.






              share|improve this answer




























                0














                I too had this problem with Ubuntu 16.04 . Using "top" command i found that two processes "vnstat" and "NetworkManager" are consuming 100% CPU. So i restarted the system, went to recovery mode and removed the package "vnstat" . After this restarted the system , now system works fine.






                share|improve this answer


























                  0












                  0








                  0







                  I too had this problem with Ubuntu 16.04 . Using "top" command i found that two processes "vnstat" and "NetworkManager" are consuming 100% CPU. So i restarted the system, went to recovery mode and removed the package "vnstat" . After this restarted the system , now system works fine.






                  share|improve this answer













                  I too had this problem with Ubuntu 16.04 . Using "top" command i found that two processes "vnstat" and "NetworkManager" are consuming 100% CPU. So i restarted the system, went to recovery mode and removed the package "vnstat" . After this restarted the system , now system works fine.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 5 at 1:39









                  manishmanish

                  133




                  133






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f326194%2fsudo-hangs-without-prompting-for-password%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to change which sound is reproduced for terminal bell?

                      Can I use Tabulator js library in my java Spring + Thymeleaf project?

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents