Páginas

quinta-feira, 25 de agosto de 2011

FreeBSD - Upgrading 8, 7, 6, 5, 4

=========================================

Author: Ralf S. Engelschall
Created: 2009-01-01
Modified: 2011-01-29
Version: 1.4

ATTENTION: THIS UPGRADE PROCEDURE MIGHT NOT WORK FOR YOU AS YOUR
ENVIRONMENT IS DIFFERENT. ALSO, THIS UPGRADE PROCEDURES MIGHT DESTROY
YOUR SYSTEM AND YOU POTENTIALLY MIGHT LOOSE DATA. NO WARRANTY AT ALL.
USE IT AT YOUR OWN RISK!

This upgrades from FreeBSD 7.3-STABLE to 8.2-STABLE.

---- PREPARE ----------------------------------------------------------------

o # reboot once to make sure OLD system is at least
# able to still successfully reboot autonomous at all
# SORRY, THIS IS _NOT_ A JOKE -- THIS IS A VERY SERIOUS ISSUE!
$ shutdown -r now

---- BUILD ------------------------------------------------------------------

o # switch to a reasonable run-time environment
$ cd /; exec `/usr/bin/which bash sh | head -1`
$ PATH=/bin:/usr/bin:/sbin:/usr/sbin; umask 022; unset TMOUT

o # install backward compatibility files
# ("locale data" to /usr/local/share/compat/, "libraries" to /usr/local/lib/compat/)
# notice: via binary packages as FreeBSD 8.X ports cannot be installed under FreeBSD 7.X
$ url="ftp://ftp.freebsd.org/pub/FreeBSD/ports/`uname -m`/packages-8-stable/All"; \
( cd /tmp; for pkg in localedata-5.4.tbz \
compat6x-`uname -m`-6.4.604000.200810_3.tbz \
compat7x-`uname -m`-7.3.703000.201008_1.tbz; do \
fetch -p $url/$pkg; pkg_add $pkg; rm -f $pkg; \
done )

o # install latest FreeBSD Upgrade Toolkit
$ cd /usr; \
fetch http://people.freebsd.org/~rse/dist/freebsd-adm-1.2.2.tar.gz; \
rm -rf adm; gunzip > RELENG_8

o # upgrade /usr/src (already required for "mergemaster -p" below!)
$ (cd /usr/src && make cleandir); \
(cd /usr/adm && make update)

o # upgrade kernel configuration
$ vi /sys/`uname -m`/conf/`hostname -s | tr 'a-z' 'A-Z'`

<< options ADAPTIVE_GIANT << options STOP_NMI << device sio << device ugen << device uscanner << device isa << device mem << device io << device sl << device ppp >> options COMPAT_FREEBSD6
>> options COMPAT_FREEBSD7
>> options P1003_1B_SEMAPHORES
>> options PRINTF_BUFR_SIZE=128
>> options HWPMC_HOOKS
>> options MAC
>> options FLOWTABLE
>> device acpi
>> device uart

o # prepare the upgrade
# (just to be sure, should be not really necessary this time)
$ mergemaster -p

o # build new system
$ cd /usr/adm && make world-build && make kernel-build

---- INSTALL ----------------------------------------------------------------

o # workaround 1/3 for "bad system call" during usage of ln(1) in "make etc"
$ cp -p /bin/ln /bin/ln.old

o # upgrade system
$ make world-install && make kernel-install

o # workaround 2/3 for "bad system call" during usage of ln(1) in "make etc"
$ cp -p /bin/ln /bin/ln.new
$ cp -p /bin/ln.old /bin/ln

o # cleanup system (part 1)
$ rm -f /etc/rc.d/early.sh /etc/rc.d/idmapd /etc/rc.d/isdnd /etc/rc.d/nfslocking /etc/rc.d/ip6fw
$ make etc
$ make clean

o # workaround 3/3 for "bad system call" during usage of ln(1) in "make etc"
$ cp -p /bin/ln.new /bin/ln
$ rm -f /bin/ln.old

o # regenerate /etc/localtime
$ tzsetup

o # reboot into upgraded system
$ shutdown -r now

---- CLEANUP ----------------------------------------------------------------

o # switch to a reasonable run-time environment
$ cd /; exec `/usr/bin/which bash sh | head -1`
$ PATH=/bin:/usr/bin:/sbin:/usr/sbin; umask 022; unset TMOUT

o # cleanup system (part 2)
$ ( for dir in /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/libdata /usr/lib32; do \
find $dir -mtime +2 -type f -xdev -print; \
find $dir -mtime +2 -type l -xdev -print; \
done ) >/tmp/remove
$ vi /tmp/remove
# REVIEW FILES TO REMOVE MANUALLY
$ cat /tmp/remove | xargs chflags noschg
$ cat /tmp/remove | xargs rm -f
$ ( for dir in /lib /usr/lib; do \
find $dir -mtime +2 -type f -xdev -print; \
find $dir -mtime +2 -type l -xdev -print; \
done ) | grep -v /usr/lib/compat >/tmp/move
$ vi /tmp/move
# REVIEW FILES TO MOVE MANUALLY
$ for x in `cat /tmp/move`; do chflags noschg $x; mv $x /usr/lib/compat/; done
$ cd /usr/src; make BATCH_DELETE_OLD_FILES=YES delete-old delete-old-libs

o # reboot into cleaned system
# (mainly to reload the shared library cache and to
# make sure everything really still works fine)
$ shutdown -r now


#############################################################
#############################################################
Upgrading from FreeBSD 6.X to FreeBSD 7.X
#############################################################
#############################################################

Author: Ralf S. Engelschall
Created: 2007-05-24
Modified: 2009-08-01
Version: 1.3

ATTENTION: THIS UPGRADE PROCEDURE MIGHT NOT WORK FOR YOU AS YOUR
ENVIRONMENT IS DIFFERENT. ALSO, THIS UPGRADE PROCEDURES MIGHT DESTROY
YOUR SYSTEM AND YOU POTENTIALLY MIGHT LOOSE DATA. NO WARRANTY AT ALL.
USE IT AT YOUR OWN RISK!

This upgrades from FreeBSD 6.4-STABLE to 7.2-STABLE.

---- PROLOG -----------------------------------------------------------------

o # reboot once to make sure OLD system is at least
# able to still successfully reboot autonomous at all
# SORRY, THIS IS _NOT_ A JOKE -- THIS IS A VERY SERIOUS ISSUE!
$ shutdown -r now

---- BUILD ------------------------------------------------------------------

o # switch to a reasonable run-time environment
$ cd /; exec `/usr/bin/which bash sh | head -1`
$ PATH=/bin:/usr/bin:/sbin:/usr/sbin; umask 022; unset TMOUT

o # install backward compatibility files
# ("locale data" to /usr/local/share/compat/, "libraries" to /usr/local/lib/compat/)
# notice: via binary packages as FreeBSD 7.x ports cannot be installed under FreeBSD 6.X
$ url="ftp://ftp.freebsd.org/pub/FreeBSD/ports/`uname -m`/packages-7-stable/All"; \
( cd /tmp; for pkg in localedata-5.4.tbz compat6x-`uname -m`-6.4.604000.200810.tbz; do \
fetch -p $url/$pkg; pkg_add $pkg; rm -f $pkg; \
done )

o # install latest FreeBSD Upgrade Toolkit
$ cd /usr; \
fetch http://people.freebsd.org/~rse/dist/freebsd-adm-1.2.2.tar.gz; \
rm -rf adm; gunzip > RELENG_7

o # upgrade /usr/src (already required for "mergemaster -p" below!)
$ (cd /usr/src && make cleandir); \
(cd /usr/adm && make update)

o # upgrade kernel configuration
$ vi /sys/`uname -m`/conf/`hostname -s | tr 'a-z' 'A-Z'`

>> options COMPAT_FREEBSD6
>> options SCTP # Stream Transmission Control Protocol
>> options UFS_GJOURNAL # Enable gjournal-based UFS
>> options STOP_NMI # Stop CPUS using NMI instead of IPI
>> options AUDIT # Security event auditing
>> options GEOM_LABEL # Provides labelization

<< options GEOM_GPT # GUID Partition Tables. >> options GEOM_PART_GPT # GUID Partition Tables.

<< options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] >> options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!]

<< options NTFS >> options STACK # stack(9) support

>> device uart # Generic UART driver

<< device lnc # NE2100, NE32-VL Lance Ethernet cards >> device le # AMD Am7900 LANCE and Am79C9xx PCnet

>> device firmware # firmware assist module

>> device dcons # Dumb console driver
>> device dcons_crom # Configuration ROM for dcons

<< device rr232x # Highpoint RocketRAID 232x o # prepare the upgrade # (mainly create "ftp" group) $ mergemaster -p o # build new system $ cd /usr/adm && make world-build kernel-build ---- INSTALL ---------------------------------------------------------------- o # upgrade system $ make world-install kernel-install o # cleanup system (part 1) $ rm -f /etc/rc.d/ike /etc/rc.d/pccard /etc/rc.d/pcvt /etc/rc.d/ramdisk $ rm -f /etc/rc.d/ramdisk-own /etc/rc.d/usbd /etc/rc.d/nfslocking $ make etc $ make clean o # reboot into upgraded system $ shutdown -r now ---- CLEANUP ---------------------------------------------------------------- o # switch to a reasonable run-time environment $ cd /; exec `/usr/bin/which bash sh | head -1` $ PATH=/bin:/usr/bin:/sbin:/usr/sbin; umask 022; unset TMOUT o # cleanup system (part 2) $ ( for dir in /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/libdata; do \ find $dir -mtime +2 -type f -xdev -print; \ find $dir -mtime +2 -type l -xdev -print; \ done ) >/tmp/remove
$ vi /tmp/remove
# REVIEW FILES TO REMOVE MANUALLY
$ cat /tmp/remove | xargs rm -f
$ ( for dir in /lib /usr/lib; do \
find $dir -mtime +2 -type f -xdev -print; \
find $dir -mtime +2 -type l -xdev -print; \
done ) | grep -v /usr/lib/compat >/tmp/move
$ vi /tmp/move
# REVIEW FILES TO MOVE MANUALLY
$ for x in `cat /tmp/move`; do chflags noschg $x; mv $x /usr/lib/compat/; done
$ cd /usr/src; make BATCH_DELETE_OLD_FILES=YES delete-old delete-old-libs

---- EPILOG ----------------------------------------------------------------

o # reboot into cleaned system
# (mainly to reload the shared library cache and to
# make sure everything really still works fine)
$ shutdown -r now

#############################################################
#############################################################
Upgrading from FreeBSD 5.X to FreeBSD 6.X
#############################################################
#############################################################

Author: Ralf S. Engelschall
Version: 1.5
Modified: 2007-05-24
Created: 2006-01-11

ATTENTION: THIS UPGRADE PROCEDURE MIGHT NOT WORK FOR YOU AS YOUR
ENVIRONMENT IS DIFFERENT. ALSO, THIS UPGRADE PROCEDURES MIGHT DESTROY
YOUR SYSTEM AND YOU POTENTIALLY MIGHT LOOSE DATA. NO WARRANTY AT ALL.
USE IT AT YOUR OWN RISK!

The following is a step-by-step procedure for upgrading a server from
FreeBSD 5.[45]-STABLE to a FreeBSD 6.2-STABLE.

It is able to upgrade the server completely remotely with neither
console access nor single-user mode requirements. It was successfully
tested on about 20 servers in February 2007.

---- PREPARE ----------------------------------------------------------------

o # reboot once to make sure OLD system is at least
# able to still successfully reboot at all ;-)
# SORRY, THIS IS NOT A JOKE -- THIS IS A VERY SERIOUS ISSUE!
$ shutdown -r now

---- BUILD ------------------------------------------------------------------

o # switch to a reasonable run-time environment
$ cd /; exec `/usr/bin/which bash sh | head -1`
$ PATH=/bin:/usr/bin:/sbin:/usr/sbin; umask 022; unset TMOUT

o # install backward compatibility files
# (locale data to /usr/local/share/compat/, libraries to /usr/local/lib/compat/)
# notice: via binary packages as ports cannot be installed under FreeBSD 5.X
$ url="ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/All"
$ ( cd /tmp; for pkg in localedata-5.4.tbz compat5x-i386-5.4.0.8_7.tbz; do \
fetch -p $url/$pkg; pkg_add $pkg; rm -f $pkg; \
done )

o # install latest FreeBSD Upgrade Toolkit
$ cd /usr; \
fetch http://people.freebsd.org/~rse/dist/freebsd-adm-1.2.2.tar.gz; \
rm -rf adm; gunzip > options COMPAT_FREEBSD5

o # prepare the upgrade
# (mainly create "_dhcp" and "audit" user/group)
$ mergemaster -p

o # build new system
$ cd /usr/adm && make world-build kernel-build

---- INSTALL ----------------------------------------------------------------

o # upgrade system
$ make world-install kernel-install

o # cleanup system (part 1)
$ rm -f /etc/rc.d/gbde_swap /etc/rc.d/initdiskless /etc/rc.d/ppp-user
$ rm -f /etc/rc.d/preseedrandom /etc/rc.d/rcconf.sh /etc/rc.d/vinum
$ make etc
$ make clean

o # reboot into upgraded system
$ shutdown -r now

---- CLEANUP ----------------------------------------------------------------

o # switch to a reasonable run-time environment
$ cd /; exec `/usr/bin/which bash bash sh | head -1`
$ PATH=/bin:/usr/bin:/sbin:/usr/sbin; umask 022; unset TMOUT

o # cleanup system (part 2)
$ ( for dir in /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/libdata; do \
find $dir -mtime +2 -type f -xdev -print; \
find $dir -mtime +2 -type l -xdev -print; \
done ) >/tmp/remove
$ vi /tmp/remove
# REVIEW FILES TO REMOVE MANUALLY
$ cat /tmp/remove | xargs rm -f
$ ( for dir in /lib /usr/lib; do \
find $dir -mtime +2 -type f -xdev -print; \
find $dir -mtime +2 -type l -xdev -print; \
done ) | grep -v /usr/lib/compat >/tmp/move
$ vi /tmp/move
# REVIEW FILES TO MOVE MANUALLY
$ for x in `cat /tmp/move`; do chflags noschg $x; mv $x /usr/lib/compat/; done
$ cd /usr/src; make BATCH_DELETE_OLD_FILES=YES delete-old delete-old-libs

o # reboot into cleaned system
# (mainly to reload the shared library cache and to
# make sure everything really still works fine)
$ shutdown -r now

#####################################################
#####################################################
Upgrading from FreeBSD 4.X to FreeBSD 5.X
#####################################################
#####################################################

Ralf S. Engelschall
Version: 3.4 (2005-09-28)

ATTENTION: THIS UPGRADE PROCEDURE MIGHT NOT WORK FOR YOU AS YOUR
ENVIRONMENT IS DIFFERENT. ALSO, THIS UPGRADE PROCEDURES MIGHT DESTROY
YOUR SYSTEM AND YOU POTENTIALLY MIGHT LOOSE DATA.

The following is a step-by-step procedure for upgrading a FreeBSD 4.X
(actually 4.11-STABLE) system to FreeBSD 5.X (actually 5.4-STABLE).

It uses a hard-core in-place system overwriting approach in order to
require no console access and single-user mode at all. Hence it is
suitable for upgrading a server remotely via just SSH access.

It was developed on a VMWare GSX based virtual PC (i386) and
successfully tested on HP DL380 PCs. BUT NO WARRANTY IS GIVEN THAT THIS
PROCEDURE REALLY WORKS FOR YOU. USE IT AT YOUR OWN RISK ONLY!

Notice: the main difference between the resulting upgraded system and a
freshly installed system is that the upgraded one is still running under
UFS1 filesystems instead of UFS2. Unfortunately UFS1 cannot be converted
to UFS2. A full dump/restore of the whole data would be required (which
is nearly impossible remotely, at least for / and /usr). But it doesn't
hurt, as the UFS2 advantages (64bit pointers, lazy inode init, extended
attributes, etc) are not necessary for existing old servers (usually
filesystems not greater than 1TB, filesystems already initialized and
extended attributes are a new feature).

PASS 1: Bootstrap into FreeBSD 5.4-RELEASE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

o switch to a reasonable run-time environment
$ cd /; exec `/usr/bin/which bash sh | head -1`
$ PATH=/bin:/usr/bin:/sbin:/usr/sbin
$ ntpdate pool.ntp.org pool.ntp.org pool.ntp.org pool.ntp.org
$ umask 022
$ unset TMOUT
$ unalias vi

o try to shutdown as much processes as possible to reduce filesystem
contention. The result should be some sort of a pseudo single-user mode
(yes: cron, syslogd, inetd, sendmail, lpd, ...)
(no: sshd, getty, dhclient, ntpd, csh, adjkerntz, ...)
$ killall cron syslogd inetd sendmail lpd
$ ps -ax
$ kill ...

o fetch and mount FreeBSD 5.4-RELEASE CDROM ISO image
$ cd /usr
$ fetch ftp://ftp.de.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/5.4/5.4-RELEASE-i386-disc1.iso
$ vnconfig -c -v /dev/vn0 5.4-RELEASE-i386-disc1.iso
$ mount -t cd9660 -o ro /dev/vn0 /mnt

o determine which /etc files were actually changed
$ mergemaster -t /tmp/mm -a
$ chflags -R noschg,nouchg /tmp/mm
$ find /tmp/mm -type d -depth -print | xargs rmdir 2>/dev/null
$ rm -rf /tmp/mm/usr /tmp/mm/var /tmp/mm/sys /tmp/mm/dev
$ find /tmp/mm -type l -print | xargs rm -f

o create a new /usr/src (for both mergemaster and later upgrade speedup)
$ kc=`hostname | sed -e 's;\..*$;;' | tr 'a-z' 'A-Z'`; echo $kc
$ cp /sys/`uname -m`/conf/$kc /tmp/$kc 2>/dev/null || true
$ rm -rf /usr/src; mkdir /usr/src
$ cd /mnt/5.4-RELEASE/src; ./install.sh all
$ cp /tmp/$kc /sys/`uname -m`/conf/$kc 2>/dev/null || true
$ sync; sync; sync

o create a new /etc from scratch
(Notice: tar intentionally used without pipe as it broke sometimes!)
$ cd /usr/src/usr.sbin/mergemaster && make all install
$ mv /etc /etc.old
$ mkdir /etc
$ cd /etc.old && tar cf /tmp/etc.tar master.passwd passwd group shells
$ cd /etc && tar xvf /tmp/etc.tar
$ pwd_mkdb -p /etc/master.passwd
$ mergemaster -v -i -a
$ cap_mkdb /etc/login.conf
$ /usr/bin/newaliases

o restore the old /etc files which were actually changed
(Notice: tar intentionally used without pipe as it broke sometimes!)
$ cd /tmp/mm/etc; for file in *; do \
if [ -f $file -a ! -h $file ]; then \
cp -p /etc.old/$file /etc/$file; \
echo /etc/$file; \
fi; \
done
$ cd /; rm -rf /tmp/mm
$ cd /etc.old && tar cf /tmp/etc.tar rc.conf crontab fstab resolv.conf termcap \
wall_cmos_clock localtime rc.d/*.sh start_if* ssh 2>/dev/null
$ cd /etc && tar xvf /tmp/etc.tar

o merge the /etc files which were actually changed with new content
$ export EDITOR=vi
$ export PAGER=less
$ vipw
:1,$s/\/sbin\/nologin/\/usr\/sbin\/nologin/g
$ chflags -R noschg /var/tmp/temproot
$ rm -rf /var/tmp/temproot
$ mergemaster -v -i -s -C
$ vi /etc/rc.conf
# REVIEW MANUALLY
<>
<>dumpdev="/dev/idad0s1b"
<>#saver="..."
<>#blanktime="..."
<>#font8x8="iso-8x8"
<>#font8x14="iso-8x14"
<>#font8x16="iso-8x16"
<>sshd_enable="YES"
firewall_enable="NO"
firewall_type="open"
#firewall_script="open"
$ vi /etc/ssh/sshd_config
Port 2222
PermitRootLogin yes
$ vi /etc/start_if*
# REVIEW MANUALLY
$ vi /etc/sysctl.conf
# REVIEW MANUALLY
<> md /tmp mfs rw,-s256m,-i2048,-Otime,-v2,async,noatime,nosuid,nodev 0 0

o further adjust system configuration files
1. force foreground fsck(1) to avoid snapshots (which are unstable on FreeBSD 5)
2. disable ACPI (which too often makes problems on older servers)
$ echo "background_fsck=\"NO\"" >>/etc/rc.conf
$ echo "hint.acpi.0.disabled=\"1\"" >>/boot/loader.conf

o allow us to finalize after the hard-core system file overwrite
$ cp -p /bin/rm /bin/sync /sbin/reboot /tmp

o hard-core overwrite FreeBSD 4.x system files with FreeBSD 5.4 ones
$ chflags -R noschg,nouchg /bin /sbin /usr/bin /usr/sbin /usr/lib /usr/libexec 2>/dev/null || true
$ for part in compat4x games dict manpages info; do \
(cd /mnt/5.4-RELEASE/$part && ./install.sh); \
done
$ mv /usr/include /usr/include.old
$ mv /usr/share /usr/share.old
$ cd /mnt/5.4-RELEASE/base
*** ATTENTION: NOW THE SYSTEM IS OVERWRITTEN IN-PLACE ***
$ cat base.?? | tar --unlink --exclude="etc/*" -xpzf - -C / 2>/dev/null
*** ATTENTION: NOW ALL OVERWRITTEN COMMANDS ARE UNUSABLE: "Bad system call" ***

o reboot into FreeBSD 5.4-RELEASE
$ /tmp/rm -rf /dev/*
$ /tmp/rm -f /usr/lib/libkvm.so.2
$ /tmp/sync; /tmp/sync; /tmp/sync
$ /tmp/reboot

PASS 2: Rebuild system in-place for FreeBSD 5.4-STABLE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

o switch to a reasonable run-time environment
$ cd /; exec `/usr/bin/which bash sh | head -1`
$ PATH=/bin:/usr/bin:/sbin:/usr/sbin
$ ntpdate pool.ntp.org pool.ntp.org pool.ntp.org pool.ntp.org
$ umask 022
$ unset TMOUT
$ unalias vi

o reduce background activity
$ /etc/rc.d/cron stop

o some cleanups from PASS 1
$ for fs in / /var /usr; do find $fs -name PaxHeader -type d -print -xdev | xargs rm -rf; done
$ rm -rf /usr/include.old /usr/share.old
$ rm -f /usr/5.4-RELEASE-i386-disc1.iso
$ rm -rf /modules
$ chflags noschg,nouchg /kernel*
$ rm -f /kernel*

o migrate the kernel configuration
$ cd /sys/`uname -m`/conf
$ kc=`hostname | sed -e 's;\..*$;;' | tr 'a-z' 'A-Z'`; echo $kc
$ test -f $kc || cp GENERIC $kc
$ vi $kc
>> options COMPAT_FREEBSD4

o upgrade /usr/adm environment
$ cd /usr
$ fetch http://people.freebsd.org/~rse/dist/freebsd-adm-1.0.14.tar.gz
$ rm -rf adm; gunzip Makefile.bsd.new && mv Makefile.bsd.new Makefile.bsd
$ rm -rf /usr/ports/*
$ sync; sync; sync
$ make upgrade
$ make etc

o filesystem cleanup by removing obsolete files
$ ( for dir in /bin /sbin /usr/bin /usr/sbin /usr/lib /usr/libexec /usr/libdata; do \
find $dir -mtime +2 -type f -xdev -print; \
find $dir -mtime +2 -type l -xdev -print; \
done ) | grep -v /usr/lib/compat >/tmp/remove
$ vi /tmp/remove
# REVIEW MANUALLY
$ cat /tmp/remove | xargs rm -f

o reboot into FreeBSD 5.4-STABLE
$ shutdown -r now

#####################################################
#####################################################
Upgrading from FreeBSD 3.X to FreeBSD 4.1-STABLE
#####################################################
#####################################################

Ralf S. Engelschall
Version: 1.2 (2005-09-27)

ATTENTION: THIS UPGRADE PROCEDURE MIGHT NOT WORK FOR YOU AS YOUR
ENVIRONMENT IS DIFFERENT. ALSO, THIS UPGRADE PROCEDURES MIGHT DESTROY
YOUR SYSTEM AND YOU POTENTIALLY MIGHT LOOSE DATA.

o boot the old FreeBSD 3.x in multi-user mode

o provide a particular build environment
$ vi /etc/make.conf
NOPERL=true # else Perl would fail to build under 3.x initially
NOPROFILE=true # to speed up building
MAKE_RSAINTL=YES # for non-US
USA_RESIDENT=NO # dito.
CFLAGS=-O -pipe # standard optimization
COPTFLAGS=-O -pipe # dito.
COMPAT1X=yes # install compatibility libraries
COMPAT20=yes # dito.
COMPAT21=yes # dito.
COMPAT22=yes # dito.
COMPAT3X=yes # dito.

o provide boot-strapping run-time environment
$ mkdir -p /usr/obj/usr/src/lib/libc
$ ldconfig -R /usr/obj/usr/src/lib/libc

o build the world initially (still under FreeBSD 3.x run-time)
$ cd /usr/obj
$ chflags -R noschg *
$ rm -rf *
$ cd /usr/src
$ make buildworld

o build and install new GENERIC kernel+modules
$ make buildkernel KERNEL=GENERIC
$ make installkernel KERNEL=GENERIC
$ chflags noschg /kernel.GENERIC /GENERIC
$ mv /kernel.GENERIC /kernel.GENERIC.3
$ mv /GENERIC /kernel.GENERIC
$ chflags schg /kernel.GENERIC

o upgrade FOO kernel config from 3.x to 4.x
$ vi /sys/i386/conf/FOO
- remove "config kernel ...", "bio", "tty", "net", "conflicts"
- remove unnecessary quotations
- remove "pnp" device
- remove "acd0" device
- remove obsolete options (check output of "config FOO")
- replace some "xxx0" with "xxx" (compare LINT for details)
- replace "controller" & "disk" with "device"
- replace "wdc0" with "ata0" plus more "ata*" from GENERIC
- replace "bpfilter" with "bpf"
- replace "isa?" with "atkbdc?" for "atkbd0" and "psm0" device

o build and install new FOO kernel+modules
$ make buildkernel KERNEL=FOO
$ make installkernel KERNEL=FOO
$ chflags noschg /kernel /FOO
$ mv /kernel /kernel.3
$ mv /FOO /kernel
$ chflags schg /kernel

o upgrade devices
$ cd /usr/src/sbin/mknod && make install
$ cp /usr/src/etc/MAKEDEV* /dev
$ cd /dev
$ sh MAKEDEV all
- make sure really all devices for disks exists:
for N in the list of disks
sh MAKEDEV N # eg ad0
for M in the list of slices
sh MAKEDEV NsMa # eg ad0s1a
- edit /etc/fstab and replace "wd0" with "ad0"

o upgrade boot blocks and loader
$ cd /sys/boot && make install

o boot FreeBSD 4.x kernel (still with 3.x user-land) in single-user mode
$ shutdown -r now
> boot -s
$ mount -a

o install the world
$ cd /usr/src/gnu/usr.bin/texinfo/install-info
$ make install
$ ldconfig -R /usr/obj/usr/src/lib/libc
$ cd /usr/src
$ make installworld
$ cd /usr/src/release/sysinstall && make all install

o upgrade /etc
$ cp -rp /etc /etc.old
$ mergemaster -v -s

o final adjustments for new FreeBSD 4.x user-land
$ touch /var/log/security
$ touch /var/log/cron
$ rm /var/cron/log*

o switch to new shipped OpenSSH [OPTIONAL!]
$ ssh-keygen -f /etc/ssh/ssh_host_key
$ ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key
$ vi /etc/rc.conf
sshd_enable="YES"
$ pkg_delete ssh-1.2.27

o boot FreeBSD 4.x kernel and user-land in multi-user mode
$ shutdown -r now

o rebuild some criticial programs to avoid spurious segfaults
under the forthcoming final "buildworld/installworld" step
$ vi /etc/make.conf
#NOPERL=true
$ cd /usr/src/gnu/usr.bin/perl
$ (cd libperl && make all install)
$ (cd perl && make all install)
$ make clean all install
$ cd /usr/src/usr.bin/lex && make clean all install
$ cd /usr/src/usr.bin/yacc && make clean all install
$ cd /usr/src/gnu/usr.bin/as && make clean all install
$ cd /usr/src/gnu/usr.bin/cc && make clean all install
$ cd /usr/src/gnu/lib/libgcc && make clean all install

o build and install the world finally from scratch (under FreeBSD 4.x run-time)
$ cd /usr/obj
$ chflags -R noschg *
$ rm -rf *
$ cd /usr/src
$ make buildworld
$ make installworld

o rebuild the kernel with the final tools
$ cd /sys/i386/conf
$ config FOO
$ cd /sys/compile/FOO
$ make depend all
$ make install

o reboot to switch to the final FreeBSD 4.x system
$ shutdown -r now

Nenhum comentário:

Postar um comentário