In the previous chapter, we looked at how to get an up-to-date FreeBSD source tree. Once you have the sources, you can build various components of the system. The main tool we use for this purpose is make, which we looked at on page 168. The best way to think of upgrading the system is that everything is a matter of
You can make upgrading less onerous by planning in advance. Here are some suggestions:
The only files that are upgraded are on the traditional root file system and /usr. No others are affected by an upgrade. Table 32-1 , an abridged version of Table 10-2 on page 188, gives an overview of where the
| Directory name | Usage | Populated by |
|---|---|---|
| /bin | make world | |
| /boot | Files used when booting the system. | make install in /usr/src/sys. |
| /dev | Directory of device nodes. | System startup (devfs) |
| /etc | Install from CD-ROM only, merge master, administrator | |
| /sbin | System executables needed at system startup time. | make world |
| /usr/XllR6 | X-based programs in the | The X11 windowing system. Ports Collection |
| /usr/bin | Standard | make world |
| /usr/compat | A directory containing code for emulated systems, such as Linux. | Ports Collection |
| /usr/games | Games. | make world |
| /usr/include | Header files for programmers. | make world |
| /usr/lib | Library files. | make world |
| /usr/libexec | Executable files that are not started directly by the user. | make world |
| /usr/libdata | Miscellaneous files used by system utilities. | make world |
| /usr/local | Additional programs that are not part of the operating system. | Ports collection |
| /usr/obj | Temporary | make world |
| /usr/ports | The Ports Collection | sysinstall, cvs |
| /usr/sbin | System administration programs that are not needed at system startup. | make world |
| /usr/share | Miscellaneous read-only files, mainly informative. | make world |
| /usr/src | System | sysinstall, cvs |
The core part of a system upgrade consists of a synchronized update of both kernel and userland. It's relatively simple to do, but depending on the speed of the machine, it may keep the computer busy for several hours. In general, you build and install the userland first, then you build and install the kernel.
The traditional way to build the userland is:
# cd /usr/src # make world
This operation performs a number of functions, which can be influenced by variables you pass to make. Without any variables, make world performs the following steps:
NOCLEAN variable. Don't set NOCLEAN unless you know exactly why you are doing so, since it can cause NOCLEAN.C compiler and the libraries.buildworld target instead of world.It does this by building a number of subtargets.
make buildworld make kernel (reboot) make installworld
You'll find information about such requirements in the file /usr/src/UPDATING. Table 32-2 gives an overview of the more useful targets to the top-level Makefile.
| Target | Purpose |
|---|---|
| buildworld | Rebuild everything, including |
| installworld | Install everything built by buildworld. |
| world | Perform buildworld and installworld. |
| update | Update your source tree. |
| most | Build user commands, no libraries or include files. |
| installmost | Install user commands, but not libraries or include files. |
If you have a build server, you can NFS mount the source and object directories and do a make on the client to install new binaries from the most recent build on the server. | |
| buildkernel | Build a kernel for your architecture. By default, use the GENERIC kernel MYKERNEL, with:
# make buildkernel KERNCONF=MYKERNEL By default, this target builds all the KLDs (Kernel |
| installkernel | Install a kernel you have built with buildkernel. |
| reinstallkernel | Install a kernel you have built with buildkernel. Don’t rename the previous kernel directory to kernel.old. Use this target when the previous kernel is not worth keeping. |
| kernel | Build and install a kernel. |
Another issue is that the system configuration might have changed. For example, in early 2002 the smmsp. To install the userland, this user already needed to be present.
The solution to this issue is called mergemaster, a script that helps you to upgrade the -p (pre-build) option:
# mergemaster -p
As we've seen in table 32-1 , the installworld target changes a number of directories. Sometimes, though, it leaves old binaries behind: it doesn't remove anything that it doesn't replace. The result can be that you end up using old programs that have long passed their use-by date. One solution to this problem is to look at the last modification date of each program in the directories.
For example, if you see:
$ ls -lrt /usr/sbin -r-xr-xr-x 1 root wheel 397 Jul 14 11:36 svr4 -r-xr-xr-x 1 root wheel 422 Jul 14 11:29 linux -r-xr-xr-x 1 root wheel 142080 Jul 13 17:20 sshd … -r-xr-xr-x 1 root wheel 68148 Jul 13 17:16 uuchk -r-xr-xr-x 1 root wheel 6840 Jan 5 2002 ispppcontrol -r-xr-xr-x 1 root wheel 27996 Apr 21 2001 k5stash -r-xr-xr-x 1 root wheel 45356 Apr 21 2001 ktutil -r-xr-xr-x 1 root wheel 11124 Apr 21 2001 kdb_util -r-xr-xr-x 1 root wheel 6768 Apr 21 2001 kdb init
It's fairly clear that the files dated April 2001 have not just been installed, so they must be out of date. You can use a number of techniques to delete them; one might be:
# find . -mtime +10 | xargs rm
This command removes all files in the .) that are older than 10 days (+10). Of course, this method will only work if you haven't installed anything in these directories yourself. You shouldn't have done so; that's the purpose of the directory hierarchy /usr/local, to ensure that you keep
Be careful with /usr/lib: a number of ports refer to libraries in this directory hierarchy, and if you delete them, the ports will no longer work. In general there's no problem with old libraries in /usr/lib, unless they take up too much space, so you're safer if you don't clean out this directory hierarchy.
Note that you need to specify the KERNCONF parameter to all the targets relating to kernel builds.
There are two reasons for building a new kernel: it might be part of the upgrade process, which is what we'll look at here, or you may build a kernel from your
One point to notice is that if you're upgrading from an older custom
# cp /usr/src/sys/i386/conf/GENERIC.hints /boot/device.hints
See page 609 for more details.
When upgrading the kernel, you might get error messages like this one:
# config GENERIC config: GENERIC:71: devices with zero units are not likely to be correct
Alternatively, you might get a clearer message:
# config GENERIC ../../conf/files: coda/coda_fbsd.c must be optional, mandatory or standard Your version of config(8) is out of sync with your kernel source.
Apart from that, you might find that the kernel fails to link with lots of undefined references. This, too, could mean that the config program is out of synchronization with the kernel modules. In each case, build and install the new version of config:
# cd /usr/src/usr.sbin/config # make depend all install clean
You need to make clean at the end since this method will store the
At the time of writing, it's still necessary to install the files in /boot separately. It's possible that this requirement will go away in the future. There are two steps: first you build and install the boot files in the /boot directory, then you install them on your
# cd /usr/src/sys build directory # make install build and install the bootstraps # bsdlabel -B da0 Either,for a dedicated disk # bsdlabel -B da0s1 Or,for a PC disk slice # boot0cfg -B da0 Or,booteasy for a dedicated PC disk
If you have a dedicated disk, which is normal on a non-Intel platform, use the first bsdlabel invocation to install the bootstrap (boot1) at the beginning of the disk. Otherwise, install boot1 at the beginning of your FreeBSD slice and use boot0cfg to install the boot0
Currently, the system build procedure does not install the
# cd /usr/src/etc/ # make install
The simple method is: run mergemaster with the options -i and -a, which tell it to run automatically (in other words, not to stop and ask questions), and to install new files automatically. That doesn't mean intelligently: you may run into problems anyway.
mergemaster produces a lot of output, and some of it in the middle is important, so you should save the output to disk with the tee command. The first time you try, you might see:
# mergemaster -ia 2>1 | tee -a /var/tmp/merge
*** Creating the temporary root environment in /var/tmp/temproot
*** /var/tmp/temproot ready for use
*** Creating and populating directory structure in /var/tmp/temproot
set - `grep "^[a-zA-Z]" /usr/src/etc/locale.deprecated`; while [ $# -gt 0 ] ;
do for dir in /usr/share/locale /usr/share/nls /usr/local/share/nls;
do test -d /va r/tmp/temproot/${dir} cd /var/tmp/tenproot/${dir};
test -L "$2" rm -rf "$2";
test -L "$1" test -d "$1" mv "$1" "$2"; done; shift; shift;
done mtree -deU -f /usr/src/etc/mtree/BSD.root.dist -p /var/tmp/temproot/
./bin missing (created)
./boot missing (created)
...
./vm missing (created)
mtree -deU -f /usr/src/etc/mtree/BSD.sendmail.dist -p /var/tmp/temproot/
mtree: line 10: unknown user smmsp
*** Error code 1
Stop in /usr/src/etc.
*** FATAL ERROR: Cannot 'cd' to /usr/src/etc and install files
to the temproot environment
These messages are somewhat misleading. First, the files that are created are all in /var/tmp/temproot. In addition, the message Cannot 'cd' to /usr/src/etc does not refer to any problem with that directory; it's just an indication that it can't continue with the installation due to the previous errors.
The real issue here is that the user smmsp doesn't exist. As we saw above, this user was added some time in 2002 to address some mail mergemaster with the -p option, but then mergemaster prompts you for every single file that it finds to be different, usually about 300 of them. In addition, the editing facilities are relatively basic. It's better to edit the file in advance with an editor.
As we saw on page 145, the password file is quite complicated. Depending on how much work you want to do, you have a couple of possibilities:
The distribution version of /etc/master.passwd looks something like this:
#$FreeBSD: src/etc/master.passwd,v 1.33 2002/06/23 20:46:44 des Exp $ # root::0:0::0:0:Charlie :/root:/bin/csh toor:*:0:0::0:0:Bourne-again Superuser:/root: ...etc
The individual fields are separated by colons (:). We'll look at only the fields that interest us in the following expansion. It's easier to look at if they're separated by spaces; numerically, they're the first, second, eighth, ninth and tenth fields. For a description of the other fields, see the man page master.passwd(4).
User password GECOS home directory shell root * Charlie /root /bin/csh toor * Bourne-again Superuser /root daemon * Owner of many processes /root /sbin/nologin operator * System / /sbin/nologin bin * Binaries Commands / /sbin/nologin tty * Tty Sandbox / /sbin/nologin kmem * KMem Sandbox / /sbin/nologin games * Games pseudo-user /usr/games /sbin/nologin news * News Subsystem / /sbin/nologin man * Mister Man Pages /usr/share/man /sbin/nologin sshd * Secure Shell Daemon /var/empty /sbin/nologin smmsp * Sendmail Submission /var/spool/clientmqueue /sbin/nologin mailnull * Sendmail Default User /var/spool/mqueue /sbin/nologin bind * Bind Sandbox / /sbin/nologin xten * X-10 daemon /usr/local/xten /sbin/nologin pop * Post Office Owner /nonexistent /sbin/nologin www * World Wide Web Owner /nonexistent /sbin/nologin nobody * Unprivileged user /nonexistent /sbin/nologin
The first field is the name of the user. In the course of time, a number of pseudo-users have been added to reduce
The second field contains the password. In the distribution file, it's usually *, which means it needs to be set before you can log in at all. Only root has no password; you need to be able to log in as root to set passwords. By contrast, in your installed /etc/master.passwd, you will almost certainly have a password, and in general you will want to keep it.
The home
For many accounts, the shell field contains the name /sbin/nologin, which prints the text "This account is currently not available" and exits. Currently only root has a real shell, but that could change.
To update the /etc/master.passwd, you can use the following method:
root. You can probably remove the distribution entry and leave your entry in the file, preserving the password and shell. In this case, you should make an exception to the separation between distribution and local additions: due to the way the name lookups work, if you put user root below user toor ("root" spelt backwards, and the same user with possibly a different shell), all files will appear to belong to toor instead of to root.Once you have merged the files, you need to run pwdmkdb to rebuild the password files /etc/passwd, /etc/pwd.db and /etc/spwd.db. /etc/passwd is gradually going out of use, but you probably have one on your system, and some ports use it, so it's preferable to recreate it. Do this with the -p option to pwd_mkdb:
# pwd_mkdb -p /etc/master.passwd
In addition to /etc/master.passwd, you will probably need to upgrade /etc/group. In this case, the main issue is to add users to the wheel group. The distribution /etc/group looks like this:
#$FreeBSD: src/etc/group,v 1.27 2002/10/14 20:55:49 rwatson Exp $ # wheel:*:0:root daemon:*:1: kmem:*:2: sys:*:3: tty:*:4: operator:*:5:root mail:*:6: bin:*:7: news:*:8: man:*:9: games:*:13: staff:*:20: sshd:*:22: smmsp:*:25: mailnull:*:26: guest:*:31: bind:*:53: uucp:*:66: xten:*:67: dialer:*:68: network:*:69: www:*:80: nogroup:*:65533: nobody:*:65534:
Again, new groups have appeared for security reasons. Use a similar method to the one you used for /etc/master.passwd:
You don't need to do anything special after updating /etc/group. You can now continue with mergemaster.
Before running mergemaster again, you should delete the contents of /var/tmp/temproot. Otherwise you might see something like:
*** The directory specified for the temporary root environment,
/var/tmp/temproot, exists. This can be a security risk if untrusted
users have access to the system.
mergemaster does not delete the old directories: you should do so yourself. If this file already exists, mergemaster ignores it and creates a new directory with a name like /var/tmp/temproot.0917.02.18.06. The numbers are a representation of the date and time of creation.
mergemaster doesn't make it easy to remove the /var/tmp/temproot directory. You may see:
# rm -rf /var/tmp/temproot rm: /var/tmp/temproot/var/empty: Operation not permitted rm: /var/tmp/temproot/var: Directory not empty rm: /var/tmp/temproot: Directory not empty
The problem here is that the directory /var/empty has been set . Change that with the chflags command and try again:
# find /var/tmp/temproot|xargs chflags noschg # rm -rf /var/tmp/temproot
Run mergemaster in the same way as before, saving the output. If you haven't deleted the old /var/tmp/temproot directory, you might see:
mergemaster -ia 2>1 | tee -a /var/tmp/merge
*** Creating the temporary root environment in /var/tmp/temproot.1102.15.01.14
*** /var/tmp/temproot.1102.15.01.14 ready for use
*** Creating and populating directory structure in /var/tmp/temproot.1102.15.01.14
set - `grep "^[a-zA-Z]" /usr/src/etc/locale.deprecated`; while [ $# -gt 0 ] ;
do for dir in /usr/share/locale /usr/share/nls /usr/local/share/nls;
do test -d /var/tmp/temproot.1102.15.01.14/${dir} cd /var/tmp/temproot.1102.15.01.14/${dir};
test -L "$2" rm -rf "$2";
test -L test -d mv "$2";
done; shift; shift; done
mtree -deU -f /usr/src/etc/mtree/BSD.root.dist -p /var/tmp/temproot.1102.15.01.14/
./bin missing (created)
./boot missing (created)
./boot/defaults missing (created)
./boot/kernel missing (created)
./boot/modules missing (created)
./
...
install -o root -g wheel -m 644 /dev/null /var/tinp/temproot.1102.15.01.14/var/run/utmp
install -o root -g wheel -m 644 /usr/src/etc/minfree /var/tmp/temproot.1102.15.01.14/var/crash
cd /usr/src/etc/..;
install -o root -g wheel -m 444 COPYRIGHT /var/tmp/temproot.110 2.15.01.14/
cd /usr/src/etc/../share/man; make makedb
makewhatis /var/tmp/temproot.1102.15.01.14/usr/share/man
*** Beginning comparison
*** Temp ./etc/defaults/rc.conf and installed have the same CVS Id, deleting
*** Temp ./etc/defaults/pccard.conf and installed have the same CVS Id, deleting
*** ./etc/defaults/periodic.conf will remain for your consideration
*** Temp ./etc/gnats/freefall and installed have the same CVS Id, deleting
*** Temp ./etc/isdn/answer and installed have the same CVS Id, deleting
*** Temp ./etc/isdn/isdntel.sh and installed have the same CVS Id, deleting
...
*** Comparison complete
*** Files that remain for you to merge by hand:
/var/tmp/temproot.1102.15.01.14/etc/defaults/periodic.conf
/var/tmp/temproot.1102.15.01.14/etc/mail/freebsd.mc
/var/tmp/temproot.1102.15.01.14/etc/mail/freebsd.cf
/var/tmp/temproot.1102.15.01.14/etc/mail/sendmail.cf
/var/tmp/temproot.1102.15.01.14/etc/mail/freebsd.submit.cf
/var/tmp/temproot.1102.15.01.14/etc/mail/mailer.conf
/var/tmp/temproot.1102.15.01.14/etc/mtree/BSD.include.dist
/var/tmp/temproot.1102.15.01.14/etc/mtree/BSD.local.dist
/var/tmp/temproot.1102.15.01.14/etc/mtree/BSD.usr.dist
/var/tmp/temproot.1102.15.01.14/etc/mtree/BSD.var.dist
/var/tmp/temproot.1102.15.01.14/etc/pam.d/su
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/100.chksetuid
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/200.chkmounts
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/500.ipfwdenied
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/600.ip6fwdenied
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/700.kernelmsg
/var/tmp/temproot.1102.15.01.14/etc/rc.d/local
/var/tmp/temproot.1102.15.01.14/etc/crontab
/var/tmp/temproot.1102.15.01.14/etc/inetd.conf
/var/tmp/temproot.1102.15.01.14/etc/motd
/var/tmp/temproot.1102.15.01.14/etc/syslog.conf
*** You chose the automatic install option for files that did not
exist on your system. The following were installed for you:
/etc/periodic/security/510.ipfdenied
/etc/periodic/security/security.functions
/etc/mac.conf
You're not done yet: there are 21 files above that need looking at. There's a good chance that you've never heard of some of them, let alone changed them. If you know for a fact that you have never changed them, for example if you have religiously kept track of your changes with RCS, you don't need to bother: mergemaster errs on the side of safety. You may have changed others, though. The most obvious one above is /etc/crontab, which contains system-wide commands to be executed by cron.To compare them, use diff:
$ diff -wu /etc/crontab /var/tmp/temproot.1102.15.01.14/etc/crontab --- /var/tmp/crontab Sat Nov 2 16:27:02 2002 +++ /var/tmp/temproot.1102.15.01.14/etc/crontab Sat Nov 2 15:01:16 2002 @@ -1,6 +1,6 @@ # /etc/crontab - root’s crontab for FreeBSD # -# $FreeBSD: src/etc/crontab,v 1.21 1999/12/15 17:58:29 obrien Exp $ +# $FreeBSD: src/etc/crontab,v 1.31 2001/02/19 02:47:41 peter Exp $ # SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin @@ -10,19 +10,18 @@ # */5 * * * * root /usr/libexec/atrun # +# save some entropy so that /dev/random can reseed on boot +*/11 * * * * operator /usr/libexec/save-entropy +# # rotate log files every hour, if necessary 0 * * * * root newsyslog # # do daily/weekly/monthly maintenance -59 1 * * * root periodic daily -30 3 * * 6 root periodic weekly +1 3 * * * root periodic daily +15 4 * * 6 root periodic weekly 30 5 1 * * root periodic monthly # # time zone change adjustment for wall cmos clock, -# does nothing if you have UTC cmos clock. +# does nothing, if you have UTC cmos clock. # See adjkerntz(8) for details. -#1,31 0-5 * * * root adjkerntz -a +1,31 0-5 * * * root adjkerntz -a -0,30 * * * * build /home/build/build_farm/build_test 2> /home/build/cron.err -0 21 * * * root /usr/local/bin/cleanup -0 7 * * * grog /home/grog/bin/update-FreeBSD-cvs -1 * * * * root (cd /usr/local/etc/postfix; make) 2 >/dev/null >/dev/null
The lines starting with - show lines only in the old file, which is still in /etc/crontab. The lines starting with + show lines only in the new file, which is in /var/tmp/temp-root.1102.15.01.14/etc/crontab. There are a number of changes here: the 1.21 to 1.31, and the times of the periodic maintenance have changed. In the meantime, though, you have added other tasks (the bottom four lines), and you have also commented out the periodic invocation of adjkerntz.These are the changes you need to make to the new /etc/crontab before you install it.
There's a simpler possibility here, though: the only real change that would then be left in /etc/crontab is the change in the starting times for the daily and weekly housekeeping. Does that matter? If you want, you don't need to change anything: the old/etc/crontab is fine the way it is.
There's a whole list of files that you're likely to change from the defaults. Here are some more likely candidates:
In the previous chapter, we looked at how to get an up-to-date FreeBSD source tree. Once you have the sources, you can build various components of the system. The main tool we use for this purpose is make, which we looked at on page 168. The best way to think of upgrading the system is that everything is a matter of
You can make upgrading less onerous by planning in advance. Here are some suggestions:
The only files that are upgraded are on the traditional root file system and /usr. No others are affected by an upgrade. Table 32-1 , an abridged version of Table 10-2 on page 188, gives an overview of where the
| Directory name | Usage | Populated by |
|---|---|---|
| /bin | make world | |
| /boot | Files used when booting the system. | make install in /usr/src/sys. |
| /dev | Directory of device nodes. | System startup (devfs) |
| /etc | Install from CD-ROM only, merge master, administrator | |
| /sbin | System executables needed at system startup time. | make world |
| /usr/XllR6 | X-based programs in the | The X11 windowing system. Ports Collection |
| /usr/bin | Standard | make world |
| /usr/compat | A directory containing code for emulated systems, such as Linux. | Ports Collection |
| /usr/games | Games. | make world |
| /usr/include | Header files for programmers. | make world |
| /usr/lib | Library files. | make world |
| /usr/libexec | Executable files that are not started directly by the user. | make world |
| /usr/libdata | Miscellaneous files used by system utilities. | make world |
| /usr/local | Additional programs that are not part of the operating system. | Ports collection |
| /usr/obj | Temporary | make world |
| /usr/ports | The Ports Collection | sysinstall, cvs |
| /usr/sbin | System administration programs that are not needed at system startup. | make world |
| /usr/share | Miscellaneous read-only files, mainly informative. | make world |
| /usr/src | System | sysinstall, cvs |
The core part of a system upgrade consists of a synchronized update of both kernel and userland. It's relatively simple to do, but depending on the speed of the machine, it may keep the computer busy for several hours. In general, you build and install the userland first, then you build and install the kernel.
The traditional way to build the userland is:
# cd /usr/src # make world
This operation performs a number of functions, which can be influenced by variables you pass to make. Without any variables, make world performs the following steps:
NOCLEAN variable. Don't set NOCLEAN unless you know exactly why you are doing so, since it can cause NOCLEAN.C compiler and the libraries.buildworld target instead of world.It does this by building a number of subtargets.
make buildworld make kernel (reboot) make installworld
You'll find information about such requirements in the file /usr/src/UPDATING. Table 32-2 gives an overview of the more useful targets to the top-level Makefile.
| Target | Purpose |
|---|---|
| buildworld | Rebuild everything, including |
| installworld | Install everything built by buildworld. |
| world | Perform buildworld and installworld. |
| update | Update your source tree. |
| most | Build user commands, no libraries or include files. |
| installmost | Install user commands, but not libraries or include files. |
If you have a build server, you can NFS mount the source and object directories and do a make on the client to install new binaries from the most recent build on the server. | |
| buildkernel | Build a kernel for your architecture. By default, use the GENERIC kernel MYKERNEL, with:
# make buildkernel KERNCONF=MYKERNEL By default, this target builds all the KLDs (Kernel |
| installkernel | Install a kernel you have built with buildkernel. |
| reinstallkernel | Install a kernel you have built with buildkernel. Don’t rename the previous kernel directory to kernel.old. Use this target when the previous kernel is not worth keeping. |
| kernel | Build and install a kernel. |
Another issue is that the system configuration might have changed. For example, in early 2002 the smmsp. To install the userland, this user already needed to be present.
The solution to this issue is called mergemaster, a script that helps you to upgrade the -p (pre-build) option:
# mergemaster -p
As we've seen in table 32-1 , the installworld target changes a number of directories. Sometimes, though, it leaves old binaries behind: it doesn't remove anything that it doesn't replace. The result can be that you end up using old programs that have long passed their use-by date. One solution to this problem is to look at the last modification date of each program in the directories.
For example, if you see:
$ ls -lrt /usr/sbin -r-xr-xr-x 1 root wheel 397 Jul 14 11:36 svr4 -r-xr-xr-x 1 root wheel 422 Jul 14 11:29 linux -r-xr-xr-x 1 root wheel 142080 Jul 13 17:20 sshd … -r-xr-xr-x 1 root wheel 68148 Jul 13 17:16 uuchk -r-xr-xr-x 1 root wheel 6840 Jan 5 2002 ispppcontrol -r-xr-xr-x 1 root wheel 27996 Apr 21 2001 k5stash -r-xr-xr-x 1 root wheel 45356 Apr 21 2001 ktutil -r-xr-xr-x 1 root wheel 11124 Apr 21 2001 kdb_util -r-xr-xr-x 1 root wheel 6768 Apr 21 2001 kdb init
It's fairly clear that the files dated April 2001 have not just been installed, so they must be out of date. You can use a number of techniques to delete them; one might be:
# find . -mtime +10 | xargs rm
This command removes all files in the .) that are older than 10 days (+10). Of course, this method will only work if you haven't installed anything in these directories yourself. You shouldn't have done so; that's the purpose of the directory hierarchy /usr/local, to ensure that you keep
Be careful with /usr/lib: a number of ports refer to libraries in this directory hierarchy, and if you delete them, the ports will no longer work. In general there's no problem with old libraries in /usr/lib, unless they take up too much space, so you're safer if you don't clean out this directory hierarchy.
Note that you need to specify the KERNCONF parameter to all the targets relating to kernel builds.
There are two reasons for building a new kernel: it might be part of the upgrade process, which is what we'll look at here, or you may build a kernel from your
One point to notice is that if you're upgrading from an older custom
# cp /usr/src/sys/i386/conf/GENERIC.hints /boot/device.hints
See page 609 for more details.
When upgrading the kernel, you might get error messages like this one:
# config GENERIC config: GENERIC:71: devices with zero units are not likely to be correct
Alternatively, you might get a clearer message:
# config GENERIC ../../conf/files: coda/coda_fbsd.c must be optional, mandatory or standard Your version of config(8) is out of sync with your kernel source.
Apart from that, you might find that the kernel fails to link with lots of undefined references. This, too, could mean that the config program is out of synchronization with the kernel modules. In each case, build and install the new version of config:
# cd /usr/src/usr.sbin/config # make depend all install clean
You need to make clean at the end since this method will store the
At the time of writing, it's still necessary to install the files in /boot separately. It's possible that this requirement will go away in the future. There are two steps: first you build and install the boot files in the /boot directory, then you install them on your
# cd /usr/src/sys build directory # make install build and install the bootstraps # bsdlabel -B da0 Either,for a dedicated disk # bsdlabel -B da0s1 Or,for a PC disk slice # boot0cfg -B da0 Or,booteasy for a dedicated PC disk
If you have a dedicated disk, which is normal on a non-Intel platform, use the first bsdlabel invocation to install the bootstrap (boot1) at the beginning of the disk. Otherwise, install boot1 at the beginning of your FreeBSD slice and use boot0cfg to install the boot0
Currently, the system build procedure does not install the
# cd /usr/src/etc/ # make install
The simple method is: run mergemaster with the options -i and -a, which tell it to run automatically (in other words, not to stop and ask questions), and to install new files automatically. That doesn't mean intelligently: you may run into problems anyway.
mergemaster produces a lot of output, and some of it in the middle is important, so you should save the output to disk with the tee command. The first time you try, you might see:
# mergemaster -ia 2>1 | tee -a /var/tmp/merge
*** Creating the temporary root environment in /var/tmp/temproot
*** /var/tmp/temproot ready for use
*** Creating and populating directory structure in /var/tmp/temproot
set - `grep "^[a-zA-Z]" /usr/src/etc/locale.deprecated`; while [ $# -gt 0 ] ;
do for dir in /usr/share/locale /usr/share/nls /usr/local/share/nls;
do test -d /va r/tmp/temproot/${dir} cd /var/tmp/tenproot/${dir};
test -L "$2" rm -rf "$2";
test -L "$1" test -d "$1" mv "$1" "$2"; done; shift; shift;
done mtree -deU -f /usr/src/etc/mtree/BSD.root.dist -p /var/tmp/temproot/
./bin missing (created)
./boot missing (created)
...
./vm missing (created)
mtree -deU -f /usr/src/etc/mtree/BSD.sendmail.dist -p /var/tmp/temproot/
mtree: line 10: unknown user smmsp
*** Error code 1
Stop in /usr/src/etc.
*** FATAL ERROR: Cannot 'cd' to /usr/src/etc and install files
to the temproot environment
These messages are somewhat misleading. First, the files that are created are all in /var/tmp/temproot. In addition, the message Cannot 'cd' to /usr/src/etc does not refer to any problem with that directory; it's just an indication that it can't continue with the installation due to the previous errors.
The real issue here is that the user smmsp doesn't exist. As we saw above, this user was added some time in 2002 to address some mail mergemaster with the -p option, but then mergemaster prompts you for every single file that it finds to be different, usually about 300 of them. In addition, the editing facilities are relatively basic. It's better to edit the file in advance with an editor.
As we saw on page 145, the password file is quite complicated. Depending on how much work you want to do, you have a couple of possibilities:
The distribution version of /etc/master.passwd looks something like this:
#$FreeBSD: src/etc/master.passwd,v 1.33 2002/06/23 20:46:44 des Exp $ # root::0:0::0:0:Charlie :/root:/bin/csh toor:*:0:0::0:0:Bourne-again Superuser:/root: ...etc
The individual fields are separated by colons (:). We'll look at only the fields that interest us in the following expansion. It's easier to look at if they're separated by spaces; numerically, they're the first, second, eighth, ninth and tenth fields. For a description of the other fields, see the man page master.passwd(4).
User password GECOS home directory shell root * Charlie /root /bin/csh toor * Bourne-again Superuser /root daemon * Owner of many processes /root /sbin/nologin operator * System / /sbin/nologin bin * Binaries Commands / /sbin/nologin tty * Tty Sandbox / /sbin/nologin kmem * KMem Sandbox / /sbin/nologin games * Games pseudo-user /usr/games /sbin/nologin news * News Subsystem / /sbin/nologin man * Mister Man Pages /usr/share/man /sbin/nologin sshd * Secure Shell Daemon /var/empty /sbin/nologin smmsp * Sendmail Submission /var/spool/clientmqueue /sbin/nologin mailnull * Sendmail Default User /var/spool/mqueue /sbin/nologin bind * Bind Sandbox / /sbin/nologin xten * X-10 daemon /usr/local/xten /sbin/nologin pop * Post Office Owner /nonexistent /sbin/nologin www * World Wide Web Owner /nonexistent /sbin/nologin nobody * Unprivileged user /nonexistent /sbin/nologin
The first field is the name of the user. In the course of time, a number of pseudo-users have been added to reduce
The second field contains the password. In the distribution file, it's usually *, which means it needs to be set before you can log in at all. Only root has no password; you need to be able to log in as root to set passwords. By contrast, in your installed /etc/master.passwd, you will almost certainly have a password, and in general you will want to keep it.
The home
For many accounts, the shell field contains the name /sbin/nologin, which prints the text "This account is currently not available" and exits. Currently only root has a real shell, but that could change.
To update the /etc/master.passwd, you can use the following method:
root. You can probably remove the distribution entry and leave your entry in the file, preserving the password and shell. In this case, you should make an exception to the separation between distribution and local additions: due to the way the name lookups work, if you put user root below user toor ("root" spelt backwards, and the same user with possibly a different shell), all files will appear to belong to toor instead of to root.Once you have merged the files, you need to run pwdmkdb to rebuild the password files /etc/passwd, /etc/pwd.db and /etc/spwd.db. /etc/passwd is gradually going out of use, but you probably have one on your system, and some ports use it, so it's preferable to recreate it. Do this with the -p option to pwd_mkdb:
# pwd_mkdb -p /etc/master.passwd
In addition to /etc/master.passwd, you will probably need to upgrade /etc/group. In this case, the main issue is to add users to the wheel group. The distribution /etc/group looks like this:
#$FreeBSD: src/etc/group,v 1.27 2002/10/14 20:55:49 rwatson Exp $ # wheel:*:0:root daemon:*:1: kmem:*:2: sys:*:3: tty:*:4: operator:*:5:root mail:*:6: bin:*:7: news:*:8: man:*:9: games:*:13: staff:*:20: sshd:*:22: smmsp:*:25: mailnull:*:26: guest:*:31: bind:*:53: uucp:*:66: xten:*:67: dialer:*:68: network:*:69: www:*:80: nogroup:*:65533: nobody:*:65534:
Again, new groups have appeared for security reasons. Use a similar method to the one you used for /etc/master.passwd:
You don't need to do anything special after updating /etc/group. You can now continue with mergemaster.
Before running mergemaster again, you should delete the contents of /var/tmp/temproot. Otherwise you might see something like:
*** The directory specified for the temporary root environment,
/var/tmp/temproot, exists. This can be a security risk if untrusted
users have access to the system.
mergemaster does not delete the old directories: you should do so yourself. If this file already exists, mergemaster ignores it and creates a new directory with a name like /var/tmp/temproot.0917.02.18.06. The numbers are a representation of the date and time of creation.
mergemaster doesn't make it easy to remove the /var/tmp/temproot directory. You may see:
# rm -rf /var/tmp/temproot rm: /var/tmp/temproot/var/empty: Operation not permitted rm: /var/tmp/temproot/var: Directory not empty rm: /var/tmp/temproot: Directory not empty
The problem here is that the directory /var/empty has been set . Change that with the chflags command and try again:
# find /var/tmp/temproot|xargs chflags noschg # rm -rf /var/tmp/temproot
Run mergemaster in the same way as before, saving the output. If you haven't deleted the old /var/tmp/temproot directory, you might see:
mergemaster -ia 2>1 | tee -a /var/tmp/merge
*** Creating the temporary root environment in /var/tmp/temproot.1102.15.01.14
*** /var/tmp/temproot.1102.15.01.14 ready for use
*** Creating and populating directory structure in /var/tmp/temproot.1102.15.01.14
set - `grep "^[a-zA-Z]" /usr/src/etc/locale.deprecated`; while [ $# -gt 0 ] ;
do for dir in /usr/share/locale /usr/share/nls /usr/local/share/nls;
do test -d /var/tmp/temproot.1102.15.01.14/${dir} cd /var/tmp/temproot.1102.15.01.14/${dir};
test -L "$2" rm -rf "$2";
test -L test -d mv "$2";
done; shift; shift; done
mtree -deU -f /usr/src/etc/mtree/BSD.root.dist -p /var/tmp/temproot.1102.15.01.14/
./bin missing (created)
./boot missing (created)
./boot/defaults missing (created)
./boot/kernel missing (created)
./boot/modules missing (created)
./
...
install -o root -g wheel -m 644 /dev/null /var/tinp/temproot.1102.15.01.14/var/run/utmp
install -o root -g wheel -m 644 /usr/src/etc/minfree /var/tmp/temproot.1102.15.01.14/var/crash
cd /usr/src/etc/..;
install -o root -g wheel -m 444 COPYRIGHT /var/tmp/temproot.110 2.15.01.14/
cd /usr/src/etc/../share/man; make makedb
makewhatis /var/tmp/temproot.1102.15.01.14/usr/share/man
*** Beginning comparison
*** Temp ./etc/defaults/rc.conf and installed have the same CVS Id, deleting
*** Temp ./etc/defaults/pccard.conf and installed have the same CVS Id, deleting
*** ./etc/defaults/periodic.conf will remain for your consideration
*** Temp ./etc/gnats/freefall and installed have the same CVS Id, deleting
*** Temp ./etc/isdn/answer and installed have the same CVS Id, deleting
*** Temp ./etc/isdn/isdntel.sh and installed have the same CVS Id, deleting
...
*** Comparison complete
*** Files that remain for you to merge by hand:
/var/tmp/temproot.1102.15.01.14/etc/defaults/periodic.conf
/var/tmp/temproot.1102.15.01.14/etc/mail/freebsd.mc
/var/tmp/temproot.1102.15.01.14/etc/mail/freebsd.cf
/var/tmp/temproot.1102.15.01.14/etc/mail/sendmail.cf
/var/tmp/temproot.1102.15.01.14/etc/mail/freebsd.submit.cf
/var/tmp/temproot.1102.15.01.14/etc/mail/mailer.conf
/var/tmp/temproot.1102.15.01.14/etc/mtree/BSD.include.dist
/var/tmp/temproot.1102.15.01.14/etc/mtree/BSD.local.dist
/var/tmp/temproot.1102.15.01.14/etc/mtree/BSD.usr.dist
/var/tmp/temproot.1102.15.01.14/etc/mtree/BSD.var.dist
/var/tmp/temproot.1102.15.01.14/etc/pam.d/su
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/100.chksetuid
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/200.chkmounts
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/500.ipfwdenied
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/600.ip6fwdenied
/var/tmp/temproot.1102.15.01.14/etc/periodic/security/700.kernelmsg
/var/tmp/temproot.1102.15.01.14/etc/rc.d/local
/var/tmp/temproot.1102.15.01.14/etc/crontab
/var/tmp/temproot.1102.15.01.14/etc/inetd.conf
/var/tmp/temproot.1102.15.01.14/etc/motd
/var/tmp/temproot.1102.15.01.14/etc/syslog.conf
*** You chose the automatic install option for files that did not
exist on your system. The following were installed for you:
/etc/periodic/security/510.ipfdenied
/etc/periodic/security/security.functions
/etc/mac.conf
You're not done yet: there are 21 files above that need looking at. There's a good chance that you've never heard of some of them, let alone changed them. If you know for a fact that you have never changed them, for example if you have religiously kept track of your changes with RCS, you don't need to bother: mergemaster errs on the side of safety. You may have changed others, though. The most obvious one above is /etc/crontab, which contains system-wide commands to be executed by cron.To compare them, use diff:
$ diff -wu /etc/crontab /var/tmp/temproot.1102.15.01.14/etc/crontab --- /var/tmp/crontab Sat Nov 2 16:27:02 2002 +++ /var/tmp/temproot.1102.15.01.14/etc/crontab Sat Nov 2 15:01:16 2002 @@ -1,6 +1,6 @@ # /etc/crontab - root’s crontab for FreeBSD # -# $FreeBSD: src/etc/crontab,v 1.21 1999/12/15 17:58:29 obrien Exp $ +# $FreeBSD: src/etc/crontab,v 1.31 2001/02/19 02:47:41 peter Exp $ # SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin @@ -10,19 +10,18 @@ # */5 * * * * root /usr/libexec/atrun # +# save some entropy so that /dev/random can reseed on boot +*/11 * * * * operator /usr/libexec/save-entropy +# # rotate log files every hour, if necessary 0 * * * * root newsyslog # # do daily/weekly/monthly maintenance -59 1 * * * root periodic daily -30 3 * * 6 root periodic weekly +1 3 * * * root periodic daily +15 4 * * 6 root periodic weekly 30 5 1 * * root periodic monthly # # time zone change adjustment for wall cmos clock, -# does nothing if you have UTC cmos clock. +# does nothing, if you have UTC cmos clock. # See adjkerntz(8) for details. -#1,31 0-5 * * * root adjkerntz -a +1,31 0-5 * * * root adjkerntz -a -0,30 * * * * build /home/build/build_farm/build_test 2> /home/build/cron.err -0 21 * * * root /usr/local/bin/cleanup -0 7 * * * grog /home/grog/bin/update-FreeBSD-cvs -1 * * * * root (cd /usr/local/etc/postfix; make) 2 >/dev/null >/dev/null
The lines starting with - show lines only in the old file, which is still in /etc/crontab. The lines starting with + show lines only in the new file, which is in /var/tmp/temp-root.1102.15.01.14/etc/crontab. There are a number of changes here: the 1.21 to 1.31, and the times of the periodic maintenance have changed. In the meantime, though, you have added other tasks (the bottom four lines), and you have also commented out the periodic invocation of adjkerntz.These are the changes you need to make to the new /etc/crontab before you install it.
There's a simpler possibility here, though: the only real change that would then be left in /etc/crontab is the change in the starting times for the daily and weekly housekeeping. Does that matter? If you want, you don't need to change anything: the old/etc/crontab is fine the way it is.
There's a whole list of files that you're likely to change from the defaults. Here are some more likely candidates:
Для получения официальных документов о завершении программы дополнительного профессионального образования (удостоверения о повышении квалификации, дипломов о профессиональной переподготовке и MBA) необходимо предоставить:
Внимание! Вы можете не заказывать доставку бумажной версии официального документы, а скачать его в электронном виде и распечатать самостоятельно. Информация о выданном документе в течение 1 месяца загружается в Федеральную информационную систему «Федеральный реестр сведений о документах об образовании и (или) о квалификации, документах об обучении» - ФИС ФРДО.
Доступ на новый сайт осуществляется с использованием адреса электронной почты, который был указан вами при регистрации на "старом". Мы постарались перенести все ваши данные с прежнего ресурса, однако не исключена вероятность потери части информации.
При возникновении проблемы со входом, воспользуйтесь функцией сброса пароля
Если вы обнаружите несоответствия, пожалуйста, сообщите нам.