Содержание

Обновление Debian 11 → Debian 12

1. Проверка версии

cat /etc/os-release
cat /etc/debian_version
uname -r

2. Резервное копирование

mkdir -p /root/backup-debian11-to-12
cp -a /etc /root/backup-debian11-to-12/
cp -a /var/lib/dpkg /root/backup-debian11-to-12/
cp -a /var/lib/apt/extended_states /root/backup-debian11-to-12/
dpkg --get-selections '*' > /root/backup-debian11-to-12/dpkg-selections.txt
apt-mark showmanual > /root/backup-debian11-to-12/apt-manual.txt

3. Обновление Debian 11

apt update
apt upgrade -y
apt full-upgrade -y
apt autoremove -y
apt autoclean

4. Перезагрузка

reboot

5. Проверка репозиториев

grep -Rhv '^\s*#' /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null
apt-cache policy

6. Резервная копия sources.list

cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
mkdir -p /root/backup-debian11-to-12/sources.list.d
cp -a /etc/apt/sources.list.d /root/backup-debian11-to-12/

7. Настройка репозиториев Debian 12

cat > /etc/apt/sources.list <<'EOF'
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
EOF

8. Обновление списков пакетов

apt update

9. Минимальное обновление

apt upgrade --without-new-pkgs -y

10. Полное обновление

apt full-upgrade -y

11. Перезагрузка

reboot

12. Проверка после обновления

cat /etc/os-release
cat /etc/debian_version
uname -r
apt update
apt full-upgrade -y

13. Проверка ошибок

dpkg --audit
apt --fix-broken install
systemctl --failed
journalctl -p err -b

14. Очистка системы

apt autoremove --purge -y
apt autoclean

15. Удаление старых конфигов

dpkg -l | awk '/^rc/ {print $2}'
dpkg -l | awk '/^rc/ {print $2}' | xargs -r dpkg --purge