DEBIAN 12升級至13的流程指令步驟

cat /etc/os-release
uname -r

先把目前的12版本,更新到最新狀態:
sudo apt update
sudo apt upgrade -y
sudo apt full-upgrade -y
sudo apt autoremove –purge -y

如果過程有發現Kernel更新,那就先重開機:
sudo reboot

重開機後,檢查一下套件是不是有狀況或暫時不更新的設定:
sudo systemctl –failed
sudo dpkg –audit
sudo apt-mark showhold
#hold 的套件有找到的話,要確定當初是為什麼不要升級、和會不會影響到接下來的系統更新。

如果都沒問題,這時候若是遠端連線來操作,先跑TMUX套件保持連線:
tmux

備份12的來源:
grep -R “bookworm” /etc/apt/sources.list /etc/apt/sources.list.d/ 2>/dev/null
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bookworm.bak
修改成13的來源:
sudo sed -i ‘s/bookworm/trixie/g’ /etc/apt/sources.list
sudo sed -i ‘s/bookworm/trixie/g’ /etc/apt/sources.list.d/*.list
sudo sed -i ‘s/bookworm/trixie/g’ /etc/apt/sources.list.d/*.sources

cat /etc/apt/sources.list
理論上會是,以實際自己的設定檔為準,主要是把bookworm改成trixie:
deb http://deb.debian.org/debian trixie main contrib non-free-firmware
deb http://security.debian.org/debian-security trixie-security main contrib non-free-firmware
deb http://deb.debian.org/debian trixie-updates main contrib non-free-firmware

更改後,先更新13版本的套件清單:
sudo apt update
檢查目前的硬碟空間:
df -h
#我的經驗大概會占用1.5G的安裝檔案,每個人的系統會有所差異,先知道有多少閒置空間能用。

清單更新後,先最小套件安裝升級,過程可能會有設定檔新舊的更動,檢查看看和決定:
sudo apt upgrade –without-new-pkgs
如果都沒異常,就執行完整更新,這個步驟會比較久(在tmux環境執行的狀態比較不怕ssh中途斷線),過程可能也會有設定檔新舊的更動,檢查看看和決定:
sudo apt full-upgrade

完整升級好,先檢查一下有沒有什麼異常:
cat /etc/os-release
uname -r
sudo systemctl –failed
sudo dpkg –audit
都沒異常再來移除舊版套件:
sudo apt autoremove –purge -y

理論上,如果都沒問題,這時候重開機後應該也是要沒問題。
所以重開機完後,在確認一下系統服務和套件有沒有異常的:
sudo reboot
sudo systemctl –failed
sudo dpkg –audit

Be the first to reply

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

請輸入下列驗證碼計算後阿拉伯數字 (Translate it, if not Taiwanese to post reply) *