# Wie aktualisiere ich meine Enginsight Server von Debian 11 auf Debian 12?

Um deine Enginsight Applikationsserver, Datenbankserver und Komponentenserver von Debian 11 auf Debian 12 zu aktualisieren, kannst du das Update-Skript nutzen, das wir im Folgenden zur Verfügung stellen.

***

## Wichtige Hinweise

* Für die **Aktualisierung des Enginsight Datenbankservers** ist es zwingend notwendig, dass du folgende Anleitung in der Knowledge Base befolgst, bevor du das Skript auf die Datenbank anwendest: [Wie aktualisiere ich die Enginsight Datenbank von MongoDB 5.0 auf MongoDB 8.0?](https://app.gitbook.com/o/-LTMe1v-4K6py3ggoxhv/s/m7kFsCWkwO5xnjJ7eSF0/datenbank/wie-aktualisiere-ich-die-enginsight-datenbank-von-mongodb-5.0-auf-mongodb-8.0)
* Für die **Aktualisierung des Enginsight Applikationsservers und Komponentenservers** empfehlen wir dringend, vor der Anwendung des Skripts einen Snapshot der entsprechenden virtuellen Maschinen zu erstellen.
* Bitte beachte, falls du einen **Xen Hypervisor** verwendest, dass ab Debian 12 auch dort Predictable Network Interface Naming (PNIN) angewendet wird. Dadurch können sich die Namen der Netzwerkschnittstellen ändern. Wir empfehlen, die neuen Namen in der Netzwerkkonfiguration zu übernehmen, da das Deaktivieren von PNIN bei zukünftigen Updates zu Problemen führen kann.&#x20;

***

## Skript für das Update von Debian 11 auf Debian 12

```
#!/bin/bash

# Debian bullseye -> bookworm upgrade script V2
# (C) 2025
    #     Enginsight GmbH
#   # #   Lars Meyer
# # # #   Geschäftsführer: Mario Jandeck, Eric Range
# #   #   Leutragraben 1, 07743 Jena
  #

function restore_backup() {
    find /etc/apt/ -type f -name '*.list.backup' -exec bash -c 'mv $0 ${0%.backup}' {} \;
    apt-key add /etc/apt/mongodb-server-5.0.asc.backup
    echo "Upgrade failed. Restored backup files"
}

logFileName=/var/log/$(date +%Y%m%d%H%M%S)_upgrade.log
echo "Log will be written to $logFileName"
{
    set -e -u

    export DEBIAN_FRONTEND=noninteractive

    echo "Checking whether apt-get update currently runs successfully"
    apt-get -y update

    echo "Checking whether any packages are held or broken"
    audit=$(dpkg --audit)
    if [[ $audit ]]
    then
        echo "Cannot upgrade: you have held or broken packages. Please fix this situation manually and attempt the upgrade again"
        echo $audit
        exit 1
    fi

    echo "Backing up sources.list files"
    find /etc/apt/ -type f -name '*.list' -exec cp {} {}.backup \;

    echo "Backing up MongoDB 5 signing key"
    apt-key export "F5679A222C647C87527C2F8CB00A0BD1E2C63C11" > /etc/apt/mongodb-server-5.0.asc.backup

    # Install GnuPG if necessary
    if ! dpkg -l | grep -q gnupg
    then
        apt-get install -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-confdef -y gnupg
    fi

    echo "Replacing bullseye with bookworm in all sources.list files"
    find /etc/apt/ -type f -name '*.list' -exec sed -E -i 's/(deb.*?https?:\/\/[a-z0-9.-]+\/debian[^[:space:]]*\/?\s+)bullseye(.*)/\1bookworm\2/g' {} \;

    if [[ -f /etc/apt/sources.list.d/microsoft-prod.list ]] && [[ -f /etc/apt/trusted.gpg.d/microsoft.asc.gpg ]]
    then
        rm /etc/apt/sources.list.d/microsoft-prod.list
        curl -L "https://packages.microsoft.com/config/debian/12/prod.list" -o /etc/apt/sources.list.d/microsoft-prod.list
        cp /etc/apt/trusted.gpg.d/microsoft.asc.gpg /usr/share/keyrings/microsoft-prod.gpg
    fi

    if dpkg -l | grep -q docker-ce
    then
        find /etc/apt/ -type f -name '*.list' -exec sed -E -i 's/(deb.*?https?:\/\/.*docker\.com[^\s]+\s+)bullseye(.*)/\1bookworm\2/g' {} \;
    fi

    # Check if MongoDB key is present and update repo information accordingly
    if apt-key finger | grep -qE 'F567\s*9A22\s*2C64\s*7C87\s*527C\s*2F8C\s*B00A\s*0BD1\s*E2C6\s*3C11'
    then
        # Delete old key
        apt-key del "F5679A222C647C87527C2F8CB00A0BD1E2C63C11"
        # Add new key
        curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | apt-key add -
        # Upgrade repo
        find /etc/apt/ -type f -name '*.list' -exec sed -i 's/bullseye\/mongodb-org\/5.0/bookworm\/mongodb-org\/8.0/g' {} \;
    fi

    echo "Disabling backports repositories"
    find /etc/apt/ -type f -name '*.list' -exec sed -E -i 's/(.*backports.*)/#\1/g' {} \;

    # https://www.debian.org/releases/bullseye/amd64/release-notes/ch-upgrading.en.html#clean-up-leftover-configuration-files
    echo "Cleaning up leftover configuration files"
    find /etc -name '*.dpkg-*' -o -name '*.ucf-*' -o -name '*.merge-error' -exec rm {} \;

    echo "Running apt update"
    apt-get -y update --allow-releaseinfo-change

    echo "Performing minimal upgrade"
    apt-get --without-new-pkgs -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-confdef -y upgrade

    echo "Performing remaining upgrade steps"
    apt-get -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-confdef -y full-upgrade

    echo "Removing unnecessary packages"
    apt-get -y autoremove --purge

    removed=$(dpkg -l | awk '/^rc/ { print $2 }')
    if [[ $removed ]]
    then
        echo "Purging removed packages"
        apt purge -y $removed
    fi

    echo "Upgrade completed. Please reboot the system"
} |& tee $logFileName

ret=${PIPESTATUS[0]}
if [ $ret -ne 0 ]; then restore_backup; fi
exit $ret
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.enginsight.com/docs/knowledge-base/updates/wie-aktualisiere-ich-meine-enginsight-server-von-debian-11-auf-debian-12.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
