Ubuntu

當手冊頁不可用時,請參閱“man 7 undocumented”獲取幫助 - WSL 核心 Ubuntu 18.04 安裝

  • November 28, 2018

我在帶有lxrunoffline分發管理實用程序的 win10 上使用 WSL。我的發行版是 Ubuntu 18.04 核心安裝,可以在這裡找到 -下載連結

鍵入man man,man pwdman <anything>產生以下結果:

No manual entry for man
See 'man 7 undocumented' for help when manual pages are not available.

這是我嘗試過的一些命令:

$ sudo mandb
Purging old database entries in /usr/share/man...
Processing manual pages under /usr/share/man...
Purging old database entries in /usr/share/man/cs...
Processing manual pages under /usr/share/man/cs...
Purging old database entries in /usr/share/man/da...
Processing manual pages under /usr/share/man/da...
...
0 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.
0 old database entries were purged.


$ sudo mandb -t   */ output here certainly looks suspicious /*
mandb: warning: /usr/share/man/man1/sh.1.gz is a dangling symlink
mandb: warning: can't update index cache /var/cache/man/index.db: Resource temporarily unavailable
mandb: warning: can't update index cache /var/cache/man/cs/index.db: Resource temporarily unavailable
mandb: warning: can't update index cache /var/cache/man/da/index.db: Resource temporarily unavailable
mandb: warning: can't update index cache /var/cache/man/de/index.db: Resource temporarily unavailable
...


$ dpkg -l | grep -i manpages
ii  manpages                    4.15-1                            all          Manual pages about using a GNU/Linux system
ii  manpages-dev                4.15-1                            all          Manual pages about using GNU/Linux for development
ii  manpages-posix              2013a-2                           all          Manual pages about using POSIX system

我還檢查了/usr/share/man文件夾,它們大多是空的(其他 manpath 文件夾完全是空的),除了一些損壞的符號連結:

$ manpath
/usr/local/man:/usr/local/share/man:/usr/share/man
$ cd /usr/share/man/man1
$ ls -alh
drwxr-xr-x 1 root root 4.0K Nov 27 18:16 .
drwxr-xr-x 1 root root 4.0K Sep 28 04:02 ..
lrwxrwxrwx 1 root root    9 Sep 28 04:00 sh.1.gz -> dash.1.gz
$ file sh.1.gz
sh.1.gz: broken symbolic link to dash.1.gz

然後我嘗試將我在Ubuntu 手冊頁網站上找到的 man gzips放入 man1 文件夾中,使其正常工作:

$ cd /usr/share/man/man1
$ ls -alh
drwxr-xr-x 1 root root 4.0K Nov 27 18:16 .
drwxr-xr-x 1 root root 4.0K Sep 28 04:02 ..
-rwxr-xr-x 1 root root 3.1K Nov 27 18:16 ls.1.gz <-- downloaded this one
lrwxrwxrwx 1 root root    9 Sep 28 04:00 sh.1.gz -> dash.1.gz
*/ 'man ls' works now /*

還嘗試重新安裝 mandb 和手冊頁無濟於事。

手動下載手冊頁文件可以解決問題,但必須有一些包或配置可以為我做到這一點。我該如何解決這個問題?

編輯 1

$ head -n 1000 /etc/dpkg/dpkg.cfg /etc/dpkg/dpkg.cfg.d/*
==> /etc/dpkg/dpkg.cfg <==
# dpkg configuration file
#
# This file can contain default options for dpkg.  All command-line
# options are allowed.  Values can be specified by putting them after
# the option, separated by whitespace and/or an `=' sign.
#

# Do not enable debsig-verify by default; since the distribution is not using
# embedded signatures, debsig-verify would reject all packages.
no-debsig

# Log status changes and actions to a file.
log /var/log/dpkg.log

==> /etc/dpkg/dpkg.cfg.d/excludes <==
# Drop all man pages
path-exclude=/usr/share/man/*

# Drop all documentation ...
path-exclude=/usr/share/doc/*

# ... except copyright files ...
path-include=/usr/share/doc/*/copyright

# ... and Debian changelogs
path-include=/usr/share/doc/*/changelog.Debian.*

前兩行/etc/dpkg/dpkg.cfg.d/excludes

# Drop all man pages
path-exclude=/usr/share/man/*

導致安裝軟體包時刪除所有手冊頁。

要使手冊頁可用,您必須將第二行註釋掉:

# Drop all man pages
# path-exclude=/usr/share/man/*

然後重新安裝您想要手冊頁的任何軟體包:

apt --reinstall install man-db coreutils

恢復manls手冊頁(等等)。

引用自:https://unix.stackexchange.com/questions/484705