最後更新: 2022-12-28
目錄
- Check Version
- 6 to 7
- 7 to 8
- 8 to 9 (Stretch)
- 9 to 10 (buster)
- 10 to 11
Check Version
# 查看當前系統 Version
cat /etc/debian_version
10.13
6 to 7
# Go to last version first
apt-get update
apt-get upgrade
# Modify sources.list
Update the sources: /etc/apt/sources.list
deb http://ftp.jp.debian.org/debian wheezy main contrib non-free deb http://ftp.jp.debian.org/debian wheezy-updates main contrib non-free
# Perform a minimal upgrade
apt-get update
apt-get upgrade
# Complete system upgrade (apt-get dist-upgrade)
# -d, --download-only
apt-get dist-upgrade -d
apt-get dist-upgrade
Remark
"dist-upgrade" a "smart" conflict resolution system,
and it will attempt to upgrade the most important packages at the expense of less important ones if necessary.
So, dist-upgrade command may remove some packages.
# Cleanup
apt-get autoremove
7 to 8
# 修改 /etc/apt/sources.list
# Change the instances of “wheezy” to “jessie”
deb http://ftp.hk.debian.org/debian/ jessie main contrib deb http://security.debian.org/ jessie/updates main contrib # jessie-updates, previously known as 'volatile' deb http://debian.mirror.uber.com.au/debian/ jessie-updates main contrib
You can either use “jessie” or “stable”, as Debian 8 Jessie is now the current stable version as of writing.
但不建議用 stable, 因為 9 一出那會唔小心 upgrade 左
8 to 9 (Stretch)
# update sources.list
sed -i 's/jessie/stretch/g' /etc/apt/sources.list
apt-get update
apt-get upgrade
apt-get dist-upgrade -d
apt-get dist-upgrade
Troubleshoot
[1]
Preconfiguring packages ... (Reading database ... 129816 files and directories currently installed.) Preparing to unpack .../texlive-fonts-recommended-doc_2016.20170123-5_all.deb ... Unpacking texlive-fonts-recommended-doc (2016.20170123-5) over (2012.20120611-5+deb7u1) ... dpkg: error processing archive /var/cache/apt/archives/texlive-fonts-recommended-doc_2016.20170123-5_all.deb (--unpack): trying to overwrite '/usr/share/doc/texlive-doc/fonts/ec/00bugs.txt', which is also in package texlive-latex-recommended-doc 2012.20120611-5+deb7u1 dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/texlive-fonts-recommended-doc_2016.20170123-5_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
Solution
# 找出要 remove 的 Package
dpkg -l | grep texlive-
# remove "dpkg -l" 找出來的 package
dpkg --force-all --purge ?
9 to 10 (buster)
修改 /etc/apt/sources.list
sed -i 's/stretch/buster/g' /etc/apt/sources.list
deb http://ftp.debian.org/debian buster main contrib non-free deb http://ftp.debian.org/debian buster-updates main contrib non-free deb http://security.debian.org/debian-security buster/updates main contrib non-free
apt-get update
apt-get upgrade
# -d, --download-only 因為有很多 package 要下載
apt-get dist-upgrade -d -y
apt-get dist-upgrade
10 to 11
apt-mark showhold
修改 /etc/apt/sources.list
buster -> bullseye
buster/updates -> bullseye-security
結果
deb http://deb.debian.org/debian bullseye main contrib non-free deb http://deb.debian.org/debian bullseye-updates main contrib non-free deb http://security.debian.org/debian-security bullseye-security main deb http://ftp.debian.org/debian bullseye-backports main contrib non-free
apt-get clean
apt update
apt upgrade
apt-get dist-upgrade -d -y
apt-get dist-upgrade
reboot
apt-get autoremove --purge