Опубликован: 06.08.2012 | Доступ: свободный | Студентов: 1194 / 25 | Оценка: 5.00 / 5.00 | Длительность: 53:41:00
Лекция 32:

Updating the system software

< Лекция 31 || Лекция 32: 1234 || Лекция 33 >

Upgrading the kernel

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 current sources to add functionality to the system. We'll look at this aspect in "Chapter 33" .

One point to notice is that if you're upgrading from an older custom configuration file, you could have a lot of trouble. We'll see a strategy for minimizing the pain on page 617. In addition, when upgrading to FreeBSD Release 5 from an older release of FreeBSD, you need to install a file /boot/device.hints, which you can typically copy from /usr/src/sys/i386/conf/GENERIC.hints:

# 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 object files in non-standard locations.

Upgrading the boot files

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 boot disk. Assuming your system disk is the SCSI disk /dev/da0, you would perform some of the following steps.

# 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 boot manager at the beginning of the disk.

Upgrading the configuration files

Currently, the system build procedure does not install the configuration files in /etc. You need to do that separately. There are two possible methods:

  • Do it manually:
    1. Backup the old configuration files. They're not very big, so you can probably make a copy on disk somewhere.
    2. Install pristine new configuration files:
      # cd /usr/src/etc/
      # make install
    3. Compare the files and update the new ones with information from your configuration.
  • Use mergemaster, a semi-automatic method of doing effectively the same thing.

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 security problems. It's in the new /etc/master.passwd file, but it's not in the one on the system. But how do you merge the two files? One way would to be to use 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.

< Лекция 31 || Лекция 32: 1234 || Лекция 33 >
mesange mesange
mesange mesange
Динар Шакиров
Динар Шакиров
Россия, Самара