The trouble with books is that you can't update them the way you can a web page or any other online documentation. The result is that most leading edge computer books are out of date almost before they are printed. Unfortunately, ``The Complete FreeBSD'', published by Walnut Creek, is no exception. Inevitably, a number of bugs and changes have surfaced.
The following is a list of modifications which go beyond simple typos. They relate to the second edition, formatted on 16 December 1997. If you have this book, please check this list. If you have the first edition of 19 July 1996, please check ftp://ftp.lemis.com/pub/cfbsd/errata-1. This same file is also available via the web link http://www.lemis.com/errata-1.
This list is available in four forms:
A PostScript version, suitable for printing out, at ftp://ftp.lemis.com/pub/cfbsd/errata-2.ps. See page 222 of the book to find out how to print out PostScript. If at all possible, please take this document: it's closest to the original text.
Be careful selecting this link with a web browser: it is often impossible to reload the document, and you may see a previously cached version.
A web version at http://www.lemis.com/errata-2.html
In a number of places, I suggest the use of the following command to find process information:
$ ps aux | grep foo
Unfortunately, ps is sensitive to the column width of the terminal emulator upon which it is working. This command usually works fine on a relatively wide xterm, but if you're running on an 80-column terminal, it may truncate exactly the information you're looking for, so you end up with no output. You can fix that with the w option:
$ ps waux | grep foo
Thanks to Sue Blake for this information
drwxr-xr-x jkh/jkh 0 Oct 17 13:01 1997 cfbsd/ drwxr-xr-x jkh/jkh 0 Oct 17 13:01 1997 cfbsd/mutt/ -rw-r--r-- jkh/jkh 352 Oct 15 15:21 1997 cfbsd/mutt/.mail_aliases -rw-r--r-- jkh/jkh 9394 Oct 15 15:22 1997 cfbsd/mutt/.muttrc drwxr-xr-x jkh/jkh 0 Oct 17 14:02 1997 cfbsd/scripts/ -rw-r--r-- jkh/jkh 18281 Oct 16 16:52 1997 cfbsd/scripts/.fvwm2rc -rwxr-xr-x jkh/jkh 1392 Oct 17 12:54 1997 cfbsd/scripts/install-desktop -rw-r--r-- jkh/jkh 296 Oct 17 12:35 1997 cfbsd/scripts/.xinitrc -rwxr-xr-x jkh/jkh 622 Oct 17 13:51 1997 cfbsd/scripts/install-rcfiles -rw-r--r-- jkh/jkh 1133 Oct 17 13:00 1997 cfbsd/scripts/Uutry -rw-r--r-- jkh/jkh 1028 Oct 17 14:02 1997 cfbsd/scripts/README drwxr-xr-x jkh/jkh 0 Oct 18 19:32 1997 cfbsd/docs/ -rw-r--r-- jkh/jkh 199111 Oct 16 14:29 1997 cfbsd/docs/packages.txt -rw-r--r-- jkh/jkh 189333 Oct 16 14:28 1997 cfbsd/docs/packages-by-category.txt -rw-r--r-- jkh/jkh 188108 Oct 16 14:29 1997 cfbsd/docs/packages.ps -rw-r--r-- jkh/jkh 226439 Oct 16 14:27 1997 cfbsd/docs/packages-by-category.ps -rw-r--r-- jkh/jkh 788 Oct 16 15:01 1997 cfbsd/README -rw-r--r-- jkh/jkh 248 Oct 17 11:52 1997 cfbsd/errataTo extract one of these files, say cfbsd/docs/packages.txt, and assuming you have the CD-ROM mounted as /cdrom, enter:
# cd /usr/share/doc
# tar xvzf /cdrom/xperimnt/cfbsd/cfbsd.tar.gz cfbsd/docs/packages.txt
See page 209 for more information on using tar.
These files are an early version of what is described in the book. I'll put up some updated versions on ftp://ftp.lemis.com/ in the near future.
Thanks to Frank McCormick for drawing this to my attention.
In this book, I recommend the use of the Bourne shell or one of its descendents (sh, bash, pdksh, ksh or zsh). With the exception of sh, they are all in the Ports Collection. I personally use the bash shell.
This is a personal preference, and a recommendation, but it's not the standard shell. The standard BSD shell is the C shell (csh), which has a fuller-featured descendent tcsh. In particular, the standard installation sets the root user up with a csh. See page 152 (in this errata) for details of how to change the shell.
If you're running X, you can use a browser like netscape to read the handbook. If you don't have X running yet, use lynx. Both of these programs are included on the CD-ROM. To install them, enter:
# pkg_add /cdrom/packages/All/netscape-communicator-4.5.tgz or # pkg_add /cdrom/packages/All/lynx-2.8.1.1.tgzThe numbers after the name (4.5 and 2.8.1.1) may change after this book has been printed. Use ls to list the names if you can't find these particular versions.
Note that lynx is not a complete substitute for netscape: since it is text-only, it is not capable of displaying the large majority of web pages correctly. It will suffice for reading most of the handbook, however.
Thanks to Stuart Henderson and gkaplan@castle.net for drawing this to my attention.
Alternatively, you can print out the handbook. You need to have the documentation sources (/usr/doc) installed on your system. You can find them on the second CD-ROM in the directory of the same name. To install them, first mount your CD-ROM (see page 175). Then enter:
$ cd /cdrom/usr/doc/handbook $ mkdir -p /usr/doc/handbook you may need to be root for this operation $ cp -pr * /usr/doc/handbookYou have a choice of formats for the output:
$ make FORMATS=psThis creates a file handbook.ps which you can then print to a PostScript printer or with the aid of ghostscript (see page 222).
Thanks to Bob Beer for drawing this to my attention.
The floppy set should contain the file bin.inf and the ones whose names start with bin. followed by two letters. These other files are all 240640 bytes long, except for the final one which is usually shorter. Use the MS-DOS COPY program to copy as many files as will fit onto each disk (5 or 6) until you've got all the distributions you want packed up in this fashion. Copy each distribution into subdirectory corresponding to the base name--for example, copy the bin distribution to the files A:\BIN\BIN.INF, A:\BIN\BIN.AA and so on.
Alternatively, you can install packages from the /stand/sysinstall Final Configuration Menu. We saw this menu on page in figure 4-14 on page 71. When you start sysinstall from the command line, you get to this menu by selecting Index, and then selecting Configure.
Instead, do:
# cd /cd4/ports/distfiles # mkdir -p /usr/ports/distfiles make sure you have a distfiles directory # for i in *; do > ln -s /cd4/ports/distfiles/$i /usr/ports/distfiles/$i > doneIf you're using csh or tcsh, enter:
# cd /cd4/ports/distfiles # mkdir -p /usr/ports/distfiles make sure you have a distfiles directory # foreach i (*) ? ln -s /cd4/ports/distfiles/$i /usr/ports/distfiles/$i ? endThanks to Christopher Raven and François Jacques for drawing this to my attention.
For a full install, choose /cdrom/dists/XF86331/X331*.tgz. If you are using sh, enter:
# cd /usr/X11R6 # for i in /cdrom/dists/XF86331/X331*.tgz; do # tar xzf $i # doneIf you are using csh, enter:
% cd /usr/X11R6 % foreach i (/cdrom/dists/XF86331/X331*.tgz) % tar xzf $i % endFor a minimal installation, first choose a server archive corresponding to your VGA board. If table 8-2 on page 103 doesn't give you enough information, check the server man pages, starting on page 1545, which list the VGA chip sets supported by each server. For example, if you have an ET4000 based board you will use the XF86_SVGA server. In this case you would enter:
# cd /usr/X11R6 # tar xzf /cdrom/dists/XF86331/X331SVGA.tgz substitute your server name here # for i in bin fnts lib xicf; do # tar xzf /cdrom/dists/XF86331/X331$i.tgz # doneIf you are using csh, enter:
% cd /usr/X11R6 % tar xzf /cdrom/dists/XF86331/X331SVGA.tgz substitute your server name here % foreach i (bin fnts lib xicf) % tar xzf /cdrom/dists/XF86331/$i % end
Thanks to Manuel Enrique Garcia Cuesta for pointing out this one.
These values are defaults, and many are either incorrect for FreeBSD (for example the device name /dev/com1) or do not apply at all (for example Xqueue). If you are configuring manually, select one Protocol and one Device entry from the following selection. If you must use a two-button mouse, uncomment the keyword Emulate3Buttons--in this mode, pressing both mouse buttons simultaneously within Emulate3Timeout milliseconds causes the server to report a middle button press.
Section "Pointer" Protocol "Microsoft" for Microsoft protocol mice Protocol "MouseMan" for Logitech mice Protocol "PS/2" for a PS/2 mouse Protocol "Busmouse" for a bus mouse Device "/dev/ttyd0" for a mouse on the first serial port Device "/dev/ttyd1" for a mouse on the second serial port Device "/dev/ttyd2" for a mouse on the third serial port Device "/dev/ttyd3" for a mouse on the fourth serial port Device "/dev/psm0" for a PS/2 mouse Device "/dev/mse0" for a bus mouse Emulate3Buttons only for a two-button mouse EndSectionYou'll notice that the protocol name does not always match the manufacturer's name. In particular, the Logitech protocol only applies to older Logitech mice. The newer ones use either the MouseMan or Microsoft protocols. Nearly all modern serial mice run one of these two protocols, and most run both.
If you are using a bus mouse or a PS/2 mouse, make sure that the device driver is included in the kernel. The GENERIC kernel contains drivers for both mice, but the PS/2 driver is disabled. Use UserConfig (see page 50) to enable it.
If you do manage to lose the root password, all may not be lost. Reboot the machine to single user mode (see page 157), and enter:
# mount -u / mount root file system read/write # mount /usr mount /usr file system (if separate) # passwd root change the password for root Enter new password: Enter password again: # ^D enter ctrl-D to continue with startupIf you have a separate /usr file system (the normal case), you need to mount it as well, since the passwd program is in the directory /usr/bin. Note also that you should explicitly state the name root: in single user mode, the system doesn't have the concept of user IDs.
Modern shells supply command line editing which resembles the editors vi or Emacs. In bash, sh, ksh, and zsh you can make the choice by entering
It would be tedious for every user to put settings in their private initialization files, so the shells also read a system-wide default file. For the Bourne shell family, it is /etc/profile, while the C shell family has three files: /etc/csh.login to be executed on login, /etc/csh.cshrc to be executed when a new shell is started after you log in, and /etc/csh.logout to be executed when you stop a shell. The start files are executed before the corresponding individual files.
In addition, login classes (page 141) offer another method of setting environment variables at a global level.
You can get better command line editing with tcsh, in the Ports Collection. You can get both better command line editing and Bourne shell syntax with bash, also in the Ports Collection. The latest version of the Bourne shell sh also includes some command line editing.
If you have root access, you can use vipw to change your shell, but there's a more general way: use chsh (Change Shell). Simply run the program. It starts your favourite editor (as defined by the EDITOR environment variable). Here's an example before:
#Changing user database information for velte. Shell: /bin/csh Full Name: Jack Velte Location: Office Phone: Home Phone:You can change anything after the colons. For example, you might change this to:
#Changing user database information for velte. Shell: /usr/local/bin/bash Full Name: Jack Velte Location: On the road Office Phone: +1-408-555-1999 Home Phone:chsh checks and updates the password files when you save the modifications and exit the editor. The next time you log in, you get the new shell. chsh tries to ensure you don't make any mistakes--for example, it won't let you enter the name of a shell which isn't mentioned in the file /etc/shells--but it's a very good idea to check the shell before logging out. You can try this with su, which you normally use to become super user:
bumble# su velte Password: su-2.00$ note the new promptThere are a couple of problems in using tcsh or bash as a root shell:
# cp /usr/local/bin/bash /bin
# List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells. /bin/sh /bin/csh /bin/bash
You can then change the shell for root as described above.
Thanks to Lars Köller for drawing this to my attention.
The second-level boot locates the kernel, by default the file /kernel on the root file system, and loads it into memory. It prints the Boot: prompt at this point so that you can influence this choice--see the man page on page 579 for more details of what you can enter at this prompt.
The standard solution for these problems is to relocate the /tmp file system to a different directory, say /usr/tmp, and create a symbolic link from /usr/tmp to /tmp--see Chapter 4, Installing FreeBSD, page 72, for more details.
Thanks to Charlie Sorsby for drawing this to my attention.
Microsoft platforms identify partitions by letters which are assigned at boot time. There is no obvious relation between the partitions, and you have little control over the way the system assigns them. By contrast, all UNIX partitions have a specific relation to the root file system, which is called simply /. This flexibility has one problem: you have the choice of where in the overall file system structure you put your individual file systems. You specify the location with the mount command. For example, you would typically mount a CD-ROM in the directory /cdrom, but if you have three CD-ROM drives attached to your SCSI controller, you might prefer to mount them in the directories /cd0, /cd1, and /cd2. In order to mount a file system, you need to specify the device to be mounted, where it is to be mounted, and the type of file system (unless it is ufs). The mount point, (the directory where it is to be mounted) must already exist. To mount your second CD-ROM on /cd1, you would enter:
# mkdir /cd1 only if it doesn't exist # mount -t cd9660 -o ro /dev/cd1a /cd1
Thanks to Christiane Yeardly for drawing this to my attention.
Unmounting file systems
When you mount a file system, the system assumes it is going to stay there, and in the interests of efficiency it delays writing data back to the file system. This is the same effect we discussed on page 158. As a result, if you want to stop using a file system, you need to tell the system about it. You do this with the umount command. Note the spelling--there's no n in the command name.
You need to do this even with read-only media such as CD-ROMs: the system assumes it can access the data from a mounted file system, and it gets quite unhappy if it can't. Where possible, it locks removable media so that you can't remove them from the device until you unmount them.
Using umount is straightforward: just tell it what to unmount, either the device name or the directory name. For example, to unmount the CD-ROM we mounted in the example above, you could enter one of these commands:
# umount /dev/cd1a # umount /cd1
Before unmounting a file system, umount checks that nobody is using it. If somebody is using it, it will refuse to unmount it with a message like umount: /cd1: Device busy. This message often occurs because you have changed your directory to a directory on the file system you want to remove. For example (which also shows the usefulness of having directory names in the prompt):
=== root@freebie (/dev/ttyp2) /cd1 16 -> umount /cd1 umount: /cd1: Device busy === root@freebie (/dev/ttyp2) /cd1 17 -> cd === root@freebie (/dev/ttyp2) ~ 18 -> umount /cd1 === root@freebie (/dev/ttyp2) ~ 19 ->
Thanks to Ken Deboy for pointing out this omission.
For example, to generate a second set of 32 pseudo-terminals, enter:
# cd /dev # ./MAKEDEV pty1You can generate up to 256 pseudo-terminals. They are named ttyp0 through ttypv, ttyq0 through ttyqv, ttyr0 through ttyrv, ttys0 through ttysv, ttyP0 through ttyPv, ttyQ0 through ttyQv, ttyR0 through ttyRv and ttyS0 through ttySv. To create each set of 32 terminals, use the number of the set: the first set is pty0, and the eighth set is pty7. Note that some processes, such as xterm, only look at ttyp0 through ttysv.
Thanks to Karl Wagner for pointing out this error.
The first name, up the the symbol, is the label.
In fact, it should read:
The first name, up to the | symbol, is the label.
Thanks to Norman C Rice for pointing out this one.
# lpdNormally, however, you will want it to be started automatically when the system starts up. You do this by setting the variable lpd_enable in /etc/rc.conf:
lpd_enable="YES" # Run the line printer daemonSee page 1609 for more details of /etc/rc.conf. Another line in rc.conf refers to the line printer dĉmon:
lpd_flags="" # Flags to lpd (if enabled).You don't normally need to change this line. See the man page for lpd for details of the flags.
Thanks to Tommy G. James for bringing this to my attention.
xhost presto bumble gwThe original version allowed anybody on the Internet to access your system.
Thanks to Jerry Dunham for drawing this one to my attention.
You'll find all the files described in this chapter on the first CD-ROM (Installation CD-ROM) in the directory /book/scripts. Remember that you must mount the CD-ROM before you can access the files--see page 175 for further details. The individual scripts are in the directory /book/scripts, but you'll probably find it easier to install them with the script install-desktop:
Thanks to Chris Kaiser for drawing this to my attention.
# mkdir -p /usr/src/sys # ln -s /usr/src/sys /sys # cd / # cat /cdrom/src/ssys.[a-d]* | tar xzvf -Thanks to Raymond Noel, Suttipan Limanond and Satwant for finding this one in several small slices.
In order to use the Berkeley Packet Filter, you must also create the device nodes /dev/bpf0 to /dev/bpf3 (if you're using the default number 4). Currently, MAKEDEV doesn't help much--you need to create each device separately:
# cd /dev # ./MAKEDEV bpf0 # ./MAKEDEV bpf1 # ./MAKEDEV bpf2 # ./MAKEDEV bpf3Thanks to Christopher Raven for drawing this to my attention.
Next, change to the build directory and build the kernel:
# cd ../../compile/FREEBIE # make depend # make
The make depend is needed even if the directory has just been created: apart from creating dependency information, it also creates some files needed for the build.
Thanks to Mark Ovens for drawing this to my attention.
Possibly, the date of the last update that you want to be included in the checkout. If you specify this date, cvs ignores any more recent updates. This option is often useful when somebody discovers a recently introduced bug in -CURRENT: you check out the modules as they were before the bug was introduced. You specify the date with the -D option, for example -D "10 December 1997".
If you need to check out an older version, for example if there are problems with the most recent version of -CURRENT, you could enter:
# cvs co -D "10 December 1997" src/sys
This command checks out the kernel sources as of 10 December 1997.
# brandelf -t linux /usr/local/StarOffice-3.1/linux-x86/bin/swriter3Thanks to Dan Busarow for bringing this to my attention.
The names MYADDR and HISADDR are keywords which represent the addresses at each end of the link. They must be written as shown, though they may be in lower case.
to
The names MYADDR and HISADDR are keywords which represent the addresses at each end of the link. They must be written as shown, though newer versions of ppp allow you to write them in lower case.
Thanks to Mark S. Reichman for this correction.
In FreeBSD version 3.0 and later, specify the options PPP_BSDCOMP and PPP_DEFLATE to enable two kinds of compression. You'll also need to specify the corresponding option in Kernel PPP's configuration file. These options are not available in FreeBSD version 2.
Thanks to Brian Somers for this information.
www IN CNAME freebie ftp IN CNAME prestoIn other words, there should be a space between CNAME and the system name.
tcpdump is a program which monitors a network interface and displays selected information which passes through it. It uses the Berkeley Packet Filter (bpf), an optional component of the kernel. It is not included in the GENERIC kernel: see page 257 for information on how to configure it.
If you don't configure the Berkeley Packet Filter, you will get a message like
tcpdump: /dev/bpf0: device not configuredIf you forget to create the devices for bpf, you will get a message like:
tcpdump: /dev/bpf0: No such file or directorySince tcpdump poses a potential security problem, you must be root in order to run it. The simplest way to run it is without any parameters. This will cause tcpdump to monitor and display all traffic on the first active network interface, normally Ethernet:
Thanks to Christopher Raven for drawing this to my attention.
Create a user ftp, with the anonymous ftp directory as the home directory and the shell /dev/null. Using /dev/null as the shell makes it impossible to log in as user ftp, but does not interfere with the use of anonymous ftp. ftp can be a member of group bin, or you can create a new group ftp by adding the group to /etc/group. See page 138 for more details of adding users, and the man page on page 805 for adding groups.
Thanks to Mark S. Reichman for drawing this to my attention.
Finally, you may find it convenient to let some other system handle all your mail delivery for you: you just send anything you can't deliver locally to this other host, which sendmail calls a smart host. This is particularly convenient if you send your mail with UUCP.
To tell sendmail to use a smart host (in our case, mail.example.net), find the following line in sendmail.cf:
# "Smart" relay host (may be null)
DS
Change it to:
# "Smart" relay host (may be null)
DSmail.example.net
socket options is hardly mentioned in the documentation, but it's very important: many Microsoft implementations of TCP/IP are inefficient and establish a new TCP more often than necessary. Select the socket options TCP_NODELAY and IPTOS_LOWDELAY, which can speed up the response time of such applications by over 95%.
Thanks to Anders Andersson for drawing this to my attention.