Product SiteDocumentation Site

章 7. 解決問題與找到相關資訊

7.1. 文件來源
7.1.1. 手冊頁面
7.1.2. info 文件
7.1.3. 特定文件
7.1.4. 網站
7.1.5. 教學文件 (HOWTO)
7.2. 通常步驟
7.2.1. 組態程式
7.2.2. 監控後台進程的工作
7.2.3. 通過郵件列表尋求幫助
7.2.4. 以錯誤報告棘手的問題
對系統管理員來說,最重要的技能是能夠克服任何已知或未知的情況。本章將給一些方法 — 希望 — 能夠定位問題的原因,並解決它。

7.1. 文件來源

還沒弄清楚問題所在前,需先知道該問題涉及的每個程式運作原理。為此,最好的方法是參考程式本身的文件;不過這些文件很多且分散各地,應先知道如何找到它們。

7.1.1. 手冊頁面

Manual pages, while relatively terse in style, contain a great deal of essential information. We will quickly go over the command for viewing them, provided by the man-db package. Simply type man manual-page — the manual page usually goes by the same name as the command whose documentation is sought. For example, to learn about the possible options for the cp command, you would type the man cp command at the shell prompt (see sidebar 基本 shell,命令列解譯器).
Man pages not only document commands and programs accessible from the command line, but also configuration files, system calls, library functions, and so forth. Sometimes names can collide. For example, the shell's read command has the same name as the read system call. This is why manual pages are organized in numbered sections:
1
可從命令列執行的命令;
2
系統呼叫 (核心提供的函數);
3
程式庫函數 (由系統程式庫提供);
4
設備 (在 Unix之類系統下,以檔案形式存在,通常置於 /dev/ 資料夾);
5
組態檔 (格式與約定);
6
遊戲
7
巨集與標準集;
8
系統管理命令;
9
核心常規。
可以指定查看手冊頁面的特定區塊:檢視 read 系統呼叫的文件時,應鍵入 man 2 read。未指定區塊時,將顯示第一個找到同名的手冊頁面。因此,man shadow 送回 shadow(5) 因為在區塊 1 至 4 都沒有 shadow 的手冊頁面。
當然,不知道命令的名稱時,手冊就沒什麼用。此時需要 apropos 命令,協助搜尋手冊頁面,或其簡短說明。每個手冊頁面都有一行簡要的摘要。apropos 送回手冊頁面鍵詞清單。選擇適當的鍵詞,就能找到命令的名稱。

範例 7.1. 找尋 cp 使用 apropos

$ apropos "copy file"
cp (1)               - copy files and directories
cp (1posix)          - copy files
cpio (1)             - copy files to and from archives
exec (1posix)        - execute commands and open, close, or copy file descriptors
install (1)          - copy files and set attributes
ntfscp (8)           - copy file to an NTFS volume.
The man command is not the only means of consulting the manual pages, since khelpcenter and konqueror (by KDE) and yelp (under GNOME) programs also offer this possibility. There is also a web interface, provided by the man2html package, which allows you to view manual pages in a web browser. On a computer where this package is installed, use this URL after following the instructions in /usr/share/doc/man2html/README.Debian:
此工具需要瀏覽器。所以必須先安裝此套件於伺服器內:內網內的所有使用者都可以使用此服務 (包括非 Linux 機器),且不需在每個工作站都設定 HTTP 伺服器。若伺服器允許其他網路近用,需設定該等服務祗限內網使用者。
Last but not least, you can view all manual pages available in Debian (even those that are not installed on your machine) on the manpages.debian.org service. It offers each manual page in multiple versions, one for each Debian release.

7.1.2. info 文件

GNU 計畫以 info 格式撰寫大部份程式的手冊;其他的程式手冊也採用 info 文件格式。此格式優點甚多,但檢視此文件的程式 (稱為 info) 有點複雜。建議使用 pinfo 取代之 (來自 pinfo 套件)。
info 文件有層級結構,無參數的 pinfo 檢視,顯示第一層的節點。通常節點名稱等同於命令名稱。
With pinfo navigating between these nodes is easy to achieve with the arrow keys. Alternatively, you could also use a graphical browser, which is a lot more user-friendly. Again, konqueror and yelp work; the info2www package also provides a web interface.
info 系統不支援翻譯功能,不同於 man 頁面系統可以翻譯。info 文件幾乎都是英文。雖然如此,當您詢問 pinfo 程式顯示不存在的 info 頁面時,實際上卻回到 man 的同名 (若存在的話) 頁面,那是可以翻譯的。

7.1.3. 特定文件

每個套件均含本身的文件。即使文件做得最差的程式仍有一個 README 檔案,內容是有趣或重要的資訊。此文件安裝在 /usr/share/doc/套件名稱/ 資料來內 (套件名稱 表示該套件的名稱)。若文件特大,可能沒辦法放在程式的主套件內,可能放在名為 套件名稱-doc 的離線專屬套件。再從主套件建議讀取文件套件。
The /usr/share/doc/package/ directory also contains some files provided by Debian which complete the documentation by specifying the package's particularities or improvements compared to a traditional installation of the software. The README.Debian file also indicates all of the adaptations that were made to comply with the Debian Policy. The changelog.Debian.gz file allows the user to follow the modifications made to the package over time: it is very useful to try to understand what has changed between two installed versions that do not have the same behavior. Finally, there is sometimes a NEWS.Debian.gz file which documents the major changes in the program that may directly concern the administrator (see 節 6.7.2, “處理升級後的問題”).

7.1.4. 網站

In most cases, free software programs have websites that are used to distribute it and to bring together the community of its developers and users. These sites are frequently loaded with relevant information in various forms: official documentation, FAQ (Frequently Asked Questions), mailing list archives, etc. Problems that you may encounter have often already been the subject of many questions; the FAQ or mailing list archives may have a solution for it. A good mastery of search engines will prove immensely valuable to find relevant pages quickly (by restricting the search to the Internet domain or sub-domain dedicated to the program). If the search returns too many pages or if the results do not match what you seek, you can add the keyword debian to limit results and target relevant information.
If you do not know the address for the software's website, there are various means of getting it. First, check if there is a Homepage field in the package's meta-information (apt show package). Alternately, the package description may contain a link to the program's official website. If no URL is indicated, look at /usr/share/doc/package/copyright. The Debian maintainer generally indicates in this file where they got the program's source code, and this is likely to be the website that you need to find. If at this stage your search is still unfruitful, consult a free software directory, such as FSF's Free Software Directory, or search directly with a search engine, such as Google, DuckDuckGo, Yahoo, etc.
You might also want to check the Debian wiki, a collaborative website where anybody, even new visitors, can make suggestions directly from their browsers. It is used equally by developers who design and specify their projects, and by users who share their knowledge by writing documents collaboratively.

7.1.5. 教學文件 (HOWTO)

A HOWTO is a document that describes, in concrete terms and step by step, “how to” reach a predefined goal. The covered goals are relatively varied, but often technical in nature: for example, setting up IP Masquerading, configuring software RAID, installing a Samba server, etc. These documents often attempt to cover all of the potential problems likely to occur during the implementation of a given technology.
Many such tutorials are managed by the Linux Documentation Project (LDP), whose website hosts all of these documents:
Debian also provides tutorials for its users:
All these documents should be taken with a grain of salt. They are often several years old; the information they contain is sometimes obsolete. This phenomenon is even more frequent for their translations, since updates are neither systematic nor instant after the publication of a new version of the original documents. Further many tutorials nowadays are provided by bloggers, sharing their individual solution with the interested reader. They often lack important information, i.e. the reason why some configuration has been chosen over another, or why some option has been enabled or disabled. Because blogging and creating personal websites made it so easy to share, many of these often short tutorials exist, but only a few are actively maintained and well-kept. This can make it hard to find the "right" one for you. This is all part of the joys of working in a volunteer environment and without constraints…