Try   HackMD

Ubuntu 升版須知

Prerequisites

  1. 確認 Ubuntu 版本
    lsb_release -a

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

  2. 確認 packages 皆已為最新版

    ​​​​sudo apt update ​​​​sudo apt upgrade ​​​​sudo reboot
  3. 確認 netplan 網卡已設定完成

Upgrade steps

Reference: https://ubuntu.com/server/docs/how-to-upgrade-your-release

  1. 進行升版

    ​​​​sudo do-release-upgrade
  2. 詢問是否繼續時停下,仔細看是否有無問題,尤其注意更新後是否會造成系統不正常
    可按下 d 來看 detail

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

    • 注意套件是否有對應 version,尤其是 No candidate ver: xxx 的套件是否正常
      • CUDA
      • Nvidia driver
      • 等等
  3. 遇到 version conflict 時,請一律都用 D 檢查更動部分,如無問題,則以 maintainer version 為主

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

  4. 如被詢問 unattended-upgrades 設定,請選擇 No

    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

  5. 升級完後 reboot

Post-upgrade steps

Outline

  • 更新 apt repo version

CUDA

  1. 刪除舊的 CUDA apt repo (20.04)
    ​​​​sudo rm /etc/apt/sources.list.d/cuda-ubuntu2004-x86_64.list*
  2. 重新下載安裝 CUDA apt repo (22.04)
    ​​​​wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb ​​​​sudo dpkg -i cuda-keyring_1.1-1_all.deb
  3. 更新 CUDA keyring
    ​​​​sudo apt update ​​​​# (如果需要) ​​​​sudo apt upgrade

Docker engine (二擇一執行)

重新執行 Docker 第一項安裝步驟,將 apt repo 覆蓋,from focal to jammy

# Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update

Manual

將 focal 取代成 jammy

# 確認是否正確 sed 's/focal/jammy/g' /etc/apt/sources.list.d/docker.list # 直接取代 sed -i 's/focal/jammy/g' /etc/apt/sources.list.d/docker.list

Git-LFS (二擇一執行)

Official (recommended)

重新執行 Git-LFS 安裝步驟,將 apt repo 覆蓋,from focal to jammy
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash

Manual

將 focal 取代成 jammy

# 確認是否正確 sed 's/focal/jammy/g' /etc/apt/sources.list.d/github_git-lfs.list # 直接取代 sed -i 's/focal/jammy/g' /etc/apt/sources.list.d/github_git-lfs.list

停止 Unattended-Upgrades 套件

sudo systemctl disable --now unattended-upgrades sudo nano /etc/apt/apt.conf.d/20auto-upgrades # 把這行 APT::Periodic::Unattended-Upgrade "1"; 改成 "0"