BlogBlog ÜbersichtjailscriptportsoptFreeBSDLinksThermoskanne

FreeBSD binär auf eine neue Version aktualisieren

Mit Hilfe von freebsd-update(8) kann man ein FreeBSD System binär aktualisieren. Folgende Anleitung funktioniert allerdings nur, wenn man auf eine Version des gleichen Branches aktualisiert. In diesem Beispiel wird ein FreeBSD 6.1-RELEASE binär auf ein FreeBSD 6.3-RELEASE aktualisiert.

# uname -a
FreeBSD test.chruetertee.ch 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:32:43 UTC 2006 root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386

Zuerst muss freebsd-update heruntergeladen werden. Danach empfiehlt es sich, die Signatur von freebsd-update mit Hilfe von gpg(1) zu überprüfen:

# fetch http://www.daemonology.net/freebsd-update/freebsd-update-upgrade.tgz 
freebsd-update-upgrade.tgz 100% of 21 kB 38 kBps
# fetch http://www.daemonology.net/freebsd-update/freebsd-update-upgrade.tgz.asc
freebsd-update-upgrade.tgz.asc 100% of 187 B 1251 kBps
# gpg --verify freebsd-update-upgrade.tgz.asc freebsd-update-upgrade.tgz
gpg: Signature made Fr 16 Nov 15:01:38 2007 CET using DSA key ID CA6CDFB2
gpg: Good signature from "FreeBSD Security Officer <security-officer@FreeBSD.org>"

Sollte das Verzeichnis /var/db/freebsd-update nicht vorhanden sein, muss es angelegt werden, da sonst das Skript nicht funktioniert:

# sh freebsd-update.sh -f freebsd-update.conf -r 6.3-RELEASE upgrade
freebsd-update.sh: Directory does not exist or is not writable: /var/db/freebsd-update
# mkdir /var/db/freebsd-update

Nun kann das System auf die gewünschte Version aktualisiert werden. freebsd-update analysiert, welche Komponenten installiert sind und aktualisiert werden müssen:

# sh freebsd-update.sh -f freebsd-update.conf -r 6.3-RELEASE upgrade
Looking up update.FreeBSD.org mirrors... 1 mirrors found.
Fetching public key from update1.FreeBSD.org... done.
Fetching metadata signature for 6.1-RELEASE from update1.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic world/base

The following components of FreeBSD do not seem to be installed:
kernel/smp src/base src/bin src/contrib src/crypto src/etc src/games
src/gnu src/include src/krb5 src/lib src/libexec src/release src/rescue
src/sbin src/secure src/share src/sys src/tools src/ubin src/usbin
world/catpages world/dict world/doc world/games world/info
world/manpages world/proflibs

Does this look reasonable (y/n)? y

Fetching metadata signature for 6.3-RELEASE from update1.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 2033 patches.....10....20....30....40....50....60....70....80....90....100....110....120....130....140....150....160....170....180....190....200....210....220....230....240....250....260....270....280....290....300....310....320....330....340....350....360....370....380....390....400....410....420....430....440....450....460....470....480....490....500....510....520....530....540....550....560....570....580....590....600....610....620....630....640....650....660....670....680....690....700....710....720....730....740....750....760....770....780....790....800....810....820....830....840....850....860....870....880....890....900....910....920....930....940....950....960....970....980....990....1000....1010....1020....1030....1040....1050....1060....1070....1080....1090....1100....1110....1120....1130....1140....1150....1160....1170....1180....1190....1200....1210....1220....1230....1240....1250....1260....1270....1280....1290....1300....1310....1320....1330....1340....1350....1360....1370....1380....1390....1400....1410....1420....1430....1440....1450....1460....1470....1480....1490....1500....1510....1520....1530....1540....1550....1560....1570....1580....1590....1600....1610....1620....1630....1640....1650....1660....1670....1680....1690....1700....1710....1720....1730....1740....1750....1760....1770....1780....1790....1800....1810....1820....1830....1840....1850....1860....1870....1880....1890....1900....1910....1920....1930....1940....1950....1960....1970....1980....1990....2000....2010....2020....2030. done.
Applying patches... done.
Fetching 124 files... done.
The following files will be removed as part of updating to 6.3-RELEASE-p1:
/boot/kernel/hptmv.ko
/etc/periodic/weekly/120.clean-kvmdb
/usr/include/c++/3.4/ext/demangle.h
/usr/lib/libpcap.so.4
/usr/lib/libpthread.so.2
[...]
/var/named/etc/namedb/PROTO.localhost-v6.rev
/var/named/etc/namedb/PROTO.localhost.rev
/var/named/etc/namedb/make-localhost
The following files will be added as part of updating to 6.3-RELEASE-p1:
/bin/pgrep
/bin/pkill
/boot/kernel/acpi_dock.ko
/boot/kernel/amdsmb.ko
/boot/kernel/coretemp.ko
/boot/kernel/geom_md.ko
[...]
/usr/share/zoneinfo/Europe/Volgograd
/var/named/etc/namedb/master/empty.db
/var/named/etc/namedb/master/localhost-forward.db
/var/named/etc/namedb/master/localhost-reverse.db
The following files will be updated as part of updating to 6.3-RELEASE-p1:
/COPYRIGHT
/bin/[
/bin/cat
/bin/chflags
/bin/chio
/bin/chmod
[...]
/usr/share/zoneinfo/zone.tab
/var/named/etc/namedb/named.conf
/var/named/etc/namedb/named.root
/var/yp/Makefile.dist

Nun kann der neue Kernel installiert werden:

# sh freebsd-update.sh -f freebsd-update.conf install
Installing updates...
Kernel updates have been installed. Please reboot and run
"freebsd-update.sh install" again to finish installing updates.

Ist der Kernel installiert, muss das System neu gestartet werden:

# shutdown -r now

Nun kann der Rest des Systems aktualisiert werden:

# freebsd-update.sh -f freebsd-update.conf install
Installing updates...
Completing this upgrade requires removing old shared object files.
Please rebuild all installed 3rd party software (e.g., programs
installed from the ports tree) and then run "freebsd-update.sh install"
again to finish installing updates.

Danach sollten die Ports neu gebaut werden. Zum Beispiel kann man alle Ports deinstallieren und anschliessend neu bauen. Dazu kann portmaster(8) zur Hilfe genommen werden:

# portmaster -l > ~/installed-port-list
# portsnap fetch update
# portmaster --clean-distfiles-all
# portmaster -Faf
# pkg_delete *

portmaster erstellt eine Liste aller installierten Ports. Möchte man alle diese Ports wieder installieren, nachdem man sie gelöscht hat, so müssen nur die Root- und Leaf-Ports installiert werden. Alle anderen werden automatisch als Abhängigkeit installiert.

# cat ~/installed-port-list
===>>> Root ports (No dependencies, not depended on)
===>>> cciss_vol_status-1.03
===>>> libtool-1.5.24
===>>> poptop-1.3.4_1
===>>> portaudit-0.5.12
===>>> portmaster-2.1
===>>> portsopt-1.4
===>>> rsync-2.6.9_2
===>>> screen-4.0.3_1
===>>> sudo-1.6.9.6
===>>> 9 root ports

===>>> Trunk ports (No dependencies, are depended on)
===>>> autoconf-wrapper-20071109
===>>> expat-2.0.0_1
===>>> libiconv-1.11_1
===>>> m4-1.4.9,1
===>>> mysql-client-5.0.51
===>>> perl-5.8.8_1
===>>> pkg-config-0.22_1
===>>> 7 trunk ports

===>>> Branch ports (Have dependencies, are depended on)
===>>> apache-2.0.63
===>>> gettext-0.16.1_3
===>>> libxml2-2.6.30
===>>> p5-DBD-mysql50-4.005
===>>> p5-DBI-1.60.1
===>>> p5-Storable-2.18
===>>> p5-gettext-1.05_1
===>>> pear-1.6.2_1
===>>> pear-DB-1.7.13,1
===>>> php5-5.2.5
===>>> php5-mysql-5.2.5
===>>> php5-pcre-5.2.5
===>>> php5-session-5.2.5
===>>> php5-xml-5.2.5
===>>> 14 branch ports

===>>> Leaf ports (Have dependencies, not depended on)
===>>> autoconf-2.61_2
===>>> gmake-3.81_2
===>>> help2man-1.36.4_1
===>>> mysql-server-5.0.51
===>>> tinderbox-2.4.2
===>>> vim-lite-7.1.175
===>>> 6 leaf ports

===>>> 36 total installed ports

Nun können noch die alten Libraries gelöscht werden:

# sh freebsd-update.sh -f freebsd-update.conf install
Installing updates... done.

Danach sollte das System nochmals neu gestartet werden:

# shutdown -r now

Nach dem Neustart ist die Aktualisierung abgeschlossen.

# uname -a
FreeBSD test.chruetertee.ch 6.3-RELEASE-p1 FreeBSD 6.3-RELEASE-p1 #0: Wed Feb 13 02:40:56 UTC 2008 root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386
Related Entries:
Gespeicherte Optionen nach OptionsNG konvertieren
Ports-Subversion-Repository spiegeln
sysinstall-Ersatz für neuere FreeBSD-Versionen
Alte FreeBSD-Port Patchdateien aufsplitten
FreeBSD-Portbaum auf Fehler überprüfen
 Permalink