Viele Webhoster bieten V-Server an. Soll als Gast-System ein Linux laufen, kommt zu 99,9% OpenVZ bzw. die kommerzielle Version Virtuozzo zum Einsatz. Im folgenden wird gezeigt wie das Gastsystem eines V-Servers von Ubuntu 8.04 auf Ubuntu 10.04 aktualisiert wird. Als Beispiel hierfür dient ein Server von Strato.
Da sich einige Sachen seit der Veröffentlichung dieses Artikels leicht verändert und vereinfacht haben. Habe ich das ganze noch einmal in einem neuen Artikel zusammengefasst.
Bevor begonnen wird, sollte geschaut werden ob der Webhoster eine Möglichkeit für einen RecoveryManager anbietet, damit eventuelle Probleme mit Hilfe des Rettungssystems behoben werden können.
Da im Moment Ubuntu 10.04 noch nicht auf den internen Strato Servern
verfügbar ist muss zuerst die Datei /etc/apt/sources.list
so
angepasst werden, dass ein externer Spiegelserver genutzt wird.
deb http://de.archive.ubuntu.com/ubuntu/ lucid main restricted universe
deb-src http://de.archive.ubuntu.com/ubuntu/ lucid main restricted universe
deb http://de.archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe
deb-src http://de.archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe
deb http://de.archive.ubuntu.com/ubuntu/ lucid-security main restricted universe
deb-src http://de.archive.ubuntu.com/ubuntu/ lucid-security main restricted universe
Anschließend sollten die neuesten Pakete und die aktuellen Updates für das laufende System installiert sein.
$ sudo apt-get update
$ sudo apt-get dist-upgrade
Ist dies geschehen kann der aktuelle Update-Manager installiert werden.
$ sudo apt-get install update-manager-core
Sind diese Vorbereitungen getroffen kann mit dem Update begonnen werden.
Update: Der Befehl do-release-upgrade sollte ohne den Parameter -d aufgerufen werden, da sonst ein Update auf die neueste Ubuntu Version durchgeführt wird. Dies ist zum jetzigen Zeitpunkt Ubuntu 10.10. Der Parameter -d stammt noch aus der Zeit, wo Ubuntu 10.04 noch nicht offiziell verfügbar war.
$ sudo do-release-upgrade
Im Laufe des Vorgangs kommt es zu einem Fehler mit dem KLOG-Dämon, der nicht gestartet werden kann.
$ sudo do-release-upgrade
[...]
Installiere neue Version der Konfigurationsdatei /etc/syslog.conf ...
Installiere neue Version der Konfigurationsdatei /etc/init.d/sysklogd ...
* Stopping system log daemon...
* Starting system log daemon...
Dieser Prozess kann mit einem Druck auf Strg+C abgebrochen werden. Ist
dies geschafft kann in die Datei /etc/init.d/klogd
unter dem ersten
Kommentar die Zeile exit 0
ergänzt werden. Um den Update Prozess
abzuschließen muss folgender Befehl ausgeführt werden.
$ sudo dpkg --configure -a
Der Server darf zum jetzigen Zeitpunkt noch nicht neu gestartet werden.
Bevor dies getan werden kann sind noch ein paar Anpassungen notwendig.
Zuerst muss in das Verzeichnis /etc/init
gewechselt werden.
Anschließend müssen aus diesem folgende Dateien entfernt werden. Dabei
empfiehlt es sich die Dateien nicht einfach zu löschen, sondern sie in
einem anderen Verzeichnis zu sichern.
- control-alt-delete.conf
- hwclock.conf
- hwclock-save.conf
- mountall-net.conf
- mountall-reboot.conf
- mountall-shell.conf
- mounted-dev.conf
- mounted-tmp.conf
- mounted-varrun.conf
- network-interface.conf
- network-interface-security.conf
- plymouth.conf
- plymouth-log.conf
- plymouth-splash.conf
- plymouth-stop.conf
- tty1.conf
- tty2.conf
- tty3.conf
- tty4.conf
- tty5.conf
- tty6.conf
- udev.conf
- udev-finish.conf
- udevmonitor.conf
- udevtrigger.conf
- upstart-udev-bridge.conf
Anschließend müssen noch ein paar Dateien angepasst werden.
/etc/init/mountall.conf
title: mountall - Mount filesystems on boot
#
title: This helper mounts filesystems in the correct order as the devices
title: and mountpoints become available.
description "Mount filesystems on boot"
start on startup
task
emits virtual-filesystems
emits local-filesystems
emits remote-filesystems
emits all-swaps
emits all-filesystems
emits filesystem
pre-start script
find /var/run -mindepth 1 -maxdepth 1 | grep -v utmp | xargs rm -rf
mkdir -p /var/run/network
find /var/lock -mindepth 1 -maxdepth 1 | xargs rm -rf
end script
post-start script
initctl emit -n filesystem
initctl emit -n all-swaps
initctl emit -n all-filesystems
initctl emit -n virtual-filesystems
initctl emit -n remote-filesystems
initctl emit -n local-filesystems
mount -a
end script
/etc/init/networking.conf
title: networking - configure virtual network devices
#
title: This task causes virtual network devices that do not have an associated
title: kernel object to be started on boot.
description "configure virtual network devices"
start on local-filesystems
task
exec ifup -a
/etc/init/rc.conf
title: rc - System V runlevel compatibility
#
title: This task runs the old System V-style rc script when changing between
title: runlevels.
description "System V runlevel compatibility"
author "Scott James Remnant "
start on runlevel [0123456]
stop on runlevel [!$RUNLEVEL]
export RUNLEVEL
export PREVLEVEL
task
exec /etc/init.d/rc $RUNLEVEL
/etc/init/rc-sysinit.conf
title: rc-sysinit - System V initialisation compatibility
#
title: This task runs the old System V-style system initialisation scripts,
title: and enters the default runlevel when finished.
description "System V initialisation compatibility"
author "Scott James Remnant "
start on filesystem
stop on runlevel
title: Default runlevel, this may be overriden on the kernel command-line
title: or by faking an old /etc/inittab entry
env DEFAULT_RUNLEVEL=2
title: There can be no previous runlevel here, but there might be old
title: information in /var/run/utmp that we pick up, and we don't want
title: that.
#
title: These override that
env RUNLEVEL=
env PREVLEVEL=
task
script
# Check for default runlevel in /etc/inittab
if [ -r /etc/inittab ]
then
eval "$(sed -nre 's/^[^#][^:]*:([0-6sS]):initdefault:.*/DEFAULT_RUNLEVEL="\1";/p' /etc/inittab || true)"
fi
# Check kernel command-line for typical arguments
for ARG in $(cat /proc/cmdline)
do
case "${ARG}" in
-b|emergency)
# Emergency shell
[ -n "${FROM_SINGLE_USER_MODE}" ] || sulogin
;;
[0123456sS])
# Override runlevel
DEFAULT_RUNLEVEL="${ARG}"
;;
-s|single)
# Single user mode
[ -n "${FROM_SINGLE_USER_MODE}" ] || DEFAULT_RUNLEVEL=S
;;
esac
done
# Run the system initialisation scripts
[ -n "${FROM_SINGLE_USER_MODE}" ] || /etc/init.d/rcS
# Switch into the default runlevel
telinit "${DEFAULT_RUNLEVEL}"
end script
/etc/init/ssh.conf
title: ssh - OpenBSD Secure Shell server
#
title: The OpenSSH server provides secure shell access to the system.
description "OpenSSH server"
start on filesystem
stop on runlevel S
expect fork
respawn
respawn limit 10 5
umask 022
title: replaces SSHD_OOM_ADJUST in /etc/default/ssh
#oom never
pre-start script
test -x /usr/sbin/sshd || { stop; exit 0; }
test -e /etc/ssh/sshd_not_to_be_run && { stop; exit 0; }
test -c /dev/null || { stop; exit 0; }
mkdir -p -m0755 /var/run/sshd
end script
title: if you used to set SSHD_OPTS in /etc/default/ssh, you can change the
title: 'exec' line here instead
exec /usr/sbin/sshd
Update: Es hatte sich ein kleiner Fehler beim Kopieren eingeschlichen. Das "&&" ist zu "&&" geworden. Der Fehler ist jetzt behoben. Danke an David für den Hinweis.
An dieser Stelle sollte ein Neustart ohne Probleme möglich sein.
Eventuell müssen bei weiteren installierten Paketen die Dateien unter
/etc/init
noch etwas angepasst werden.