
サーバーとラップトップでルーチンを実行し、apt upgrade
すべてを再起動した後、次のことがわかりました。
$ mount nfs-server:/mnt /mountpoint
それは永遠に中断されます。論理的な説明はないようです。
私は最初に洞察力を得るためにWiresharkを見つけました。
140 60.439219227 192.168.0.2 192.168.0.3 NFS 170 V4 Reply (Call In 138) EXCHANGE_ID
141 60.439302740 192.168.0.3 192.168.0.2 NFS 258 V4 Call (Reply In 142) CREATE_SESSION
142 60.439984105 192.168.0.2 192.168.0.3 NFS 194 V4 Reply (Call In 141) CREATE_SESSION
143 60.440070415 192.168.0.3 192.168.0.2 NFS 198 V4 Call (Reply In 147) PUTROOTFH | GETATTR
147 65.511499058 192.168.0.2 192.168.0.3 NFS 158 V4 Reply (Call In 143) PUTROOTFH Status: NFS4ERR_DELAY
へへ。だからそれはうまくいきますが、完全に楽しくないものがあります。障害物とは何ですか?
次に方向を変えるとdmesg
すぐに「円を描いて不確実に手がかりを探している」段階をあっという間に過ぎました。
[ 283.998430] rpc.mountd[2238]: segfault at 0 ip 00007f816550f3d6 sp 00007ffd60245820 error 4 in libc-2.28.so[7f81654b7000+148000]
[ 283.998523] Code: 1f 44 00 00 85 f6 0f 8e 88 00 00 00 83 fe 01 0f 84 8f 00 00 00 41 54 83 ee 01 49 89 fc 41 b8 01 00 00 00 55 b9 0a 00 00 00 53 <8b> 02 48 89 d3 89 c5 83 e0 df 89 02 48 63 d6 48 89 fe 48 89 df 83
これが始まるとすぐにすぐに発生します。ここで何が起こっているのか疑問に思う...
自分で始めるにはどうすればいいですか?ユニットファイルのいくつかの内容を見ると、パラメータが必要であることがわかりまし--manage-gids
た--help
。-F
いいね
# rpc.mountd --manage-gids -F
rpc.mountd: Version 1.3.3 starting
Segmentation fault
まあ、再構築に時間がかかりません!それでは、このようなことをしなければならない理由は何だろうか?
stat("/", {st_mode=S_IFDIR|0755, st_size=37, ...}) = 0
openat(AT_FDCWD, "/etc/mtab", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
futex(0x7faf15dd5168, FUTEX_WAKE_PRIVATE, 2147483647) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++
Segmentation fault
...いいえ、私のシステムはまだそれ自体でフラッシュされていません。そうですか? :S
# ls -l /etc/mtab
lrwxrwxrwx 1 root root 19 Jul 12 15:17 /etc/mtab -> ../proc/self/mounts
...わかりました。
よく。私はその悪役がopenat()
実際に図書館で電話をかけたと確信しています。ltrace
他の興味深い背景が追加されたのだろうか。
__xstat(1, "/", 0x7ffe45d9f620) = 0
free(0) = <void>
strdup("/") = 0x559b3adaf640
strlen("/") = 1
setmntent("/etc/mtab", "r") = 0
getmntent(0 <no return ...>
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
ええと、それは何ですか--
DESCRIPTION
These routines are used to access the filesystem description file
/etc/fstab and the mounted filesystem description file /etc/mtab.
The setmntent() function opens the filesystem description file filename
and returns a file pointer which can be used by getmntent(). The argu-
ment type is the type of access required and can take the same values
as the mode argument of fopen(3).
The getmntent() function reads the next line of the filesystem descrip-
tion file from stream and returns a pointer to a structure containing
the broken out fields from a line in the file. The pointer points to a
static area of memory which is overwritten by subsequent calls to getm-
ntent().
...
RETURN VALUE
The getmntent() and getmntent_r() functions return a pointer to the mn-
tent structure or NULL on failure.
しばらくお待ちください。setmntent()
NULL ポインタとも呼ばれる 0 を返します。その後、NULLポインタが使用されますgetmntent()
。壊れたようです…?
私はここで何が起こっているのか知りたいです。rpc.mountd
含まれているパッケージにデバッグシンボルがあるといいでしょうか?ああ、素敵ですねnfs-kernel-server-dbgsym
。クール。
プログラムはSIGSEGV信号、分割エラーを受信しました。 __GI___fgets_unlocked の 0x00007ffff7db73d6(buf=buf@entry=0x5555555a8060"", n=n@entry=4096,fp=fp@アイテム=0x0)iofgets_u.c:50 50 iofgets_u.c:そのファイルまたはディレクトリはありません。 (gdb)BT #0 0x00007ffff7db73d6 in __GI___fgets_unlocked(buf=buf@entry=0x5555555a8060"", n=n@entry=4096, fp=fp@entry=0x0) in iofgets_u.c:50 __GI___getmntent_rの #1 0x00007ffff7e2ef16(ストリーム=ストリーム@アイテム=0x0, mp=mp@entry=0x7ffff7efb140 , buffer=0x5555555a8060 "", bufsiz=bufsiz@entry=4096) mntent_r.c:130 getmntent #2 0x00007ffff7e2ed03(ストリーム=ストリーム@アイテム=0x0)mntent.c:52 #3 キャッシュの next_mnt(v=0x555555571ac8, p=0x5555555a4ff8"/") の 0x000055555555cfa8.c:383 #4 nfsd_fh(f=6)(cache.c:736) #5 0x000055555555d2cd in キャッシュ_process_req(readfds=readfds@entry=0x7fffffffe960) in キャッシュ.c:1424 #6 0x0000555555555d718 at my_svc_run() svc_run.c:117 #7 0x0000555555558ee3 in main(argc=, argv=) at mountd.c:894
よく。
第367話 [368章] 369話 [370枚] 371 { 372話 373話 374話 375 if (*v == NULL) { 376話 377話 378話 379話 380話 381話 [382枚] 383話 384話 385終わり(f); 386話 387話 388話 [389章] 390話
ええと。
だから... setmntent()
NULLを返し、 に割り当てられてf
... getmntent(f)
segfaults...?
一度見よう
$ cat setmntent.c
#include <stdio.h>
#include <mntent.h>
int main() {
FILE *ret = setmntent("/etc/mtab", "r");
printf("%p\n", (void *)ret);
return 0;
}
$ gcc -o setmntent setmntent.c
$ ./setmntent
(nil)
うん。だから私のシステムでは/etc/mtab
シンボリックリンクなのでsetmntent()
爆発します。途方もない。
どこで見てください...
$ cat getmntent.c
#include <mntent.h>
int main() {
getmntent(NULL);
}
$ gcc -o getmntent getmntent.c
$ ./getmntent
Segmentation fault
まあ、これは完全に論理的です。 *主要駅*
NFSが動作したいです。何をしますか?
答え1
ひどい解決策:
rm /etc/mtab; cat /proc/mounts > /etc/mtab
注意事項:
これは/etc/mtab
、決して消えないと予想されるものをナノ秒でもランダムに破壊する可能性があります。
利用可能なバックアップテープが十分でない場合(時間、リソース)、本番リカバリには使用されない可能性があります。
私はこれがハッキングだと思うので、この(自己回答)を許可されているとマークしません。代わりに議論する他のコメント/回答を探します。
このNFSの問題は100%再現可能であると思われ、理論的に(?)どこにでも発生する可能性があるため、私のシステムが
/etc/mtab
指しているのはなぜですか?/proc/self/mounts
なぜこれが起こるのですか?
私は何をすべきですか?規範的にこの状況を解決してください(特に
/etc/mtab
適切な構成を使用して)。
そのような情報をいただきありがとうございます!