V-Server Update: Ubuntu 8.04 auf 10.04

Am 4. Mai 2010 hatte ich einen Artikel geschrieben, in dem beschrieben wurde, wie ein V-Server von Ubuntu 8.04 auf 10.04 aktualisiert werden kann. Da sich ein paar Sachen etwas vereinfacht haben, wollte ich das ganze noch einmal kurz in einem neuen Artikel zusammenfassen.

Wie immer gilt: Wer das im folgenden beschrieben nachmacht, der tut dies auf eigene Gefahr. Der Autor haftet nicht für irgendeinen daraus hervorgegangen Schaden.

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.

Ausgegangen wird von einem frischen Ubuntu 8.04 bei Strato. Das ganze sollte sich aber leicht auf andere Server übertragen lassen. Wie folgt bin ich Anfang Dezember 2010 vorgegangen.

Zuerst sollte das System auf den aktuellsten Stand gebracht werden. Hierfür sollten alle Updates eingespielt werden.

$ sudo apt-get update
$ sudo apt-get dist-upgrade

Anschließend kann mit dem Upgradevorgang begonnen werden.

$ sudo apt-get install update-manager-core
$ sudo do-release-upgrade

Achtung: Es sollte darauf geachtet werden, dass auch wirklich das Update auf 10.04 und nicht auf eine spätere Version eingespielt wird.

Im Laufe des Vorgangs kommt es zu einem Fehler mit dem KLOG-Dämon, der nicht gestartet werden kann.

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

# mountall - Mount filesystems on boot
#
# This helper mounts filesystems in the correct order as the devices
# 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

# networking - configure virtual network devices
#
# This task causes virtual network devices that do not have an associated
# kernel object to be started on boot.

description     "configure virtual network devices"

start on local-filesystems

task

exec ifup -a

/etc/init/rc.conf

# rc - System V runlevel compatibility
#
# This task runs the old System V-style rc script when changing between
# 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

# rc-sysinit - System V initialisation compatibility
#
# This task runs the old System V-style system initialisation scripts,
# and enters the default runlevel when finished.

description     "System V initialisation compatibility"
author          "Scott James Remnant "

start on filesystem
stop on runlevel

# Default runlevel, this may be overriden on the kernel command-line
# or by faking an old /etc/inittab entry
env DEFAULT_RUNLEVEL=2

# There can be no previous runlevel here, but there might be old
# information in /var/run/utmp that we pick up, and we don't want
# that.
#
# 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

# ssh - OpenBSD Secure Shell server
#
# 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
# 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

# if you used to set SSHD_OPTS in /etc/default/ssh, you can change the
# 'exec' line here instead
exec /usr/sbin/sshd

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.

Verwandte Artikel