Whoami: cannot find name for user id 0












7















When I run whoami it says:




whoami: cannot find name for user id 0




My /etc/passwd file looks like this:



root::0:0:root:/root:/bin/bash









share|improve this question

























  • Your /etc/passwd is broken? Can you post the contents

    – daisy
    Jan 31 '13 at 2:06











  • What's your id command in current shell when you get whoami?.

    – PersianGulf
    Jan 31 '13 at 3:16








  • 7





    (1) Which linux distribution? (2) What is output of pwck and grpck? (3) Does file /etc/shadow exist?

    – John Siu
    Jan 31 '13 at 4:34






  • 5





    Also, have you set up (or attempted to) directory services of some sort (LDAP, NIS, etc.)? Have you touched /etc/nsswitch.conf?

    – derobert
    Jan 31 '13 at 17:09






  • 1





    I'm thinking nsswitch.conf as derobert mentioned. But I have seen nscd cause weird crap like this before. If it's running, try stopping it. If it is not running, try starting it (though the starting it if it's not running thing was an old RHEL bug that should not around any more).

    – Patrick
    Feb 1 '13 at 3:35
















7















When I run whoami it says:




whoami: cannot find name for user id 0




My /etc/passwd file looks like this:



root::0:0:root:/root:/bin/bash









share|improve this question

























  • Your /etc/passwd is broken? Can you post the contents

    – daisy
    Jan 31 '13 at 2:06











  • What's your id command in current shell when you get whoami?.

    – PersianGulf
    Jan 31 '13 at 3:16








  • 7





    (1) Which linux distribution? (2) What is output of pwck and grpck? (3) Does file /etc/shadow exist?

    – John Siu
    Jan 31 '13 at 4:34






  • 5





    Also, have you set up (or attempted to) directory services of some sort (LDAP, NIS, etc.)? Have you touched /etc/nsswitch.conf?

    – derobert
    Jan 31 '13 at 17:09






  • 1





    I'm thinking nsswitch.conf as derobert mentioned. But I have seen nscd cause weird crap like this before. If it's running, try stopping it. If it is not running, try starting it (though the starting it if it's not running thing was an old RHEL bug that should not around any more).

    – Patrick
    Feb 1 '13 at 3:35














7












7








7


1






When I run whoami it says:




whoami: cannot find name for user id 0




My /etc/passwd file looks like this:



root::0:0:root:/root:/bin/bash









share|improve this question
















When I run whoami it says:




whoami: cannot find name for user id 0




My /etc/passwd file looks like this:



root::0:0:root:/root:/bin/bash






linux users






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 31 '13 at 15:14









Michael Mrozek

61.9k29193213




61.9k29193213










asked Jan 31 '13 at 2:01









gabemaigabemai

214148




214148













  • Your /etc/passwd is broken? Can you post the contents

    – daisy
    Jan 31 '13 at 2:06











  • What's your id command in current shell when you get whoami?.

    – PersianGulf
    Jan 31 '13 at 3:16








  • 7





    (1) Which linux distribution? (2) What is output of pwck and grpck? (3) Does file /etc/shadow exist?

    – John Siu
    Jan 31 '13 at 4:34






  • 5





    Also, have you set up (or attempted to) directory services of some sort (LDAP, NIS, etc.)? Have you touched /etc/nsswitch.conf?

    – derobert
    Jan 31 '13 at 17:09






  • 1





    I'm thinking nsswitch.conf as derobert mentioned. But I have seen nscd cause weird crap like this before. If it's running, try stopping it. If it is not running, try starting it (though the starting it if it's not running thing was an old RHEL bug that should not around any more).

    – Patrick
    Feb 1 '13 at 3:35



















  • Your /etc/passwd is broken? Can you post the contents

    – daisy
    Jan 31 '13 at 2:06











  • What's your id command in current shell when you get whoami?.

    – PersianGulf
    Jan 31 '13 at 3:16








  • 7





    (1) Which linux distribution? (2) What is output of pwck and grpck? (3) Does file /etc/shadow exist?

    – John Siu
    Jan 31 '13 at 4:34






  • 5





    Also, have you set up (or attempted to) directory services of some sort (LDAP, NIS, etc.)? Have you touched /etc/nsswitch.conf?

    – derobert
    Jan 31 '13 at 17:09






  • 1





    I'm thinking nsswitch.conf as derobert mentioned. But I have seen nscd cause weird crap like this before. If it's running, try stopping it. If it is not running, try starting it (though the starting it if it's not running thing was an old RHEL bug that should not around any more).

    – Patrick
    Feb 1 '13 at 3:35

















Your /etc/passwd is broken? Can you post the contents

– daisy
Jan 31 '13 at 2:06





Your /etc/passwd is broken? Can you post the contents

– daisy
Jan 31 '13 at 2:06













What's your id command in current shell when you get whoami?.

– PersianGulf
Jan 31 '13 at 3:16







What's your id command in current shell when you get whoami?.

– PersianGulf
Jan 31 '13 at 3:16






7




7





(1) Which linux distribution? (2) What is output of pwck and grpck? (3) Does file /etc/shadow exist?

– John Siu
Jan 31 '13 at 4:34





(1) Which linux distribution? (2) What is output of pwck and grpck? (3) Does file /etc/shadow exist?

– John Siu
Jan 31 '13 at 4:34




5




5





Also, have you set up (or attempted to) directory services of some sort (LDAP, NIS, etc.)? Have you touched /etc/nsswitch.conf?

– derobert
Jan 31 '13 at 17:09





Also, have you set up (or attempted to) directory services of some sort (LDAP, NIS, etc.)? Have you touched /etc/nsswitch.conf?

– derobert
Jan 31 '13 at 17:09




1




1





I'm thinking nsswitch.conf as derobert mentioned. But I have seen nscd cause weird crap like this before. If it's running, try stopping it. If it is not running, try starting it (though the starting it if it's not running thing was an old RHEL bug that should not around any more).

– Patrick
Feb 1 '13 at 3:35





I'm thinking nsswitch.conf as derobert mentioned. But I have seen nscd cause weird crap like this before. If it's running, try stopping it. If it is not running, try starting it (though the starting it if it's not running thing was an old RHEL bug that should not around any more).

– Patrick
Feb 1 '13 at 3:35










5 Answers
5






active

oldest

votes


















7














Notice there is a missing x



This is the content of mine on Linux Mint with kernel 3.8.0-35-generic



root:x:0:0:root:/root:/bin/zsh


The x means that the actual password information is being stored in a separate shadow password file, tipically /etc/shadow



https://en.wikipedia.org/wiki/Passwd






share|improve this answer































    5














    I would recommend checking the permissions on /etc/passwd and /etc/group. If they're not set to 644 (-rw-r--r--), then run:



    chmod 644 /etc/passwd; chmod 644 /etc/group






    share|improve this answer
























    • still says cannot find name for user id 0

      – gabemai
      Jan 31 '13 at 22:28



















    4














    just say my experience



    0. problem



    on broken device:



    cat /etc/passwd
    root:x:0:0:root:/root:/bin/bash


    and



    whoami
    whoami: cannot find name for user ID 0


    on normal device:



    whoami
    root


    1. research



    try to find the reason:



    strace whoami 2>&1 | grep -E '/etc|/lib'
    ...
    open("/lib/arm-linux-gnueabi/libnss_compat.so.2", O_RDONLY) = 3
    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    open("/lib/arm-linux-gnueabi/libnsl.so.1", O_RDONLY) = 3
    open("/etc/ld.so.cache", O_RDONLY) = 3
    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    open("/lib/arm-linux-gnueabi/libnss_nis.so.2", O_RDONLY) = 3
    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
    open("/lib/arm-linux-gnueabi/libnss_files.so.2", O_RDONLY) = 3
    open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3


    fount it need those *.so:



    /lib/arm-linux-gnueabi/libnss_compat.so.2
    /lib/arm-linux-gnueabi/libnsl.so.1
    /lib/arm-linux-gnueabi/libnss_nis.so.2
    /lib/arm-linux-gnueabi/libnss_files.so.2


    //all come from libc6 package, i work with arm linux device.



    2. resolution



    i copy them to the broken device, then whoami worked right,



    and bash prompt I have no name!@localhost fixed.






    share|improve this answer

































      1














      Check that each and every line in /etc/passwd has exactly seven fields.






      share|improve this answer































        0














        I know it's right on time, but the reason could be coreutils compiled without ACL support. Check it and rebuild the package if needed






        share|improve this answer























          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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%2funix.stackexchange.com%2fquestions%2f63182%2fwhoami-cannot-find-name-for-user-id-0%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          7














          Notice there is a missing x



          This is the content of mine on Linux Mint with kernel 3.8.0-35-generic



          root:x:0:0:root:/root:/bin/zsh


          The x means that the actual password information is being stored in a separate shadow password file, tipically /etc/shadow



          https://en.wikipedia.org/wiki/Passwd






          share|improve this answer




























            7














            Notice there is a missing x



            This is the content of mine on Linux Mint with kernel 3.8.0-35-generic



            root:x:0:0:root:/root:/bin/zsh


            The x means that the actual password information is being stored in a separate shadow password file, tipically /etc/shadow



            https://en.wikipedia.org/wiki/Passwd






            share|improve this answer


























              7












              7








              7







              Notice there is a missing x



              This is the content of mine on Linux Mint with kernel 3.8.0-35-generic



              root:x:0:0:root:/root:/bin/zsh


              The x means that the actual password information is being stored in a separate shadow password file, tipically /etc/shadow



              https://en.wikipedia.org/wiki/Passwd






              share|improve this answer













              Notice there is a missing x



              This is the content of mine on Linux Mint with kernel 3.8.0-35-generic



              root:x:0:0:root:/root:/bin/zsh


              The x means that the actual password information is being stored in a separate shadow password file, tipically /etc/shadow



              https://en.wikipedia.org/wiki/Passwd







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Feb 11 '14 at 1:27









              Jaime AgudoJaime Agudo

              26626




              26626

























                  5














                  I would recommend checking the permissions on /etc/passwd and /etc/group. If they're not set to 644 (-rw-r--r--), then run:



                  chmod 644 /etc/passwd; chmod 644 /etc/group






                  share|improve this answer
























                  • still says cannot find name for user id 0

                    – gabemai
                    Jan 31 '13 at 22:28
















                  5














                  I would recommend checking the permissions on /etc/passwd and /etc/group. If they're not set to 644 (-rw-r--r--), then run:



                  chmod 644 /etc/passwd; chmod 644 /etc/group






                  share|improve this answer
























                  • still says cannot find name for user id 0

                    – gabemai
                    Jan 31 '13 at 22:28














                  5












                  5








                  5







                  I would recommend checking the permissions on /etc/passwd and /etc/group. If they're not set to 644 (-rw-r--r--), then run:



                  chmod 644 /etc/passwd; chmod 644 /etc/group






                  share|improve this answer













                  I would recommend checking the permissions on /etc/passwd and /etc/group. If they're not set to 644 (-rw-r--r--), then run:



                  chmod 644 /etc/passwd; chmod 644 /etc/group







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 31 '13 at 21:49









                  NateNate

                  57069




                  57069













                  • still says cannot find name for user id 0

                    – gabemai
                    Jan 31 '13 at 22:28



















                  • still says cannot find name for user id 0

                    – gabemai
                    Jan 31 '13 at 22:28

















                  still says cannot find name for user id 0

                  – gabemai
                  Jan 31 '13 at 22:28





                  still says cannot find name for user id 0

                  – gabemai
                  Jan 31 '13 at 22:28











                  4














                  just say my experience



                  0. problem



                  on broken device:



                  cat /etc/passwd
                  root:x:0:0:root:/root:/bin/bash


                  and



                  whoami
                  whoami: cannot find name for user ID 0


                  on normal device:



                  whoami
                  root


                  1. research



                  try to find the reason:



                  strace whoami 2>&1 | grep -E '/etc|/lib'
                  ...
                  open("/lib/arm-linux-gnueabi/libnss_compat.so.2", O_RDONLY) = 3
                  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                  open("/lib/arm-linux-gnueabi/libnsl.so.1", O_RDONLY) = 3
                  open("/etc/ld.so.cache", O_RDONLY) = 3
                  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                  open("/lib/arm-linux-gnueabi/libnss_nis.so.2", O_RDONLY) = 3
                  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                  open("/lib/arm-linux-gnueabi/libnss_files.so.2", O_RDONLY) = 3
                  open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3


                  fount it need those *.so:



                  /lib/arm-linux-gnueabi/libnss_compat.so.2
                  /lib/arm-linux-gnueabi/libnsl.so.1
                  /lib/arm-linux-gnueabi/libnss_nis.so.2
                  /lib/arm-linux-gnueabi/libnss_files.so.2


                  //all come from libc6 package, i work with arm linux device.



                  2. resolution



                  i copy them to the broken device, then whoami worked right,



                  and bash prompt I have no name!@localhost fixed.






                  share|improve this answer






























                    4














                    just say my experience



                    0. problem



                    on broken device:



                    cat /etc/passwd
                    root:x:0:0:root:/root:/bin/bash


                    and



                    whoami
                    whoami: cannot find name for user ID 0


                    on normal device:



                    whoami
                    root


                    1. research



                    try to find the reason:



                    strace whoami 2>&1 | grep -E '/etc|/lib'
                    ...
                    open("/lib/arm-linux-gnueabi/libnss_compat.so.2", O_RDONLY) = 3
                    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                    open("/lib/arm-linux-gnueabi/libnsl.so.1", O_RDONLY) = 3
                    open("/etc/ld.so.cache", O_RDONLY) = 3
                    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                    open("/lib/arm-linux-gnueabi/libnss_nis.so.2", O_RDONLY) = 3
                    access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                    open("/lib/arm-linux-gnueabi/libnss_files.so.2", O_RDONLY) = 3
                    open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3


                    fount it need those *.so:



                    /lib/arm-linux-gnueabi/libnss_compat.so.2
                    /lib/arm-linux-gnueabi/libnsl.so.1
                    /lib/arm-linux-gnueabi/libnss_nis.so.2
                    /lib/arm-linux-gnueabi/libnss_files.so.2


                    //all come from libc6 package, i work with arm linux device.



                    2. resolution



                    i copy them to the broken device, then whoami worked right,



                    and bash prompt I have no name!@localhost fixed.






                    share|improve this answer




























                      4












                      4








                      4







                      just say my experience



                      0. problem



                      on broken device:



                      cat /etc/passwd
                      root:x:0:0:root:/root:/bin/bash


                      and



                      whoami
                      whoami: cannot find name for user ID 0


                      on normal device:



                      whoami
                      root


                      1. research



                      try to find the reason:



                      strace whoami 2>&1 | grep -E '/etc|/lib'
                      ...
                      open("/lib/arm-linux-gnueabi/libnss_compat.so.2", O_RDONLY) = 3
                      access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                      open("/lib/arm-linux-gnueabi/libnsl.so.1", O_RDONLY) = 3
                      open("/etc/ld.so.cache", O_RDONLY) = 3
                      access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                      open("/lib/arm-linux-gnueabi/libnss_nis.so.2", O_RDONLY) = 3
                      access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                      open("/lib/arm-linux-gnueabi/libnss_files.so.2", O_RDONLY) = 3
                      open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3


                      fount it need those *.so:



                      /lib/arm-linux-gnueabi/libnss_compat.so.2
                      /lib/arm-linux-gnueabi/libnsl.so.1
                      /lib/arm-linux-gnueabi/libnss_nis.so.2
                      /lib/arm-linux-gnueabi/libnss_files.so.2


                      //all come from libc6 package, i work with arm linux device.



                      2. resolution



                      i copy them to the broken device, then whoami worked right,



                      and bash prompt I have no name!@localhost fixed.






                      share|improve this answer















                      just say my experience



                      0. problem



                      on broken device:



                      cat /etc/passwd
                      root:x:0:0:root:/root:/bin/bash


                      and



                      whoami
                      whoami: cannot find name for user ID 0


                      on normal device:



                      whoami
                      root


                      1. research



                      try to find the reason:



                      strace whoami 2>&1 | grep -E '/etc|/lib'
                      ...
                      open("/lib/arm-linux-gnueabi/libnss_compat.so.2", O_RDONLY) = 3
                      access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                      open("/lib/arm-linux-gnueabi/libnsl.so.1", O_RDONLY) = 3
                      open("/etc/ld.so.cache", O_RDONLY) = 3
                      access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                      open("/lib/arm-linux-gnueabi/libnss_nis.so.2", O_RDONLY) = 3
                      access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
                      open("/lib/arm-linux-gnueabi/libnss_files.so.2", O_RDONLY) = 3
                      open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3


                      fount it need those *.so:



                      /lib/arm-linux-gnueabi/libnss_compat.so.2
                      /lib/arm-linux-gnueabi/libnsl.so.1
                      /lib/arm-linux-gnueabi/libnss_nis.so.2
                      /lib/arm-linux-gnueabi/libnss_files.so.2


                      //all come from libc6 package, i work with arm linux device.



                      2. resolution



                      i copy them to the broken device, then whoami worked right,



                      and bash prompt I have no name!@localhost fixed.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Nov 4 '17 at 7:45

























                      answered Nov 1 '17 at 17:28









                      yurenchenyurenchen

                      1536




                      1536























                          1














                          Check that each and every line in /etc/passwd has exactly seven fields.






                          share|improve this answer




























                            1














                            Check that each and every line in /etc/passwd has exactly seven fields.






                            share|improve this answer


























                              1












                              1








                              1







                              Check that each and every line in /etc/passwd has exactly seven fields.






                              share|improve this answer













                              Check that each and every line in /etc/passwd has exactly seven fields.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Feb 11 '14 at 8:56









                              FlupFlup

                              6,10912244




                              6,10912244























                                  0














                                  I know it's right on time, but the reason could be coreutils compiled without ACL support. Check it and rebuild the package if needed






                                  share|improve this answer




























                                    0














                                    I know it's right on time, but the reason could be coreutils compiled without ACL support. Check it and rebuild the package if needed






                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      I know it's right on time, but the reason could be coreutils compiled without ACL support. Check it and rebuild the package if needed






                                      share|improve this answer













                                      I know it's right on time, but the reason could be coreutils compiled without ACL support. Check it and rebuild the package if needed







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jan 4 '16 at 20:45









                                      Alexander ZhakAlexander Zhak

                                      1084




                                      1084






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                          • 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%2funix.stackexchange.com%2fquestions%2f63182%2fwhoami-cannot-find-name-for-user-id-0%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

                                          サソリ

                                          広島県道265号伴広島線

                                          Setup Asymptote in Texstudio