ROSをインストールしてたUbuntu 18.04を20.04にアップグレードする
ROS Melodic/DashingをインストールしてたUbuntu 18.04のGPU搭載ノートPCを20.04にアップグレードしたので手順をメモしておきます。
環境
GPUのドライバはPPA (Personal Package Archives)のものをインストールしています。
手順
OSを更新
ソフトウェアアップデートを先に済ませておきます
sudo apt update sudo apt upgrade sudo apt install update-manager-core
ソフトウェアアップデートの設定を"LTS"にしておきます
$ cat /etc/update-manager/release-upgrades # Default behavior for the release upgrader. [DEFAULT] # Default prompting and upgrade behavior, valid options: # # never - Never check for, or allow upgrading to, a new release. # normal - Check to see if a new release is available. If more than one new # release is found, the release upgrader will attempt to upgrade to # the supported release that immediately succeeds the # currently-running release. # lts - Check to see if a new LTS release is available. The upgrader # will attempt to upgrade to the first LTS release available after # the currently-running one. Note that if this option is used and # the currently-running release is not itself an LTS release the # upgrader will assume prompt was meant to be normal. Prompt=lts
ROSを削除し、ディストリビューション更新にあわせてパッケージを更新、そして使わないパッケージを削除します
sudo apt remove "ros-*" sudo apt dist-upgrade sudo apt autoremove
ディストリビューションを更新します
sudo do-release-upgrade
再起動を促されるので再起動します
aptのデータ参照元定義(sources.list
)を更新
do-release-upgrade
の途中でコメントアウトされたものを確認します。
これらを1つずつ修正してapt update
ができるかを確認します。
$ grep "focal" /etc/apt/sources.list.d/* /etc/apt/sources.list.d/danielrichter2007-ubuntu-grub-customizer-bionic.list:# deb http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu focal main # disabled on upgrade to focal /etc/apt/sources.list.d/docker.list: deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable # disabled on upgrade to focal /etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-bionic.list:# deb http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu focal main # disabled on upgrade to focal /etc/apt/sources.list.d/gyazo_gyazo-for-linux.list:# deb https://packagecloud.io/gyazo/gyazo-for-linux/ubuntu/ focal main # disabled on upgrade to focal /etc/apt/sources.list.d/gyazo_gyazo-for-linux.list:# deb-src https://packagecloud.io/gyazo/gyazo-for-linux/ubuntu/ focal main # disabled on upgrade to focal /etc/apt/sources.list.d/nvidia-docker.list:# deb https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/$(ARCH) / # disabled on upgrade to focal /etc/apt/sources.list.d/nvidia-docker.list:# deb https://nvidia.github.io/nvidia-container-runtime/ubuntu18.04/$(ARCH) / # disabled on upgrade to focal /etc/apt/sources.list.d/nvidia-docker.list:# deb https://nvidia.github.io/nvidia-docker/ubuntu18.04/$(ARCH) / # disabled on upgrade to focal /etc/apt/sources.list.d/ubuntu-ja.list:# deb http://archive.ubuntulinux.jp/ubuntu focal main # disabled on upgrade to focal /etc/apt/sources.list.d/ubuntu-ja.list:# deb-src http://archive.ubuntulinux.jp/ubuntu focal main # disabled on upgrade to focal /etc/apt/sources.list.d/ubuntu-ja.list:# deb http://archive.ubuntulinux.jp/ubuntu-ja-non-free focal multiverse # disabled on upgrade to focal /etc/apt/sources.list.d/ubuntu-ja.list:# deb-src http://archive.ubuntulinux.jp/ubuntu-ja-non-free focal multiverse # disabled on upgrade to focal /etc/apt/sources.list.d/vscode.list:# deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main # disabled on upgrade to focal
ついでにサードパーティ製のソフトウェアでリポジトリ鍵が必要なものについて、apt-key
コマンドでGPG公開鍵を追加していたものについてはインストール方法が変わっているはずなので確認しておきます。
たとえばROS 2の/etc/apt/sources.list.d/ros2-latest.list
についてはドキュメントの更新内容にあわせて以下のように修正しました。
-deb [arch=amd64] http://packages.ros.org/ros2/ubuntu bionic main +deb [arch=amd64 signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu bionic main
同様にしてDockerもドキュメントが修正されているのでsources.list
もそれに合わせて修正します。
apt-key
コマンドが非推奨となった件は以下の記事が詳しいです。
メモ
CUDAドライバについて
$ dpkg -l | grep nvidia-
でドライバのバージョンを確認したところ、do-release-upgrade
実行後はnvidia-driver-460 (460.91.03-0ubuntu0.18.04.1)
がnvidia-driver-460 (460.91.03-0ubuntu0.20.04.1)
に入れ替わっていました。
PPAでドライバを追加していたため、自動で合うバージョンがインストールされたのだと思います。
その他
apt autoremove
を実行する前にdo-release-upgrade
を実行すると以下のようなエラーが出ました。
(※apt autoremove
後にdo-release-upgrade
を実行したら解決しました)
Could not calculate the upgrade An unresolvable problem occurred while calculating the upgrade. This can be caused by: * Upgrading to a pre-release version of Ubuntu * Running the current pre-release version of Ubuntu * Unofficial software packages not provided by Ubuntu If none of this applies, then please report this bug using the command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal.
$ grep Broken grep Broken /var/log/dist-upgrade/apt.log