xref: /csrg-svn/share/doc/smm/01.setup/3.t (revision 64052)
1\" Copyright (c) 1980, 1986, 1988, 1993
2.\"	 The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"	@(#)3.t	6.29 (Berkeley) 07/27/93
7.\"
8.ds lq ``
9.ds rq ''
10.ds RH "Upgrading a \*(Ps System
11.ds CF \*(Dy
12.Sh 1 "Upgrading a \*(Ps System"
13.PP
14This section describes the procedure for upgrading a \*(Ps
15system to \*(4B.  This procedure may vary according to the version of
16the system running before conversion.
17If you are converting from a
18System V system, some of this section will still apply (in particular,
19the filesystem conversion).  However, many of the system configuration
20files are different, and the executable file formats are completely
21incompatible.
22.PP
23In particular be wary when using this information to upgrade
24a \*(Ps HP300 system.
25There are at least 4 different versions of ``\*(Ps'' out there:
26.IP 1)
27HPBSD 1.x from Utah.
28.br
29This was the original version of \*(Ps for HP300s from which the
30other variants (and \*(4B) are derived.
31It is largely a \*(Ps system with Sun's NFS 3.0 filesystem code and
32some \*(Ps-Tahoe features (e.g. networking code).
33Since the filesystem code is 4.2/4.3 vintage and the filesystem
34hierarchy is largely \*(Ps, most of this section should apply.
35.IP 2)
36MORE/bsd from Mt. Xinu.
37.br
38This is a \*(Ps-Tahoe vintage system with Sun's NFS 4.0 filesystem code
39upgraded with Tahoe UFS features.
40The instructions for \*(Ps-Tahoe should largely apply.
41.IP 3)
42\*(Ps-Reno from CSRG.
43.br
44At least one site bootstrapped HP300 support from the Reno distribution.
45The Reno filesystem code was somewhere between \*(Ps and \*(4B: the VFS switch
46had been added but many of the UFS features (e.g. ``inline'' symlinks)
47were missing.
48The filesystem hierarchy reorganization first appeared in this release.
49Be extremely careful following these instructions if you are
50upgrading from the Reno distribution.
51.IP 4)
52HPBSD 2.0 from Utah.
53.br
54As if things weren't bad enough already,
55this release has the \*(4B filesystem and networking code
56as well as some utilities, but still has a \*(Ps hierarchy.
57No filesystem conversions are necessary for this upgrade,
58but files will still need to be moved around.
59.Sh 2 "Installation overview"
60.PP
61If you are running \*(Ps, upgrading your system
62involves replacing your kernel and system utilities.
63In general, there are three possible ways to install a new \*(Bs distribution:
64(1) boot directly from the distribution tape, use it to load new binaries
65onto empty disks, and then merge or restore any existing configuration files
66and filesystems;
67(2) use an existing \*(Ps or later system to extract the root and
68.Pn /usr
69filesystems from the distribution tape,
70boot from the new system, then merge or restore existing
71configuration files and filesystems; or
72(3) extract the sources from the distribution tape onto an existing system,
73and use that system to cross-compile and install \*(4B.
74For this release, the second alternative is strongly advised,
75with the third alternative reserved as a last resort.
76In general, older binaries will continue to run under \*(4B,
77but there are many exceptions that are on the critical path
78for getting the system running.
79Ideally, the new system binaries (root and
80.Pn /usr
81filesystems) should be installed on spare disk partitions,
82then site-specific files should be merged into them.
83Once the new system is up and fully merged, the previous root and
84.Pn /usr
85filesystems can be reused.
86Other existing filesystems can be retained and used,
87except that (as usual) the new
88.Xr fsck
89should be run before they are mounted.
90.PP
91It is \fBSTRONGLY\fP advised that you make full dumps of each filesystem
92before beginning, especially any that you intend to modify in place
93during the merge.
94It is also desirable to run filesystem checks
95of all filesystems to be converted to \*(4B before shutting down.
96This is an excellent time to review your disk configuration
97for possible tuning of the layout.
98Most systems will need to provide a new filesystem for system use
99mounted on
100.Pn /var
101(see below).
102However, the
103.Pn /tmp
104filesystem can be an MFS virtual-memory-resident filesystem,
105potentially freeing an existing disk partition.
106(Additional swap space may be desirable as a consequence.)
107See
108.Xr mfs (8).
109.PP
110The recommended installation procedure includes the following steps.
111The order of these steps will probably vary according to local needs.
112.IP \(bu
113Extract root and
114.Pn /usr
115filesystems from the distribution tapes.
116.IP \(bu
117Extract kernel and/or user-level sources from the distribution tape
118if space permits.
119This can serve as the backup documentation as needed.
120.IP \(bu
121Configure and boot a kernel for the local system.
122This can be delayed if the generic kernel from the distribution
123supports enough hardware to proceed.
124.IP \(bu
125Build a skeletal
126.Pn /var
127filesystem (see
128.Xr mtree (8)).
129.IP \(bu
130Merge site-dependent configuration files from
131.Pn /etc
132and
133.Pn /usr/lib
134into the new
135.Pn /etc
136directory.
137Note that many file formats and contents have changed; see section 3.4
138of this document.
139.IP \(bu
140Copy or merge files from
141.Pn /usr/adm ,
142.Pn /usr/spool ,
143.Pn /usr/preserve ,
144.Pn /usr/lib ,
145and other locations into
146.Pn /var .
147.IP \(bu
148Merge local macros, dictionaries, etc. into
149.Pn /usr/share .
150.IP \(bu
151Merge and update local software to reflect the system changes.
152.IP \(bu
153Take off the rest of the morning, you've earned it!
154.PP
155Section 3.2 lists the files to be saved as part of the conversion process.
156Section 3.3 describes the bootstrap process.
157Section 3.4 discusses the merger of the saved files back into the new system.
158Section 3.5 gives an overview of the major
159bug fixes and changes between \*(Ps and \*(4B.
160Section 3.6 provides general hints on possible problems to be
161aware of when converting from \*(Ps to \*(4B.
162.Sh 2 "Files to save"
163.PP
164The following list enumerates the standard set of files you will want to
165save and suggests directories in which site-specific files should be present.
166This list will likely be augmented with non-standard files you
167have added to your system.
168If you do not have enough space to create parallel
169filesystems, you should create a
170.Xr tar
171image of the following files before the new filesystems are created.
172The rest of this subsection describes where theses files
173have moved and how they have changed.
174.TS
175lfC c l.
176/.cshrc	\(dg	root csh startup script (moves to \f(CW/root/.cshrc\fP)
177/.login	\(dg	root csh login script (moves to \f(CW/root/.login\fP)
178/.profile	\(dg	root sh startup script (moves to \f(CW/root/.profile\fP)
179/.rhosts	\(dg	for trusted machines and users (moves to \f(CW/root/.rhosts\fP)
180/etc/disktab	\(dd	in case you changed disk partition sizes
181/etc/fstab	*	disk configuration data
182/etc/ftpusers	\(dg	for local additions
183/etc/gettytab	\(dd	getty database
184/etc/group	*	group data base
185/etc/hosts	\(dg	for local host information
186/etc/hosts.equiv	\(dg	for local host equivalence information
187/etc/hosts.lpd	\(dg	printer access file
188/etc/inetd.conf	*	Internet services configuration data
189/etc/named*	\(dg	named configuration files
190/etc/netstart	\(dg	network initialization
191/etc/networks	\(dg	for local network information
192/etc/passwd	*	user data base
193/etc/printcap	*	line printer database
194/etc/protocols	\(dd	in case you added any local protocols
195/etc/rc	*	for any local additions
196/etc/rc.local	*	site specific system startup commands
197/etc/remote	\(dg	auto-dialer configuration
198/etc/services	\(dd	for local additions
199/etc/shells	\(dd	list of valid shells
200/etc/syslog.conf	*	system logger configuration
201/etc/securettys	*	merged into ttys
202/etc/ttys	*	terminal line configuration data
203/etc/ttytype	*	merged into ttys
204/etc/termcap	\(dd	for any local entries that may have been added
205/lib	\(dd	for any locally developed language processors
206/usr/dict/*	\(dd	for local additions to words and papers
207/usr/include/*	\(dd	for local additions
208/usr/lib/aliases	*	mail forwarding data base (moves to \f(CW/etc/aliases\fP)
209/usr/lib/crontab	*	cron daemon data base (moves to \f(CW/etc/crontab\fP)
210/usr/lib/crontab.local	*	local cron daemon data base (moves to \f(CW/etc/crontab.local\fP)
211/usr/lib/lib*.a	\(dg	for local libraries
212/usr/lib/mail.rc	\(dg	system-wide mail(1) initialization (moves to \f(CW/etc/mail.rc\fP)
213/usr/lib/sendmail.cf	*	sendmail configuration (moves to \f(CW/etc/sendmail.cf\fP)
214/usr/lib/tmac/*	\(dd	for locally developed troff/nroff macros (moves to \f(CW/usr/share/tmac/*\fP)
215/usr/lib/uucp/*	\(dg	for local uucp configuration files
216/usr/man/manl	*	for manual pages for locally developed programs (moves to \f(CW/usr/local/man\fP)
217/usr/spool/*	\(dg	for current mail, news, uucp files, etc. (moves to \f(CW/var/spool\fP)
218/usr/src/local	\(dg	for source for locally developed programs
219/sys/conf/HOST	\(dg	configuration file for your machine (moves to \f(CW/sys/<arch>/conf\fP)
220/sys/conf/files.HOST	\(dg	list of special files in your kernel (moves to \f(CW/sys/<arch>/conf\fP)
221/*/quotas	*	filesystem quota files (moves to \f(CW/*/quotas.user\fP)
222.TE
223.DS
224\(dg\|Files that can be used from \*(Ps without change.
225\(dd\|Files that need local changes merged into \*(4B files.
226*\|Files that require special work to merge and are discussed in section 3.4.
227.DE
228.Sh 2 "Installing \*(4B"
229.PP
230The next step is to build a working \*(4B system.
231This can be done by following the steps in section 2 of
232this document for extracting the root and
233.Pn /usr
234filesystems from the distribution tape onto unused disk partitions.
235For the SPARC, the root filesystem dump on the tape could also be
236extracted directly.
237For the HP300 and DECstation, the raw disk image can be copied
238into an unused partition and this partition can then be dumped
239to create an image that can be restored.
240The exact procedure chosen will depend on the disk configuration
241and the number of suitable disk partitions that may be used.
242It is also desirable to run filesystem checks
243of all filesystems to be converted to \*(4B before shutting down.
244In any case, this is an excellent time to review your disk configuration
245for possible tuning of the layout.
246Section 2.5 and
247.Xr config (8)
248are required reading.
249.LP
250The filesystem in \*(4B has been reorganized in an effort to
251meet several goals:
252.IP 1)
253The root filesystem should be small.
254.IP 2)
255There should be a per-architecture centrally-shareable read-only
256.Pn /usr
257filesystem.
258.IP 3)
259Variable per-machine directories should be concentrated below
260a single mount point named
261.Pn /var .
262.IP 4)
263Site-wide machine independent shareable text files should be separated
264from architecture specific binary files and should be concentrated below
265a single mount point named
266.Pn /usr/share .
267.LP
268These goals are realized with the following general layouts.
269The reorganized root filesystem has the following directories:
270.TS
271lfC l.
272/etc	(config files)
273/bin	(user binaries needed when single-user)
274/sbin	(root binaries needed when single-user)
275/local	(locally added binaries used only by this machine)
276/tmp	(mount point for memory based file system)
277/dev	(local devices)
278/home	(mount point for AMD)
279/var	(mount point for per-machine variable directories)
280/usr	(mount point for multiuser binaries and files)
281.TE
282.LP
283The reorganized
284.Pn /usr
285filesystem has the following directories:
286.TS
287lfC l.
288/usr/bin	(user binaries)
289/usr/contrib	(software contributed to \*(4B)
290/usr/games	(binaries for games, score files in \f(CW/var\fP)
291/usr/include	(standard include files)
292/usr/lib	(lib*.a from old \f(CW/usr/lib\fP)
293/usr/libdata	(databases from old \f(CW/usr/lib\fP)
294/usr/libexec	(executables from old \f(CW/usr/lib\fP)
295/usr/local	(locally added binaries used site-wide)
296/usr/old	(deprecated binaries)
297/usr/sbin	(root binaries)
298/usr/share	(mount point for site-wide shared text)
299/usr/src	(mount point for sources)
300.TE
301.LP
302The reorganized
303.Pn /usr/share
304filesystem has the following directories:
305.TS
306lfC l.
307/usr/share/calendar	(various useful calendar files)
308/usr/share/dict	(dictionaries)
309/usr/share/doc	(\*(4B manual sources)
310/usr/share/games	(games text files)
311/usr/share/groff_font	(groff font information)
312/usr/share/man	(typeset manual pages)
313/usr/share/misc	(dumping ground for random text files)
314/usr/share/mk	(templates for \*(4B makefiles)
315/usr/share/skel	(template user home directory files)
316/usr/share/tmac	(various groff macro packages)
317/usr/share/zoneinfo	(information on time zones)
318.TE
319.LP
320The reorganized
321.Pn /var
322filesystem has the following directories:
323.TS
324lfC l.
325/var/account	(accounting files, formerly \f(CW/usr/adm\fP)
326/var/at	(\fIat\fP\|(1) spooling area)
327/var/backups	(backups of system files)
328/var/crash	(crash dumps)
329/var/db	(system-wide databases, e.g. tags)
330/var/games	(score files)
331/var/log	(log files)
332/var/mail	(users mail)
333/var/obj	(hierarchy to build \f(CW/usr/src\fP)
334/var/preserve	(preserve area for vi)
335/var/quotas	(directory to store quota files)
336/var/run	(directory to store *.pid files)
337/var/rwho	(rwho databases)
338/var/spool/ftp	(home directory for anonymous ftp)
339/var/spool/mqueue	(sendmail spooling directory)
340/var/spool/news	(news spooling area)
341/var/spool/output	(printer spooling area)
342/var/spool/uucp	(uucp spooling area)
343/var/tmp	(disk-based temporary directory)
344/var/users	(root of per-machine user home directories)
345.TE
346.PP
347The \*(4B bootstrap routines pass the identity of the boot device
348through to the kernel.
349The kernel then uses that device as its root filesystem.
350Thus, for example, if you boot from
351.Pn /dev/\*(Dk1a ,
352the kernel will use
353.Pn \*(Dk1a
354as its root filesystem. If
355.Pn /dev/\*(Dk1b
356is configured as a swap partition,
357it will be used as the initial swap area,
358otherwise the normal primary swap area (\c
359.Pn /dev/\*(Dk0b )
360will be used.
361The \*(4B bootstrap is backward compatible with \*(Ps,
362so you can replace your old bootstrap if you use it
363to boot your first \*(4B kernel.
364However, the \*(Ps bootstrap cannot access \*(4B filesystems,
365so if you plan to convert your filesystems to \*(4B,
366you must install a new bootstrap \fIbefore\fP doing the conversion.
367Note that SPARC users cannot build a \*(4B compatible version
368of the bootstrap, so must \fInot\fP convert their root filesystem
369to the new \*(4B format.
370.PP
371Once you have extracted the \*(4B system and booted from it,
372you will have to build a kernel customized for your configuration.
373If you have any local device drivers,
374they will have to be incorporated into the new kernel.
375See section 4.1.3 and ``Building 4.3BSD UNIX Systems with Config'' (SMM:2).
376.PP
377If converting from \*(Ps, your old filesystems should be converted.
378If you've modified the partition
379sizes from the original \*(Ps ones, and are not already using the
380\*(4B disk labels, you will have to modify the default disk partition
381tables in the kernel.  Make the necessary table changes and boot
382your custom kernel \fBBEFORE\fP trying to access any of your old
383filesystems!  After doing this, if necessary, the remaining filesystems
384may be converted in place by running the \*(4B version of
385.Xr fsck (8)
386on each filesystem and allowing it to make the necessary corrections.
387The new version of
388.Xr fsck
389is more strict about the size of directories than
390the version supplied with \*(Ps.
391Thus the first time that it is run on a \*(Ps filesystem,
392it will produce messages of the form:
393.DS
394\fBDIRECTORY ...: LENGTH\fP xx \fBNOT MULTIPLE OF 512 (ADJUSTED)\fP
395.DE
396Length ``xx'' will be the size of the directory;
397it will be expanded to the next multiple of 512 bytes.
398The new
399.Xr fsck
400will also set default \fIinterleave\fP and
401\fInpsect\fP (number of physical sectors per track) values on older
402filesystems, in which these fields were unused spares; this correction
403will produce messages of the form:
404.DS
405\fBIMPOSSIBLE INTERLEAVE=0 IN SUPERBLOCK (SET TO DEFAULT)\fP\**
406\fBIMPOSSIBLE NPSECT=0 IN SUPERBLOCK (SET TO DEFAULT)\fP
407.DE
408.FS
409The defaults are to set \fIinterleave\fP to 1 and
410\fInpsect\fP to \fInsect\fP.
411This is correct on most drives;
412it affects only performance (usually virtually unmeasurably).
413.FE
414Filesystems that have had their interleave and npsect values
415set will be diagnosed by the old
416.Xr fsck
417as having a bad superblock; the old
418.Xr fsck
419will run only if given an alternate superblock
420(\fIfsck \-b32\fP),
421in which case it will re-zero these fields.
422The \*(4B kernel will internally set these fields to their defaults
423if fsck has not done so; again, the \fI\-b32\fP option may be
424necessary for running the old
425.Xr fsck .
426.PP
427In addition, \*(4B removes several limits on filesystem sizes
428that were present in \*(Ps.
429The limited filesystems
430continue to work in \*(4B, but should be converted
431as soon as it is convenient
432by running
433.Xr fsck
434with the \fI\-c 2\fP option.
435The sequence \fIfsck \-p \-c 2\fP will update them all,
436fix the interleave and npsect fields,
437fix any incorrect directory lengths,
438expand maximum uid's and gid's to 32-bits,
439place symbolic links less than 60 bytes into their inode,
440and fill in directory type fields all at once.
441The new filesystem formats are incompatible with older systems.
442If you wish to continue using these filesystems with the older
443systems you should make only the compatible changes using
444\fIfsck \-c 1\fP.
445.Sh 2 "Merging your files from \*(Ps into \*(4B"
446.PP
447When your system is booting reliably and you have the \*(4B root and
448.Pn /usr
449filesystems fully installed you will be ready
450to continue with the next step in the conversion process,
451merging your old files into the new system.
452.PP
453If you saved the files on a
454.Xr tar
455tape, extract them into a scratch directory, say
456.Pn /usr/convert :
457.DS
458\fB#\fP \fImkdir /usr/convert\fP
459\fB#\fP \fIcd /usr/convert\fP
460\fB#\fP \fItar xp\fP
461.DE
462.PP
463The data files marked in the previous table with a dagger (\(dg)
464may be used without change from the previous system.
465Those data files marked with a double dagger (\(dd) have syntax
466changes or substantial enhancements.
467You should start with the \*(4B version and carefully
468integrate any local changes into the new file.
469Usually these local changes can be incorporated
470without conflict into the new file;
471some exceptions are noted below.
472The files marked with an asterisk (*) require
473particular attention and are discussed below.
474.PP
475As described in section 3.3,
476the most immediately obvious change in \*(4B is the reorganization
477of the system filesystems.
478Users of certain recent vendor releases have seen this general organization,
479although \*(4B takes the reorganization a bit further.
480The directories most affected are
481.Pn /etc ,
482that now contains only system configuration files;
483.Pn /var ,
484a new filesystem containing per-system spool and log files; and
485.Pn /usr/share,
486that contains most of the text files shareable across architectures
487such as documentation and macros.
488System administration programs formerly in
489.Pn /etc
490are now found in
491.Pn /sbin
492and
493.Pn /usr/sbin .
494Various programs and data files formerly in
495.Pn /usr/lib
496are now found in
497.Pn /usr/libexec
498and
499.Pn /usr/libdata ,
500respectively.
501Administrative files formerly in
502.Pn /usr/adm
503are in
504.Pn /var/account
505and, similarly, log files are now in
506.Pn /var/log .
507The directory
508.Pn /usr/ucb
509has been merged into
510.Pn /usr/bin ,
511and the sources for programs in
512.Pn /usr/bin
513are in
514.Pn /usr/src/usr.bin .
515Other source directories parallel the destination directories;
516.Pn /usr/src/etc
517has been greatly expanded, and
518.Pn /usr/src/share
519is new.
520The source for the manual pages, in general, are with the source
521code for the applications they document.
522Manual pages not closely corresponding to an application program
523are found in
524.Pn /usr/src/share/man .
525The locations of all man pages is listed in
526.Pn /usr/src/share/man/man0/man[1-8] .
527The manual page
528.Xr hier (7)
529has been updated and made more detailed;
530it is included in the printed documentation.
531You should review it to familiarize yourself with the new layout.
532.PP
533A new utility,
534.Xr mtree (8),
535is provided to build and check filesystem hierarchies
536with the proper contents, owners and permissions.
537Scripts are provided in
538.Pn /etc/mtree
539(and
540.Pn /usr/src/etc/mtree )
541for the root,
542.Pn /usr
543and
544.Pn /var
545filesystems.
546Once a filesystem has been made for
547.Pn /var ,
548.Xr mtree
549can be used to create a directory hierarchy there
550or you can simply use tar to extract the prototype from
551the second file of the distribution tape.
552.Sh 3 "Changes in the \f(CW/etc\fP directory"
553.PP
554The
555.Pn /etc
556directory now contains nearly all the host-specific configuration
557files.
558Note that some file formats have changed,
559and those configuration files containing pathnames are nearly all affected
560by the reorganization.
561See the examples provided in
562.Pn /etc
563(installed from
564.Pn /usr/src/etc )
565as a guide.
566The following table lists some of the local configuration files
567whose locations and/or contents have changed.
568.TS
569l l l
570lfC lfC l.
571\*(Ps and Earlier	\*(4B	Comments
572_	_	_
573/etc/fstab	/etc/fstab	new format; see below
574/etc/inetd.conf	/etc/inetd.conf	pathnames of executables changed
575/etc/printcap	/etc/printcap	pathnames changed
576/etc/syslog.conf	/etc/syslog.conf	pathnames of log files changed
577/etc/ttys	/etc/ttys	pathnames of executables changed
578/etc/passwd	/etc/master.passwd	new format; see below
579/usr/lib/sendmail.cf	/etc/sendmail.cf	changed pathnames
580/usr/lib/aliases	/etc/aliases	may contain changed pathnames
581/etc/*.pid	/var/run/*.pid
582
583.T&
584l l l
585lfC lfC l.
586New in \*(Ps-Tahoe	\*(4B	Comments
587_	_	_
588/usr/games/dm.config	/etc/dm.conf	configuration for games (see \fIdm\fP\|(8))
589/etc/zoneinfo/localtime	/etc/localtime	timezone configuration
590/etc/zoneinfo	/usr/share/zoneinfo	timezone configuration
591.TE
592.ne 1.5i
593.TS
594l l l
595lfC lfC l.
596	New in \*(4B	Comments
597_	_	_
598	/etc/aliases.db	database version of the aliases file
599	/etc/amd-home	location database of home directories
600	/etc/amd-vol	location database of exported filesystems
601	/etc/changelist	\f(CW/etc/security\fP files to back up
602	/etc/csh.cshrc	system-wide csh(1) initialization file
603	/etc/csh.login	system-wide csh(1) login file
604	/etc/csh.logout	system-wide csh(1) logout file
605	/etc/disklabels	directory for saving disklabels
606	/etc/exports	NFS list of export permissions
607	/etc/ftpwelcome	message displayed for ftp users; see ftpd(8)
608	/etc/kerberosIV	Kerberos directory; see below
609	/etc/man.conf	lists directories searched by \fIman\fP\|(1)
610	/etc/mtree	directory for local mtree files; see mtree(8)
611	/etc/netgroup	NFS group list used in \f(CW/etc/exports\fP
612	/etc/pwd.db	non-secure hashed user data base file
613	/etc/spwd.db	secure hashed user data base file
614	/etc/security	daily system security checker
615.TE
616.PP
617System security changes require adding several new ``well-known'' groups to
618.Pn /etc/group .
619The groups that are needed by the system as distributed are:
620.TS
621l n l.
622name	number	purpose
623_
624wheel	0	users allowed superuser privilege
625daemon	1	processes that need less than wheel privilege
626kmem	2	read access to kernel memory
627sys	3	access to kernel sources
628tty	4	access to terminals
629operator	5	read access to raw disks
630bin	7	group for system binaries
631news	8	group for news
632wsrc	9	write access to sources
633games	13	access to games
634staff	20	system staff
635guest	31	system guests
636nobody	39	the least privileged group
637utmp	45	access to utmp files
638dialer	117	access to remote ports and dialers
639.TE
640Only users in the ``wheel'' group are permitted to
641.Xr su
642to ``root''.
643Most programs that manage directories in
644.Pn /var/spool
645now run set-group-id to ``daemon'' so that users cannot
646directly access the files in the spool directories.
647The special files that access kernel memory,
648.Pn /dev/kmem
649and
650.Pn /dev/mem ,
651are made readable only by group ``kmem''.
652Standard system programs that require this access are
653made set-group-id to that group.
654The group ``sys'' is intended to control access to kernel sources,
655and other sources belong to group ``wsrc.''
656Rather than make user terminals writable by all users,
657they are now placed in group ``tty'' and made only group writable.
658Programs that should legitimately have access to write on user terminals
659such as
660.Xr talkd
661and
662.Xr write
663now run set-group-id to ``tty''.
664The ``operator'' group controls access to disks.
665By default, disks are readable by group ``operator'',
666so that programs such as
667.Xr dump
668can access the filesystem information without being set-user-id to ``root''.
669The
670.Xr shutdown (8)
671program is executable only by group operator
672and is setuid to root so that members of group operator may shut down
673the system without root access.
674.PP
675The ownership and modes of some directories have changed.
676The
677.Xr at
678programs now run set-user-id ``root'' instead of ``daemon.''
679Also, the uucp directory no longer needs to be publicly writable,
680as
681.Xr tip
682reverts to privileged status to remove its lock files.
683After copying your version of
684.Pn /var/spool ,
685you should do:
686.DS
687\fB#\fP \fIchown \-R root /var/spool/at\fP
688\fB#\fP \fIchown \-R uucp.daemon /var/spool/uucp\fP
689\fB#\fP \fIchmod \-R o\-w /var/spool/uucp\fP
690.DE
691.PP
692The format of the cron table,
693.Pn /etc/crontab ,
694has been changed to specify the user-id that should be used to run a process.
695The userid ``nobody'' is frequently useful for non-privileged programs.
696Local changes are now put in a separate file,
697.Pn /etc/crontab.local .
698.PP
699Some of the commands previously in
700.Pn /etc/rc.local
701have been moved to
702.Pn /etc/rc ;
703several new functions are now handled by
704.Pn /etc/rc ,
705.Pn /etc/netstart
706and
707.Pn /etc/rc.local .
708You should look closely at the prototype version of these files
709and read the manual pages for the commands contained in it
710before trying to merge your local copy.
711Note in particular that
712.Xr ifconfig
713has had many changes,
714and that host names are now fully specified as domain-style names
715(e.g., vangogh.CS.Berkeley.EDU) for the benefit of the name server.
716.PP
717Some of the commands previously in
718.Pn /etc/daily
719have been moved to
720.Pn /etc/security ,
721and several new functions have been added to
722.Pn /etc/security
723to do nightly security checks on the system.
724The script
725.Pn /etc/daily
726runs
727.Pn /etc/security
728each night, and mails the output to the super-user.
729Some of the checks done by
730.Pn /etc/security
731are:
732.DS
733\(bu Syntax errors in the password and group files.
734\(bu Duplicate user and group names and id's.
735\(bu Dangerous search paths and umask values for the superuser.
736\(bu Dangerous values in various initialization files.
737\(bu Dangerous .rhosts files.
738\(bu Dangerous directory and file ownership or permissions.
739\(bu Globally exported filesystems.
740\(bu Dangerous owners or permissions for special devices.
741.DE
742In addition, it reports any changes to setuid and setgid files, special
743devices, or the files in
744.Pn /etc/changelist
745since the last run of
746.Pn /etc/security .
747Backup copies of the files are saved in
748.Pn /var/backups .
749Finally, the system binaries are checksummed and their permissions
750validated against the
751.Xr mtree (8)
752specifications in
753.Pn /etc/mtree .
754.PP
755The C-library and system binaries on the distribution tape
756are compiled with new versions of
757.Xr gethostbyname
758and
759.Xr gethostbyaddr
760that use the name server,
761.Xr named (8).
762If you have only a small network and are not connected
763to a large network, you can use the distributed library routines without
764any problems; they use a linear scan of the host table
765.Pn /etc/hosts
766if the name server is not running.
767If you are on the Internet or have a large local network,
768it is recommend that you set up
769and use the name server.
770For instructions on how to set up the necessary configuration files,
771refer to ``Name Server Operations Guide for BIND'' (SMM:10).
772Several programs rely on the host name returned by
773.Xr gethostname
774to determine the local domain name.
775.PP
776If you are using the name server, your
777.Xr sendmail
778configuration file will need some updates to accommodate it.
779See the ``Sendmail Installation and Operation Guide'' (SMM:8) and
780the sample
781.Xr sendmail
782configuration files in
783.Pn /usr/src/usr.sbin/sendmail/cf .
784The aliases file,
785.Pn /etc/aliases
786has also been changed to add certain well-known addresses.
787.Sh 3 "Shadow password files"
788.PP
789The password file format adds change and expiration fields
790and its location has changed to protect
791the encrypted passwords stored there.
792The actual password file is now stored in
793.Pn /etc/master.passwd .
794The hashed dbm password files do not contain encrypted passwords,
795but contain the file offset to the entry with the password in
796.Pn /etc/master.passwd
797(that is readable only by root).
798Thus, the
799.Fn getpwnam
800and
801.Fn getpwuid
802functions will no longer return an encrypted password string to non-root
803callers.
804An old-style passwd file is created in
805.Pn /etc/passwd
806by the
807.Xr vipw (8)
808and
809.Xr pwd_mkdb (8)
810programs.
811See also
812.Xr passwd (5).
813.PP
814Several new users have also been added to the group of ``well-known'' users in
815.Pn /etc/passwd .
816The current list is:
817.DS
818.TS
819l c.
820name	number
821_
822root	0
823daemon	1
824operator	2
825bin	3
826games	7
827uucp	66
828nobody	32767
829.TE
830.DE
831The ``daemon'' user is used for daemon processes that
832do not need root privileges.
833The ``operator'' user-id is used as an account for dumpers
834so that they can log in without having the root password.
835By placing them in the ``operator'' group,
836they can get read access to the disks.
837The ``uucp'' login has existed long before \*(4B,
838and is noted here just to provide a common user-id.
839The password entry ``nobody'' has been added to specify
840the user with least privilege.  The ``games'' user is a pseudo-user
841that controls access to game programs.
842.PP
843After installing your updated password file, you must run
844.Xr pwd_mkdb (8)
845to create the password database.
846Note that
847.Xr pwd_mkdb (8)
848is run whenever
849.Xr vipw (8)
850is run.
851.Sh 3 "The \f(CW/var\fP filesystem"
852.PP
853The spooling directories saved on tape may be restored in their
854eventual resting places without too much concern.  Be sure to
855use the `\-p' option to
856.Xr tar (1)
857so that files are recreated with the same file modes.
858The following commands provide a guide for copying spool and log files from
859an existing system into a new
860.Pn /var
861filesystem.
862At least the following directories should already exist on
863.Pn /var :
864.Pn output ,
865.Pn log ,
866.Pn backups
867and
868.Pn db .
869.LP
870.DS
871.ft CW
872SRC=/oldroot/usr
873
874cd $SRC; tar cf - msgs preserve | (cd /var && tar xpf -)
875.DE
876.DS
877.ft CW
878# copy $SRC/spool to /var
879cd $SRC/spool
880tar cf - at mail rwho | (cd /var && tar xpf -)
881tar cf - ftp mqueue news secretmail uucp uucppublic | \e
882	(cd /var/spool && tar xpf -)
883.DE
884.DS
885.ft CW
886# everything else in spool is probably a printer area
887mkdir .save
888mv at ftp mail mqueue rwho secretmail uucp uucppublic .save
889tar cf - * | (cd /var/spool/output && tar xpf -)
890mv .save/* .
891rmdir .save
892.DE
893.DS
894.ft CW
895cd /var/spool/mqueue
896mv syslog.7 /var/log/maillog.7
897mv syslog.6 /var/log/maillog.6
898mv syslog.5 /var/log/maillog.5
899mv syslog.4 /var/log/maillog.4
900mv syslog.3 /var/log/maillog.3
901mv syslog.2 /var/log/maillog.2
902mv syslog.1 /var/log/maillog.1
903mv syslog.0 /var/log/maillog.0
904mv syslog /var/log/maillog
905.DE
906.DS
907.ft CW
908# move $SRC/adm to /var
909cd $SRC/adm
910tar cf - . | (cd /var/account && tar  xpf -)
911cd /var/account
912rm -f msgbuf
913mv messages messages.[0-9] ../log
914mv wtmp wtmp.[0-9] ../log
915mv lastlog ../log
916.DE
917.Sh 2 "Bug fixes and changes between \*(Ps and \*(4B"
918.PP
919The major new facilities available in the \*(4B release are
920a new virtual memory system,
921the addition of ISO/OSI networking support,
922a new virtual filesystem interface supporting filesystem stacking,
923a freely redistributable implementation of NFS,
924a log-structured filesystem,
925enhancement of the local filesystems to support
926files and filesystems that are up to 2^63 bytes in size,
927enhanced security and system management support,
928and the conversion to and addition of the IEEE Std1003.1 (``POSIX'')
929facilities and many of the IEEE Std1003.2 facilities.
930In addition, many new utilities and additions to the C
931library are present as well.
932The kernel sources have been reorganized to collect all machine-dependent
933files for each architecture under one directory,
934and most of the machine-independent code is now free of code
935conditional on specific machines.
936The user structure and process structure have been reorganized
937to eliminate the statically-mapped user structure and to make most
938of the process resources shareable by multiple processes.
939The system and include files have been converted to be compatible
940with ANSI C, including function prototypes for most of the exported
941functions.
942There are numerous other changes throughout the system.
943.Sh 3 "Changes to the kernel"
944.PP
945This release includes several important structural kernel changes.
946The kernel uses a new internal system call convention;
947the use of global (``u-dot'') variables for parameters and error returns
948has been eliminated,
949and interrupted system calls no longer abort using non-local goto's (longjmp's).
950A new sleep interface separates signal handling from scheduling priority,
951returning characteristic errors to abort or restart the current system call.
952This sleep call also passes a string describing the process state,
953that is used by the ps(1) program.
954The old sleep interface can be used only for non-interruptible sleeps.
955The sleep interface (\fItsleep\fP) can be used at any priority,
956but is only interruptible if the PCATCH flag is set.
957When interrupted, \fItsleep\fP returns EINTR or ERESTART.
958.PP
959Many data structures that were previously statically allocated
960are now allocated dynamically.
961These structures include mount entries, file entries,
962user open file descriptors, the process entries, the vnode table,
963the name cache, and the quota structures.
964.PP
965To protect against indiscriminate reading or writing of kernel
966memory, all writing and most reading of kernel data structures
967must be done using a new ``sysctl'' interface.
968The information to be accessed is described through an extensible
969``Management Information Base'' (MIB) style name,
970described as a dotted set of components.
971A new utility,
972.Xr sysctl (8),
973retrieves kernel state and allows processes with appropriate
974privilege to set kernel state.
975.Sh 3 "Security"
976.PP
977The kernel runs with four different levels of security.
978Any superuser process can raise the security level, but only
979.Fn init (8)
980can lower it.
981Security levels are defined as follows:
982.IP \-1
983Permanently insecure mode \- always run system in level 0 mode.
984.IP "  0"
985Insecure mode \- immutable and append-only flags may be turned off.
986All devices may be read or written subject to their permissions.
987.IP "  1"
988Secure mode \- immutable and append-only flags may not be cleared;
989disks for mounted filesystems,
990.Pn /dev/mem ,
991and
992.Pn /dev/kmem
993are read-only.
994.IP "  2"
995Highly secure mode \- same as secure mode, plus disks are always
996read-only whether mounted or not.
997This level precludes tampering with filesystems by unmounting them,
998but also inhibits running
999.Xr newfs (8)
1000while the system is multi-user.
1001See
1002.Xr chflags (1)
1003and the \-\fBo\fP option to
1004.Xr ls (1)
1005for information on setting and displaying the immutable and append-only
1006flags.
1007.PP
1008Normally, the system runs in level 0 mode while single user
1009and in level 1 mode while multiuser.
1010If the level 2 mode is desired while running multiuser,
1011it can be set in the startup script
1012.Pn /etc/rc
1013using
1014.Xr sysctl (1).
1015If it is desired to run the system in level 0 mode while multiuser,
1016the administrator must build a kernel with the variable
1017.Li securelevel
1018in the kernel source file
1019.Pn /sys/kern/kern_sysctl.c
1020initialized to \-1.
1021.Sh 4 "Virtual memory changes"
1022.PP
1023The new virtual memory implementation is derived from the Mach
1024operating system developed at Carnegie-Mellon,
1025and was ported to the BSD kernel at the University of Utah.
1026It is based on the 2.0 release of Mach
1027(with some bug fixes from the 2.5 and 3.0 releases)
1028and retains many of its essential features such as
1029the separation of the machine dependent and independent layers
1030(the ``pmap'' interface),
1031efficient memory utilization using copy-on-write
1032and other lazy-evaluation techniques,
1033and support for large, sparse address spaces.
1034It does not include the ``external pager'' interface instead using
1035a primitive internal pager interface.
1036The Mach virtual memory system call interface has been replaced with the
1037``mmap''-based interface described in the ``Berkeley Software
1038Architecture Manual'' (see UNIX Programmer's Manual,
1039Supplementary Documents, PSD:5).
1040The interface is similar to the interfaces shipped
1041by several commercial vendors such as Sun, USL, and Convex Computer Corp.
1042The integration of the new virtual memory is functionally complete,
1043but still has serious performance problems under heavy memory load.
1044The internal kernel interfaces have not yet been completed
1045and the memory pool and buffer cache have not been merged.
1046Some additional caveats:
1047.IP \(bu
1048Since the code is based on the 2.0 release of Mach,
1049bugs and misfeatures of the BSD version should not be considered
1050short-comings of the current Mach virtual memory system.
1051.IP \(bu
1052Because of the disjoint virtual memory (page) and IO (buffer) caches,
1053it is possible to see inconsistencies if using both the mmap and
1054read/write interfaces on the same file simultaneously.
1055.IP \(bu
1056Swap space is allocated on-demand rather than up front and no
1057allocation checks are performed so it is possible to over-commit
1058memory and eventually deadlock.
1059.IP \(bu
1060The semantics of the
1061.Xr vfork (2)
1062system call are slightly different.
1063The synchronization between parent and child is preserved,
1064but the memory sharing aspect is not.
1065In practice this has been enough for backward compatibility,
1066but newer code should just use
1067.Xr fork (2).
1068.Sh 4 "Networking additions and changes"
1069.PP
1070The ISO/OSI Networking consists of a kernel implementation of
1071transport class 4 (TP-4),
1072connectionless networking protocol (CLNP),
1073and 802.3-based link-level support (hardware-compatible with Ethernet\**).
1074.FS
1075Ethernet is a trademark of the Xerox Corporation.
1076.FE
1077We also include support for ISO Connection-Oriented Network Service,
1078X.25, TP-0.
1079The session and presentation layers are provided outside
1080the kernel using the ISO Development Environment by Marshall Rose,
1081that is available via anonymous FTP
1082(but is not included on the distribution tape).
1083Included in this development environment are file
1084transfer and management (FTAM), virtual terminals (VT),
1085a directory services implementation (X.500),
1086and miscellaneous other utilities.
1087.PP
1088Kernel support for the ISO OSI protocols is enabled with the ISO option
1089in the kernel configuration file.
1090The
1091.Xr iso (4)
1092manual page describes the protocols and addressing;
1093see also
1094.Xr clnp (4),
1095.Xr tp (4)
1096and
1097.Xr cltp (4).
1098The OSI equivalent to ARP is ESIS (End System to Intermediate System Routing
1099Protocol); running this protocol is mandatory, however one can manually add
1100translations for machines that do not participate by use of the
1101.Xr route (8)
1102command.
1103Additional information is provided in the manual page describing
1104.Xr esis (4).
1105.PP
1106The command
1107.Xr route (8)
1108has a new syntax and several new capabilities:
1109it can install routes with a specified destination and mask,
1110and can change route characteristics such as hop count, packet size
1111and window size.
1112.PP
1113Several important enhancements have been added to the TCP/IP
1114protocols including TCP header prediction and
1115serial line IP (SLIP) with header compression.
1116The routing implementation has been completely rewritten
1117to use a hierarchical routing tree with a mask per route
1118to support the arbitrary levels of routing found in the ISO protocols.
1119The routing table also stores and caches route characteristics
1120to speed the adaptation of the throughput and congestion avoidance
1121algorithms.
1122.PP
1123The format of the
1124.I sockaddr
1125structure (the structure used to describe a generic network address with an
1126address family and family-specific data)
1127has changed from previous releases,
1128as have the address family-specific versions of this structure.
1129The
1130.I sa_family
1131family field has been split into a length,
1132.Pn sa_len ,
1133and a family,
1134.Pn sa_family .
1135System calls that pass a
1136.I sockaddr
1137structure into the kernel (e.g.
1138.Fn sendto
1139and
1140.Fn connect )
1141have a separate parameter that specifies the
1142.I sockaddr
1143length, and thus it is not necessary to fill in the
1144.I sa_len
1145field for those system calls.
1146System calls that pass a
1147.I sockaddr
1148structure back from the kernel (e.g.
1149.Fn recvfrom
1150and
1151.Fn accept )
1152receive a completely filled-in
1153.I sockaddr
1154structure, thus the length field is valid.
1155Because this would not work for old binaries,
1156the new library uses a different system call number.
1157Thus, most networking programs compiled under \*(4B are incompatible
1158with older systems.
1159.PP
1160Although this change is mostly source and binary compatible
1161with old programs, there are three exceptions.
1162Programs with statically initialized
1163.I sockaddr
1164structures
1165(usually the Internet form, a
1166.I sockaddr_in )
1167are not compatible.
1168Generally, such programs should be changed to fill in the structure
1169at run time, as C allows no way to initialize a structure without
1170assuming the order and number of fields.
1171Also, programs with use structures to describe a network packet format
1172that contain embedded
1173.I sockaddr
1174structures also require change; a definition of an
1175.I osockaddr
1176structure is provided for this purpose.
1177Finally, programs that use the
1178.Sm SIOCGIFCONF
1179ioctl to get a complete list of interface addresses
1180need to check the
1181.I sa_len
1182field when iterating through the array of addresses returned,
1183as not all the structures returned have the same length
1184(this variance in length is nearly guaranteed by the presence of link-layer
1185address structures).
1186.Sh 4 "Additions and changes to filesystems"
1187.PP
1188The \*(4B distribution contains most of the interfaces
1189specified in the IEEE Std1003.1 system interface standard.
1190Filesystem additions include IEEE Std1003.1 FIFOs,
1191byte-range file locking, and saved user and group identifiers.
1192.PP
1193A new virtual filesystem interface has been added to the
1194kernel to support multiple filesystems.
1195In comparison with other interfaces,
1196the Berkeley interface has been structured for more efficient support
1197of filesystems that maintain state (such as the local filesystem).
1198The interface has been extended with support for stackable
1199filesystems done at UCLA.
1200These extensions allow for filesystems to be layered on top of each
1201other and allow new vnode operations to be added without requiring
1202changes to existing filesystem implementations.
1203For example,
1204the umap filesystem (see
1205.Xr mount_umap (8))
1206is used to mount a sub-tree of an existing filesystem
1207that uses a different set of uids and gids than the local system.
1208Such a filesystem could be mounted from a remote site via NFS or it
1209could be a filesystem on removable media brought from some foreign
1210location that uses a different password file.
1211.PP
1212Other new filesystems that may be stacked include the loopback filesystem
1213.Xr mount_lofs (8),
1214the kernel filesystem
1215.Xr mount_kernfs (8),
1216and the portal filesystem
1217.Xr mount_portal (8).
1218.PP
1219The buffer cache in the kernel is now organized as a file block cache
1220rather than a device block cache.
1221As a consequence, cached blocks from a file
1222and from the corresponding block device would no longer be kept consistent.
1223The block device thus has little remaining value.
1224Three changes have been made for these reasons:
1225.IP 1)
1226block devices may not be opened while they are mounted,
1227and may not be mounted while open, so that the two versions of cached
1228file blocks cannot be created,
1229.IP 2)
1230filesystem checks of the root now use the raw device
1231to access the root filesystem, and
1232.IP 3)
1233the root filesystem is initially mounted read-only
1234so that nothing can be written back to disk during or after change to
1235the raw filesystem by
1236.Xr fsck .
1237.LP
1238The root filesystem may be made writable while in single-user mode
1239with the command:
1240.DS
1241.ft CW
1242mount -u /
1243.DE
1244The mount command has an option to update the flags on a mounted filesystem,
1245including the ability to upgrade a filesystem from read-only to read-write
1246or downgrade it from read-write to read-only.
1247.PP
1248In addition to the local ``fast filesystem'',
1249we have added an implementation of the network filesystem (NFS)
1250that fully interoperates with the NFS shipped by Sun and its licensees.
1251Because our NFS implementation was implemented
1252by Rick Macklem of the University of Guelph
1253using only the publicly available NFS specification,
1254it does not require a license from Sun to use in source or binary form.
1255By default it runs over UDP to be compatible with Sun's implementation.
1256However, it can be configured on a per-mount basis to run over TCP.
1257Using TCP allows it to be used quickly and efficiently through
1258gateways and over long-haul networks.
1259Using an extended protocol, it supports Leases to allow a limited
1260callback mechanism that greatly reduces the network traffic necessary
1261to maintain cache consistency between the server and its clients.
1262Its use will be familiar to users of other implementations of NFS.
1263See the manual pages
1264.Xr mount (8),
1265.Xr mountd (8),
1266.Xr fstab (5),
1267.Xr exports (5),
1268.Xr netgroup (5),
1269.Xr nfsd (8),
1270.Xr nfsiod (8),
1271and
1272.Xr nfssvc (8).
1273and the document ``The 4.4BSD NFS Implementation'' (SMM:6)
1274for further information.
1275The format of
1276.Pn /etc/fstab
1277has changed from previous \*(Bs releases
1278to a blank-separated format to allow colons in pathnames.
1279.PP
1280A new local file system, the log-structured file system (LFS),
1281has been added to the system.
1282It provides near disk-speed output and fast crash recovery.
1283This work is based, in part, on the LFS file system created
1284for the Sprite operating system at Berkeley.
1285While the kernel implementation is almost complete,
1286only some of the utilities to support the
1287filesystem have been written,
1288so we do not recommend it for production use.
1289See
1290.Xr newlfs (8),
1291.Xr mount_lfs (8)
1292and
1293.Xr lfs_cleanerd (8)
1294for more information.
1295For a in-depth description of the implementation and performance
1296characteristics of log-structured file systems in general,
1297and this one in particular, see Dr. Margo Seltzer's doctoral thesis,
1298available from the University of California Computer Science Department.
1299.PP
1300We have also added a memory-based filesystem that runs in
1301pageable memory, allowing large temporary filesystems without
1302requiring dedicated physical memory.
1303.PP
1304The local ``fast filesystem'' has been enhanced to do
1305clustering that allows large pieces of files to be
1306allocated contiguously resulting in near doubling
1307of filesystem throughput.
1308The filesystem interface has been extended to allow
1309files and filesystems to grow to 2^63 bytes in size.
1310The quota system has been rewritten to support both
1311user and group quotas (simultaneously if desired).
1312Quota expiration is based on time rather than
1313the previous metric of number of logins over quota.
1314This change makes quotas more useful on fileservers
1315onto which users seldom login.
1316.PP
1317The system security has been greatly enhanced by the
1318addition of additional file flags that permit a file to be
1319marked as immutable or append only.
1320Once set, these flags can only be cleared by the super-user
1321when the system is running in insecure mode (normally, single-user).
1322In addition to the immutable and append-only flags,
1323the filesystem supports a new user-settable flag ``nodump''.
1324(File flags are set using the
1325.Xr chflags (1)
1326utility.)
1327When set on a file,
1328.Xr dump (8)
1329will omit the file from incremental backups
1330but retain them on full backups.
1331See the ``-h'' flag to
1332.Xr dump (8)
1333for details on how to change this default.
1334The ``nodump'' flag is usually set on core dumps,
1335system crash dumps, and object files generated by the compiler.
1336Note that the flag is not preserved when files are copied
1337so that installing an object file will cause it to be preserved.
1338.PP
1339The filesystem format used in \*(4B has several additions.
1340Directory entries have an additional field,
1341.Pn d_type ,
1342that identifies the type of the entry
1343(normally found in the
1344.Pn st_mode
1345field of the
1346.Pn stat
1347structure).
1348This field is particularly useful for identifying
1349directories without the need to use
1350.Xr stat (2).
1351.PP
1352Short (less than sixty byte) symbolic links are now stored
1353in the inode itself rather than in a separate data block.
1354This saves disk space and makes access of symbolic links faster.
1355Short symbolic links are not given a special type,
1356so a user-level application is unaware of their special treatment.
1357Unlike pre-\*(4B systems, symbolic links do
1358not have an owner, group, access mode, times, etc.
1359Instead, these attributes are taken from the directory that contains the link.
1360The only attributes returned from an
1361.Xr lstat (2)
1362that refer to the symbolic link itself are the file type (S_IFLNK),
1363size, blocks, and link count (always 1).
1364.PP
1365An implementation of an auto-mounter daemon,
1366.Xr amd ,
1367was contributed by Jan-Simon Pendry of the
1368Imperial College of Science, Technology & Medicine.
1369See the document ``AMD \- The 4.4BSD Automounter'' (SMM:13)
1370for further information.
1371.PP
1372The directory
1373.Pn /dev/fd
1374contains special files
1375.Pn 0
1376through
1377.Pn 63
1378that, when opened, duplicate the corresponding file descriptor.
1379The names
1380.Pn /dev/stdin ,
1381.Pn /dev/stdout
1382and
1383.Pn /dev/stderr
1384refer to file descriptors 0, 1 and 2.
1385See
1386.Xr fd (4)
1387and
1388.Xr mount_fdesc (8)
1389for more information.
1390.Sh 4 "POSIX terminal driver changes"
1391.PP
1392The \*(4B system uses the IEEE P1003.1 (POSIX.1) terminal interface
1393rather than the previous \*(Bs terminal interface.
1394The terminal driver is similar to the System V terminal driver
1395with the addition of the necessary extensions to get the
1396functionality previously available in the \*(Ps terminal driver.
1397Both the old
1398.Xr ioctl
1399calls and old options to
1400.Xr stty (1)
1401are emulated.
1402This emulation is expected to be unavailable in many vendors releases,
1403so conversion to the new interface is encouraged.
1404.PP
1405\*(4B also adds the IEEE Std1003.1 job control interface,
1406that is similar to the \*(Ps job control interface,
1407but adds a security model that was missing in the
1408\*(Ps job control implementation.
1409A new system call,
1410.Fn setsid ,
1411creates a job-control session consisting of a single process
1412group with one member, the caller, that becomes a session leader.
1413Only a session leader may acquire a controlling terminal.
1414This is done explicitly via a
1415.Sm TIOCSCTTY
1416.Fn ioctl
1417call, not implicitly by an
1418.Fn open
1419call.
1420The call fails if the terminal is in use.
1421Programs that allocate controlling terminals (or pseudo-terminals)
1422require change to work in this environment.
1423The versions of
1424.Xr xterm
1425provided in the X11R5 release includes the necessary changes.
1426New library routines are available for allocating and initializing
1427pseudo-terminals and other terminals as controlling terminal; see
1428.Pn /usr/src/lib/libutil/pty.c
1429and
1430.Pn /usr/src/lib/libutil/login_tty.c .
1431.PP
1432The POSIX job control model formalizes the previous conventions
1433used in setting up a process group.
1434Unfortunately, this requires that changes be made in a defined order
1435and with some synchronization that were not necessary in the past.
1436Older job control shells (csh, ksh) will generally not operate correctly
1437with the new system.
1438.PP
1439Most of the other kernel interfaces have been changed to correspond
1440with the POSIX.1 interface, although that work is not complete.
1441See the relevant manual pages and the IEEE POSIX standard.
1442.Sh 4 "Native operating system compatibility"
1443.PP
1444Both the HP300 and SPARC ports feature the ability to run binaries
1445built for the native operating system (HP-UX or SunOS) by emulating
1446their system calls.
1447Building an HP300 kernel with the HPUXCOMPAT and COMPAT_OHPUX options
1448or a SPARC kernel with the COMPAT_SUNOS option will enable this feature
1449(on by default in the generic kernel provided in the root filesystem image).
1450Though this native operating system compatibility was provided by the
1451developers as needed for their purposes and is by no means complete,
1452it is complete enough to run several non-trivial applications including
1453those that require HP-UX or SunOS shared libraries.
1454For example, the vendor supplied X11 server and windowing environment
1455can be used on both the HP300 and SPARC.
1456.PP
1457It is important to remember that merely copying over a native binary
1458and executing it (or executing it directly across NFS) does not imply
1459that it will run.
1460All but the most trivial of applications are likely to require access
1461to auxiliary files that don't exist under \*(4B (e.g.
1462.Pn /etc/ld.so.cache )
1463or have a slightly different format (e.g.
1464.Pn /etc/passwd ).
1465However, by using system call tracing and
1466through creative use of symlinks,
1467many problems can be tracked down and corrected.
1468.PP
1469The DECstation port also has code for ULTRIX emulation
1470(kernel option ULTRIXCOMPAT, not compiled into the generic kernel)
1471but it was used primarily for initially bootstrapping the port and
1472has not been used since.
1473Hence, some work may be required to make it generally useful.
1474.Sh 3 "Changes to the utilities"
1475.PP
1476We have been tracking the IEEE Std1003.2 shell and utility work
1477and have included prototypes of many of the proposed utilities
1478based on draft 12 of the POSIX.2 Shell and Utilities document.
1479Because most of the traditional utilities have been replaced
1480with implementations conformant to the POSIX standards,
1481you should realize that the utility software may not be as stable,
1482reliable or well documented as in traditional Berkeley releases.
1483In particular, almost the entire manual suite has been rewritten to
1484reflect the POSIX defined interfaces, and in some instances
1485it does not correctly reflect the current state of the software.
1486It is also worth noting that, in rewriting this software, we have generally
1487been rewarded with significant performance improvements.
1488Most of the libraries and header files have been converted
1489to be compliant with ANSI C.
1490The shipped compiler (gcc) is a superset of ANSI C,
1491but supports traditional C as a command-line option.
1492The system libraries and utilities all compile
1493with either ANSI or traditional C.
1494.Sh 4 "Make and Makefiles"
1495.PP
1496This release uses a completely new version of the
1497.Xr make
1498program derived from the
1499.Xr pmake
1500program developed by the Sprite project at Berkeley.
1501It supports existing makefiles, although certain incorrect makefiles
1502may fail.
1503The makefiles for the \*(4B sources make extensive use of the new
1504facilities, especially conditionals and file inclusion, and are thus
1505completely incompatible with older versions of
1506.Xr make
1507(but nearly all the makefiles are now trivial!).
1508The standard include files for
1509.Xr make
1510are in
1511.Pn /usr/share/mk .
1512There is a
1513.Pn bsd.README
1514file in
1515.Pn /usr/src/share/mk .
1516.PP
1517Another global change supported by the new
1518.Xr make
1519is designed to allow multiple architectures to share a copy of the sources.
1520If a subdirectory named
1521.Pn obj
1522is present in the current directory,
1523.Xr make
1524descends into that directory and creates all object and other files there.
1525We use this by building a directory hierarchy in
1526.Pn /var/obj
1527that parallels
1528.Pn /usr/src .
1529We then create the
1530.Pn obj
1531subdirectories in
1532.Pn /usr/src
1533as symbolic links to the corresponding directories in
1534.Pn /var/obj .
1535(This step is automated.
1536The command ``make obj'' in
1537.Pn /usr/src
1538builds both the local symlink and the shadow directory,
1539using
1540.Pn /usr/obj ,
1541that may be a symbolic link, as the root of the shadow tree.
1542The use of
1543.Pn /usr/obj
1544is for historic reasons only, and the system make configuration files in
1545.Pn /usr/share/mk
1546can trivially be modified to use
1547.Pn /var/obj
1548instead.)
1549We have one
1550.Pn /var/obj
1551hierarchy on the local system, and another on each
1552system that shares the source filesystem.
1553All the sources in
1554.Pn /usr/src
1555except for
1556.Pn /usr/src/contrib
1557and portions of
1558.Pn /usr/src/old
1559have been converted to use the new make and
1560.Pn obj
1561subdirectories;
1562this change allows compilation for multiple
1563architectures from the same source tree
1564(that may be mounted read-only).
1565.Sh 4 "Kerberos"
1566.PP
1567The Kerberos authentication server from MIT (version 4)
1568is included in this release.
1569See
1570.Xr kerberos (1)
1571for a general, if MIT-specific, introduction.
1572If it is configured,
1573.Xr login (1),
1574.Xr passwd (1),
1575.Xr rlogin (1)
1576and
1577.Xr rsh (1)
1578will all begin to use it automatically.
1579The file
1580.Pn /etc/kerberosIV/README
1581describes the configuration.
1582Each system needs the file
1583.Pn /etc/kerberosIV/krb.conf
1584to set its realm and local servers,
1585and a private key stored in
1586.Pn /etc/kerberosIV/srvtab
1587(see
1588.Xr ext_srvtab (8)).
1589The Kerberos server should be set up on a single, physically secure,
1590server machine.
1591Users and hosts may be added to the server database manually with
1592.Xr kdb_edit (8),
1593or users on authorized hosts can add themselves and a Kerberos
1594password after verification of their ``local'' (passwd-file) password
1595using the
1596.Xr register (1)
1597program.
1598.PP
1599Note that by default the password-changing program
1600.Xr passwd (1)
1601changes the Kerberos password, that must exist.
1602The
1603.Li \-l
1604option to
1605.Xr passwd (1)
1606changes the ``local'' password if one exists.
1607.PP
1608Note that Version 5 of Kerberos will be released soon;
1609Version 4 should probably be replaced at that time.
1610.Sh 4 "Timezone support"
1611.PP
1612The timezone conversion code in the C library uses data files installed in
1613.Pn /usr/share/zoneinfo
1614to convert from ``GMT'' to various timezones.  The data file for the default
1615timezone for the system should be copied to
1616.Pn /etc/localtime .
1617Other timezones can be selected by setting the TZ environment variable.
1618.PP
1619The data files initially installed in
1620.Pn /usr/share/zoneinfo
1621include corrections for leap seconds since the beginning of 1970.
1622Thus, they assume that the
1623kernel will increment the time at a constant rate during a leap second;
1624that is, time just keeps on ticking.  The conversion routines will then
1625name a leap second 23:59:60.  For purists, this effectively means that
1626the kernel maintains TAI (International Atomic Time) rather than UTC
1627(Coordinated Universal Time, aka GMT).
1628.PP
1629For systems that run current NTP (Network Time Protocol) implementations
1630or that wish to conform to the letter of the POSIX.1 law, it is possible
1631to rebuild the timezone data files so that leap seconds are not counted.
1632(NTP causes the time to jump over a leap second, and POSIX effectively
1633requires the clock to be reset by hand when a leap second occurs.
1634In this mode, the kernel effectively runs UTC rather than TAI.)
1635.PP
1636The data files without leap second information
1637are constructed from the source directory,
1638.Pn /usr/src/share/zoneinfo .
1639Change the variable REDO in Makefile
1640from ``right'' to ``posix'', and then do
1641.DS
1642make obj	(if necessary)
1643make
1644make install
1645.DE
1646.PP
1647You will then need to copy the correct default zone file to
1648.Pn /etc/localtime ,
1649as the old one would still have used leap seconds, and because the Makefile
1650installs a default
1651.Pn /etc/localtime
1652each time ``make install'' is done.
1653.PP
1654It is possible to install both sets of timezone data files.  This results
1655in subdirectories
1656.Pn /usr/share/zoneinfo/right
1657and
1658.Pn /usr/share/zoneinfo/posix .
1659Each contain a complete set of zone files.
1660See
1661.Pn /usr/src/share/zoneinfo/Makefile
1662for details.
1663.Sh 4 "Additions and changes to the libraries"
1664.PP
1665Notable additions to the libraries include functions to traverse a
1666filesystem hierarchy, database interfaces to btree and hashing functions,
1667a new, faster implementation of stdio and a radix and merge sort
1668functions.
1669.PP
1670The
1671.Xr fts (3)
1672functions will do either physical or logical traversal of
1673a file hierarchy as well as handle essentially infinite depth
1674file systems and file systems with cycles.
1675All the utilities in \*(4B which traverse file hierarchies
1676have been converted to use
1677.Xr fts (3).
1678The conversion has always resulted in a significant performance
1679gain, often of four or five to one in system time.
1680.PP
1681The
1682.Xr dbopen (3)
1683functions are intended to be a family of database access methods.
1684Currently, they consist of
1685.Xr hash (3),
1686an extensible, dynamic hashing scheme,
1687.Xr btree (3),
1688a sorted, balanced tree structure (B+tree's), and
1689.Xr recno (3),
1690a flat-file interface for fixed or variable length records
1691referenced by logical record number.
1692Each of the access methods stores associated key/data pairs and
1693uses the same record oriented interface for access.
1694.PP
1695The
1696.Xr qsort (3)
1697function has been rewritten for additional performance.
1698In addition, three new types of sorting functions,
1699.Xr heapsort (3),
1700.Xr mergesort (3)
1701and
1702.Xr radixsort (3)
1703have been added to the system.
1704The
1705.Xr mergesort
1706function is optimized for data with pre-existing order,
1707in which case it usually significantly outperforms
1708.Xr qsort .
1709The
1710.Xr radixsort (3)
1711functions are variants of most-significant-byte radix sorting.
1712They take time linear to the number of bytes to be
1713sorted, usually significantly outperforming
1714.Xr qsort
1715on data that can be sorted in this fashion.
1716An implementation of the POSIX 1003.2 standard
1717.Xr sort (1),
1718based on
1719.Xr radixsort ,
1720is included in
1721.Pn /usr/src/contrib/sort .
1722.PP
1723Some additional comments about the \*(4B C library:
1724.IP \(bu
1725The floating point support in the C library has been replaced
1726and is now accurate.
1727.IP \(bu
1728The C functions specified by both ANSI C, POSIX 1003.1 and
17291003.2 are now part of the C library.
1730This includes support for file name matching, shell globbing
1731and both basic and extended regular expressions.
1732.IP \(bu
1733ANSI C multibyte and wide character support has been integrated.
1734The rune functionality from the Bell Labs' Plan 9 system is provided
1735as well.
1736.IP \(bu
1737The
1738.Xr termcap (3)
1739functions have been generalized and replaced with a general
1740purpose interface named
1741.Xr getcap (3).
1742.IP \(bu
1743The
1744.Xr stdio (3)
1745routines have been replaced, and are usually much faster.
1746In addition, the
1747.Xr funopen (3)
1748interface permits applications to provide their own I/O stream
1749function support.
1750.PP
1751The
1752.Xr curses (3)
1753library has been largely rewritten.
1754Important additional features include support for scrolling and
1755.Xr termios (3).
1756.PP
1757An application front-end editing library, named libedit, has been
1758added to the system.
1759.PP
1760A superset implementation of the SunOS kernel memory interface library,
1761libkvm, has been integrated into the system.
1762.PP
1763.Sh 4 "Additions and changes to other utilities"
1764.PP
1765There are many new utilities, offering many new capabilities,
1766in \*(4B.
1767Skimming through the section 1 and section 8 manual pages is sure
1768to be useful.
1769The additions to the utility suite include greatly enhanced versions of
1770programs that display system status information, implementations of
1771various traditional tools described in the IEEE Std1003.2 standard,
1772new tools not previous available on Berkeley UNIX systems,
1773and many others.
1774Also, with only a very few exceptions, all the utilities from
1775\*(Ps that included proprietary source code have been replaced,
1776and their \*(4B counterparts are freely redistributable.
1777Normally, this replacement resulted in significant performance
1778improvements and the increase of the limits imposed on data by
1779the utility as well.
1780.PP
1781Examples of specific additions and changes are as follows:
1782.TS
1783lfC l.
1784amd	An auto-mounter implementation.
1785ar	Replacement of the historic archive format with a new one.
1786awk	Replaced by gawk; see /usr/src/old/awk for the historic version.
1787bdes	Utility implementing DES modes of operation described in FIPS PUB 81.
1788calendar	Addition of an interface for system calendars.
1789cap_mkdb	Utility for building hashed versions of termcap style databases.
1790cc	Replacement of pcc with gcc suite.
1791chflags	A utility for setting the per-file user and system flags.
1792chfn	An editor based replacement for changing user information.
1793chpass	An editor based replacement for changing user information.
1794chsh	An editor based replacement for changing user information.
1795cksum	The POSIX 1003.2 checksum utility; compatible with sum.
1796column	A columnar text formatting utility.
1797cp	POSIX 1003.2 compatible, able to copy special files.
1798csh	Freely redistributable and 8-bit clean.
1799date	User specified formats added.
1800dd	New EBCDIC conversion tables, major performance improvments.
1801dev_mkdb	Hashed interface to devices.
1802dm	Dungeon master.
1803find	Several new options and primaries, major performance improvments.
1804fstat	Utility displaying information on files open on the system.
1805ftpd	Connection logging added.
1806hexdump	A binary dump utility, superseding od.
1807id	The POSIX 1003.2 user identification utility.
1808inetd	Tcpmux added.
1809jot	A text formatting utility.
1810kdump	A system-call tracing facility.
1811ktrace	A system-call tracing facility.
1812kvm_mkdb	Hashed interface to the kernel name list.
1813lam	A text formatting utility.
1814lex	A new, freely redistributable, significantly faster version.
1815locate	A database of the system files, by name, constructed weekly.
1816logname	The POSIX 1003.2 user identification utility.
1817mail.local	New local mail delivery agent, replacing mail.
1818make	Replaced with a new, more powerful make, supporting include files.
1819man	Added support for man page location configuration.
1820mkdep	A new utility for generating make dependency lists.
1821mkfifo	The POSIX 1003.2 FIFO creation utility.
1822mtree	A new utility for mapping file hierarchies to a file.
1823nfsstat	An NFS statistics utility.
1824nvi	A freely redistributable replacement for the ex/vi editors.
1825pax	The POSIX 1003.2 replacement for cpio and tar.
1826printf	The POSIX 1003.2 replacement for echo.
1827roff	Replaced by groff; see /usr/src/old/roff for the historic versions.
1828rs	New utility for text formatting.
1829shar	An archive building utility.
1830sysctl	MIB-style interface to kernel state.
1831tcopy	Fast tape-to-tape copying and verification.
1832touch	Time and file reference specifications.
1833tput	The POSIX 1003.2 terminal display utility.
1834tr	Addition of character classes.
1835uname	The POSIX 1003.2 system identification utility.
1836vis	A filter for converting and displaying non-printable characters.
1837xargs	The POSIX 1003.2 argument list constructor utility.
1838yacc	A new, freely redistributable, significantly faster version.
1839.TE
1840.PP
1841The new versions of
1842.Xr lex (1)
1843(``flex'') and
1844.Xr yacc (1)
1845(``zoo'') should be installed early on if attempting to
1846cross-compile \*(4B on another system.
1847Note that the new
1848.Xr lex
1849program is not completely backward compatible with historic versions of
1850.Xr lex ,
1851although it is believed that all documented features are supported.
1852.PP
1853The
1854.Xr find
1855utility has two new options that are important to be aware of if you
1856intend to use NFS.
1857The ``fstype'' and ``prune'' options can be used together to prevent
1858find from crossing NFS mount points.
1859See
1860.Pn /etc/daily
1861for an example of their use.
1862.Sh 2 "Hints on converting from \*(Ps to \*(4B"
1863.PP
1864This section summarizes changes between
1865\*(Ps and \*(4B that are likely to
1866cause difficulty in doing the conversion.
1867It does not include changes in the network;
1868see section 5 for information on setting up the network.
1869.PP
1870Since the stat st_size field is now 64-bits instead of 32,
1871doing something like:
1872.DS
1873.ft CW
1874foo(st.st_size);
1875.DE
1876and then (improperly) defining foo with an ``int'' or ``long'' parameter:
1877.DS
1878.ft CW
1879foo(size)
1880	int size;
1881{
1882	...
1883}
1884.DE
1885will fail miserably (well, it might work on a little endian machine).
1886This problem showed up in
1887.Xr emacs (1)
1888as well as several other programs.
1889A related problem is improperly casting (or failing to cast)
1890the second argument to
1891.Xr lseek (2),
1892.Xr truncate (2),
1893or
1894.Xr ftruncate (2)
1895ala:
1896.DS
1897.ft CW
1898lseek(fd, (long)off, 0);
1899.DE
1900or
1901.DS
1902.ft CW
1903lseek(fd, 0, 0);
1904.DE
1905The best solution is to include
1906.Pn <unistd.h>
1907which has prototypes that catch these types of errors.
1908.PP
1909Determining the ``namelen'' parameter for a
1910.Xr connect (2)
1911call on a unix domain socket should use the ``SUN_LEN'' macro from
1912.Pn <sys/un.h> .
1913One old way that was used:
1914.DS
1915.ft CW
1916addrlen = strlen(unaddr.sun_path) + sizeof(unaddr.sun_family);
1917.DE
1918no longer works as there is an additional
1919.Pn sun_len
1920field.
1921.PP
1922The kernel's limit on the number of open files has been
1923increased from 20 to 64.
1924It is now possible to change this limit almost arbitrarily.
1925The standard I/O library
1926autoconfigures to the kernel limit.
1927Note that file (``_iob'') entries may be allocated by
1928.Xr malloc
1929from
1930.Xr fopen ;
1931this allocation has been known to cause problems with programs
1932that use their own memory allocators.
1933Memory allocation does not occur until after 20 files have been opened
1934by the standard I/O library.
1935.PP
1936.Xr Select
1937can be used with more than 32 descriptors
1938by using arrays of \fBint\fPs for the bit fields rather than single \fBint\fPs.
1939Programs that used
1940.Xr getdtablesize
1941as their first argument to
1942.Xr select
1943will no longer work correctly.
1944Usually the program can be modified to correctly specify the number
1945of bits in an \fBint\fP.
1946Alternatively the program can be modified to use an array of \fBint\fPs.
1947There are a set of macros available in
1948.Pn <sys/types.h>
1949to simplify this.
1950See
1951.Xr select (2).
1952.PP
1953Old core files will not be intelligible by the current debuggers
1954because of numerous changes to the user structure
1955and because the kernel stack has been enlarged.
1956The
1957.Xr a.out
1958header that was in the user structure is no longer present.
1959Locally-written debuggers that try to check the magic number
1960will need to be changed.
1961.PP
1962Files may not be deleted from directories having the ``sticky'' (ISVTX) bit
1963set in their modes
1964except by the owner of the file or of the directory, or by the superuser.
1965This is primarily to protect users' files in publicly-writable directories
1966such as
1967.Pn /tmp
1968and
1969.Pn /var/tmp .
1970All publicly-writable directories should have their ``sticky'' bits set
1971with ``chmod +t.''
1972.PP
1973The following two sections contain additional notes about
1974changes in \*(4B that affect the installation of local files;
1975be sure to read them as well.
1976