![搜索手册页不起作用](https://linux22.com/image/153521/%E6%90%9C%E7%B4%A2%E6%89%8B%E5%86%8C%E9%A1%B5%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我最近从 Debian 迁移到 Arch Linux,并且在使用手册页时遇到了一些问题。我可以很好地打开它们,因此类似的命令man printf
会将我带到正确的页面,但如果我运行man -k printf
或apropos printf
没有得到任何结果。我读到这可以通过命令修复mandb
,但这对我不起作用。我得到以下输出:
0 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.
0 old database entries were purged.
有任何想法吗?
编辑:
该whatis
命令的行为方式相同。我得到:
printf: nothing appropriate.
编辑2:
strace 曼数据库:
execve("/usr/bin/mandb", ["mandb", "2"], 0x7ffe9bbdc1e8 /* 27 vars */) = 0
brk(NULL) = 0x55d5812b8000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffcdcb955e0) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/man-db/tls/haswell/x86_64/libmandb-2.8.5.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/man-db/tls/haswell/x86_64", 0x7ffcdcb94820) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/man-db/tls/haswell/libmandb-2.8.5.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/man-db/tls/haswell", 0x7ffcdcb94820) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/man-db/tls/x86_64/libmandb-2.8.5.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/man-db/tls/x86_64", 0x7ffcdcb94820) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/man-db/tls/libmandb-2.8.5.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/man-db/tls", 0x7ffcdcb94820) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/man-db/haswell/x86_64/libmandb-2.8.5.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/man-db/haswell/x86_64", 0x7ffcdcb94820) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/man-db/haswell/libmandb-2.8.5.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/man-db/haswell", 0x7ffcdcb94820) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/man-db/x86_64/libmandb-2.8.5.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/man-db/x86_64", 0x7ffcdcb94820) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/man-db/libmandb-2.8.5.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=26224, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f45d04d8000
mmap(NULL, 28976, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f45d04d0000
mmap(0x7f45d04d2000, 12288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f45d04d2000
mmap(0x7f45d04d5000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x7f45d04d5000
mmap(0x7f45d04d6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x7f45d04d6000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/man-db/libman-2.8.5.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \220\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=234288, ...}) = 0
mmap(NULL, 237400, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f45d0496000
mprotect(0x7f45d049f000, 192512, PROT_NONE) = 0
mmap(0x7f45d049f000, 155648, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9000) = 0x7f45d049f000
mmap(0x7f45d04c5000, 32768, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2f000) = 0x7f45d04c5000
mmap(0x7f45d04ce000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x37000) = 0x7f45d04ce000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/man-db/libgdbm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=97640, ...}) = 0
mmap(NULL, 97640, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f45d047e000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libgdbm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 0\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=59176, ...}) = 0
mmap(NULL, 61496, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f45d046e000
mmap(0x7f45d0471000, 32768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f45d0471000
mmap(0x7f45d0479000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb000) = 0x7f45d0479000
mmap(0x7f45d047c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd000) = 0x7f45d047c000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/man-db/libpipeline.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libpipeline.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 0\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=63088, ...}) = 0
mmap(NULL, 65992, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f45d045d000
mmap(0x7f45d0460000, 36864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f45d0460000
mmap(0x7f45d0469000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc000) = 0x7f45d0469000
mmap(0x7f45d046c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe000) = 0x7f45d046c000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/man-db/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360=\2\0\0\0\0\0"..., 832) = 832
lseek(3, 792, SEEK_SET) = 792
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\301\234\210\303;`t,\251\6\340\371\371o\343\33"..., 68) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=2141720, ...}) = 0
lseek(3, 792, SEEK_SET) = 792
read(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\301\234\210\303;`t,\251\6\340\371\371o\343\33"..., 68) = 68
lseek(3, 864, SEEK_SET) = 864
read(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32) = 32
mmap(NULL, 1852992, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f45d0298000
mprotect(0x7f45d02ba000, 1675264, PROT_NONE) = 0
mmap(0x7f45d02ba000, 1359872, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f45d02ba000
mmap(0x7f45d0406000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16e000) = 0x7f45d0406000
mmap(0x7f45d0453000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f45d0453000
mmap(0x7f45d0459000, 13888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f45d0459000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/man-db/libseccomp.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libseccomp.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 0\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=292576, ...}) = 0
mmap(NULL, 294960, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f45d024f000
mmap(0x7f45d0272000, 40960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x7f45d0272000
mmap(0x7f45d027c000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2d000) = 0x7f45d027c000
mmap(0x7f45d0280000, 98304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x30000) = 0x7f45d0280000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/man-db/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320!\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=91912, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f45d024d000
mmap(NULL, 2187280, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f45d0036000
mprotect(0x7f45d004c000, 2093056, PROT_NONE) = 0
mmap(0x7f45d024b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f45d024b000
close(3) = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f45d0033000
arch_prctl(ARCH_SET_FS, 0x7f45d0033740) = 0
mprotect(0x7f45d0453000, 16384, PROT_READ) = 0
mprotect(0x7f45d024b000, 4096, PROT_READ) = 0
mprotect(0x7f45d0280000, 94208, PROT_READ) = 0
mprotect(0x7f45d046c000, 4096, PROT_READ) = 0
mprotect(0x7f45d047c000, 4096, PROT_READ) = 0
mprotect(0x7f45d04ce000, 4096, PROT_READ) = 0
mprotect(0x7f45d04d6000, 4096, PROT_READ) = 0
mprotect(0x55d57f86e000, 4096, PROT_READ) = 0
mprotect(0x7f45d0504000, 4096, PROT_READ) = 0
munmap(0x7f45d047e000, 97640) = 0
brk(NULL) = 0x55d5812b8000
brk(0x55d5812d9000) = 0x55d5812d9000
brk(0x55d5812fa000) = 0x55d5812fa000
brk(0x55d58131b000) = 0x55d58131b000
openat(AT_FDCWD, "/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
brk(0x55d58133c000) = 0x55d58133c000
rt_sigaction(SIGPIPE, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f45d02cf8b0}, NULL, 8) = 0
getuid() = 1000
geteuid() = 1000
getgid() = 1000
getegid() = 1000
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(3) = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(3) = 0
openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=334, ...}) = 0
read(3, "# Name Service Switch configurat"..., 4096) = 334
read(3, "", 4096) = 0
close(3) = 0
openat(AT_FDCWD, "/usr/lib/man-db/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=97640, ...}) = 0
mmap(NULL, 97640, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f45d047e000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 0\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=55200, ...}) = 0
mmap(NULL, 83416, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f45d001e000
mmap(0x7f45d0021000, 28672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f45d0021000
mmap(0x7f45d0028000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7f45d0028000
mmap(0x7f45d002b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xc000) = 0x7f45d002b000
mmap(0x7f45d002d000, 21976, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f45d002d000
close(3) = 0
mprotect(0x7f45d002b000, 4096, PROT_READ) = 0
munmap(0x7f45d047e000, 97640) = 0
openat(AT_FDCWD, "/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
lseek(3, 0, SEEK_CUR) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=1020, ...}) = 0
read(3, "root:x:0:0::/root:/bin/bash\nbin:"..., 4096) = 1020
close(3) = 0
rt_sigaction(SIGHUP, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGHUP, {sa_handler=0x7f45d049f500, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f45d02cf8b0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x7f45d049f500, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f45d02cf8b0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTERM, {sa_handler=0x7f45d049f500, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f45d02cf8b0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
openat(AT_FDCWD, "/home/sam/.manpath", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/man_db.conf", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=5141, ...}) = 0
read(3, "# man_db.conf\n#\n# This file is u"..., 4096) = 4096
read(3, "ted way.\n# If a particular exten"..., 4096) = 1045
read(3, "", 4096) = 0
close(3) = 0
stat("/home/sam/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/home/sam/bin/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/home/sam/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/home/sam/bin/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/home/sam/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/home/sam/bin/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/home/sam/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/home/sam/bin/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/local/man", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/local/share/man", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/share/man", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/usr/bin/man", {st_mode=S_IFREG|0755, st_size=110888, ...}) = 0
stat("/usr/bin/site_perl/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/bin/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/bin/site_perl/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/bin/man", {st_mode=S_IFREG|0755, st_size=110888, ...}) = 0
stat("/usr/bin/vendor_perl/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/bin/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/bin/vendor_perl/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/bin/man", {st_mode=S_IFREG|0755, st_size=110888, ...}) = 0
stat("/usr/bin/core_perl/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/bin/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/bin/core_perl/share/man", 0x7ffcdcb95320) = -1 ENOENT (No such file or directory)
stat("/usr/man", 0x7ffcdcb952d0) = -1 ENOENT (No such file or directory)
stat("2", 0x7ffcdcb95300) = -1 ENOENT (No such file or directory)
fstat(1, {st_mode=S_IFREG|0644, st_size=14581, ...}) = 0
write(1, "0 man subdirectories contained n"..., 1390 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.
0 old database entries were purged.
) = 139
exit_group(0) = ?
+++ exited with 0 +++
答案1
我不完全确定,但我认为该命令mandb -c
解决了这个问题。我现在可以搜索手册页。