私が実行すると、whoami
次のように言います。
whoami:ユーザーID 0の名前が見つかりません。
私の/etc/passwd
ファイルは次のとおりです。
root::0:0:root:/root:/bin/bash
ベストアンサー1
私の経験を教えてください
////etc/passwd、/etc/shadowを確認した後
0.質問
損傷した装置の場合:
cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
そして
whoami
whoami: cannot find name for user ID 0
一般的なデバイスでは:
whoami
root
1. 研究
理由を調べてください:
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
*.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
libc6
// パッケージ全体に arm linux デバイスを使用します。
2. ソリューション
故障した機器にコピーしたら元気になりwhoami
ました。
BashプロンプトI have no name!@localhost
が修正されました。