1. 背景

いつものようにエンコードしようとすると、ゼロバイトのファイルができるだけでエンコードできません。

nvidia-smiすると、以下のメッセージが表示されました。「ドライバーとライブラリのバージョンが一致していない」という意味です。

Failed to initialize NVML: Driver/library version mismatch
NVML library version: 550.144
fallback

このままだと動画のエンコードができないため、困ります。

この記事はライムライとドライバをアップデートしたので、その記録です。

2. 情報を記録

サーバは以下のようになっています。

cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
bash

ビデオカードの確認。GeForce GTX 1650を確認できます。そろそろAIに強いものに変更したい。

 lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation TU116 [GeForce GTX 1650] (rev a1)
01:00.1 Audio device: NVIDIA Corporation TU116 High Definition Audio Controller (rev a1)
01:00.2 USB controller: NVIDIA Corporation TU116 USB 3.1 Host Controller (rev a1)
01:00.3 Serial bus controller: NVIDIA Corporation TU116 USB Type-C UCSI Controller (rev a1)
fallback

以下をみると、driver : nvidia-driver-570 - third-party non-free recommendedがおすすめなようです。

ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00002188sv00001462sd00008D97bc03sc00i00
vendor   : NVIDIA Corporation
model    : TU116 [GeForce GTX 1650]
manual_install: True
driver   : nvidia-driver-555 - third-party non-free
driver   : nvidia-driver-470-server - distro non-free
driver   : nvidia-driver-470 - distro non-free
driver   : nvidia-driver-535 - third-party non-free
driver   : nvidia-driver-550 - third-party non-free
driver   : nvidia-driver-515 - third-party non-free
driver   : nvidia-driver-450-server - distro non-free
driver   : nvidia-driver-535-server - distro non-free
driver   : nvidia-driver-565-open - third-party non-free
driver   : nvidia-driver-535-open - distro non-free
driver   : nvidia-driver-565 - third-party non-free
driver   : nvidia-driver-525 - third-party non-free
driver   : nvidia-driver-535-server-open - distro non-free
driver   : nvidia-driver-545 - third-party non-free
driver   : nvidia-driver-570-open - third-party non-free
driver   : nvidia-driver-570 - third-party non-free recommended
driver   : nvidia-driver-545-open - distro non-free
driver   : nvidia-driver-520 - third-party non-free
driver   : nvidia-driver-570-server - distro non-free
driver   : nvidia-driver-560 - third-party non-free
driver   : nvidia-driver-555-open - third-party non-free
driver   : nvidia-driver-570-server-open - distro non-free
driver   : nvidia-driver-550-open - third-party non-free
driver   : nvidia-driver-560-open - third-party non-free
driver   : xserver-xorg-video-nouveau - distro free builtin
fallback

nvidia-container-toolkitのバージョンも確認。

参考Installing the NVIDIA Container Toolkit — NVIDIA Container Toolkit

nvidia-container-toolkit -versionします。1.17.4が入ってます。

nvidia-container-toolkit -version
NVIDIA Container Runtime Hook version 1.17.4
commit: 9b69590c7428470a72f2ae05f826412976af1395
bash

3. 手順

sudo add-apt-repository ppa:graphics-drivers/ppaでリポジトリをアップデート

sudo add-apt-repository ppa:graphics-drivers/ppa
PPA publishes dbgsym, you may need to include 'main/debug' component
リポジトリ: 'deb https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu/ jammy main'
概要:
Fresh drivers from upstream, currently shipping Nvidia.

## Current releases

Current production branch release: 550.107.02
Current new feature branch release: 555.58.02
Current beta release: 560.28.03

## Legacy releases

470.256.02 (x86_64) - GKxxx “Kepler” GPUs
390.157 (x86 / x86_64 / ARM) - GF1xx “Fermi” GPUs (*​)
340.108 (x86 / x86_64) - GeForce 8 and 9 series GPUs (*​)
304.137 (x86 / x86_64) - GeForce 6 and 7 series GPUs (*​)
173.14.39 (x86 / x86_64) - GeForce 5 series GPUs (*​)
96.43.23 (x86 / x86_64) - GeForce 2 through GeForce 4 series GPUs (*​)
71.86.15 (x86 / x86_64) - Riva TNT, TNT2, GeForce, and some GeForce 2 GPUs (*​)
(*​) These releases are no longer being maintained. Please see Support timeframes for Unix legacy GPU releases for more details. https://nvidia.custhelp.com/app/answers/detail/a_id/3142

## What we're working on right now:

- Normal driver updates
- Help Wanted: Mesa Updates for Intel/AMD users, ping us if you want to help do this work, we're shorthanded.

## WARNINGS:

This PPA is currently in testing, you should be experienced with packaging before you dive in here:

Volunteers welcome!

### How you can help:

## Install PTS and benchmark your gear:

    sudo apt-get install phoronix-test-suite

Run the benchmark:

    phoronix-test-suite default-benchmark openarena xonotic tesseract gputest unigine-valley

and then say yes when it asks you to submit your results to openbenchmarking.org. Then grab a cup of coffee, it takes a bit for the benchmarks to run. Depending on the version of Ubuntu you're using it might preferable for you to grabs PTS from upstream directly: http://www.phoronix-test-suite.com/?k=downloads

## Share your results with the community:

Post a link to your results (or any other feedback to): https://launchpad.net/~graphics-drivers-testers

Remember to rerun and resubmit the benchmarks after driver upgrades, this will allow us to gather a bunch of data on performance that we can share with everybody.

If you run into old documentation referring to other PPAs, you can help us by consolidating references to this PPA.

If someone wants to go ahead and start prototyping on `software-properties-gtk` on what the GUI should look like, please start hacking!

## Help us Help You!

We use the donation funds to get the developers hardware to test and upload these drivers, please consider donating to the "community" slider on the donation page if you're loving this PPA:

http://www.ubuntu.com/download/desktop/contribute
より詳しい情報: https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
リポジトリを追加しています。

追加するかを確認されるので、追加すると

Found existing deb entry in /etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-jammy.list
Adding deb entry to /etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-jammy.list
Found existing deb-src entry in /etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-jammy.list
Adding key to /etc/apt/trusted.gpg.d/graphics-drivers-ubuntu-ppa.gpg with fingerprint 2388FF3BE10A76F638F80723FCAE110B1118213C
ヒット:1 https://deb.nodesource.com/node_21.x nodistro InRelease
ヒット:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  InRelease                                                              
ヒット:3 https://download.docker.com/linux/ubuntu jammy InRelease                                                                                           
ヒット:4 https://nvidia.github.io/libnvidia-container/stable/deb/amd64  InRelease                                                                           
取得:5 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]                                                                                  
ヒット:6 http://jp.archive.ubuntu.com/ubuntu jammy InRelease                                                                 
取得:7 http://jp.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]                                                   
ヒット:8 https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease                                           
取得:9 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [43.0 kB]
取得:10 http://jp.archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]                                             
ヒット:11 https://ppa.launchpadcontent.net/longsleep/golang-backports/ubuntu jammy InRelease   
取得:12 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 DEP-11 Metadata [208 B]
取得:13 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [126 kB]
取得:14 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 DEP-11 Metadata [208 B]       
取得:15 http://jp.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2,378 kB]
取得:16 http://jp.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [765 kB]
取得:17 http://jp.archive.ubuntu.com/ubuntu jammy-updates/main amd64 DEP-11 Metadata [103 kB]
取得:18 http://jp.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 DEP-11 Metadata [212 B]
取得:19 http://jp.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [760 kB]
取得:20 http://jp.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,193 kB]
取得:21 http://jp.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 DEP-11 Metadata [359 kB]
取得:22 http://jp.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 DEP-11 Metadata [940 B]
取得:23 http://jp.archive.ubuntu.com/ubuntu jammy-backports/main amd64 DEP-11 Metadata [7,048 B]
取得:24 http://jp.archive.ubuntu.com/ubuntu jammy-backports/restricted amd64 DEP-11 Metadata [212 B]
取得:25 http://jp.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 DEP-11 Metadata [17.7 kB]
取得:26 http://jp.archive.ubuntu.com/ubuntu jammy-backports/multiverse amd64 DEP-11 Metadata [212 B]
6,137 kB を 3秒 で取得しました (2,071 kB/s)                       
パッケージリストを読み込んでいます... 完了
bash

4. apt updateとupgrade

sudo apt updateします。

ヒット:1 https://nvidia.github.io/libnvidia-container/stable/deb/amd64  InRelease
ヒット:2 https://deb.nodesource.com/node_21.x nodistro InRelease                                                                                            
ヒット:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  InRelease                                                              
ヒット:4 https://download.docker.com/linux/ubuntu jammy InRelease                                                                                           
ヒット:5 http://security.ubuntu.com/ubuntu jammy-security InRelease                                                                                         
ヒット:6 http://jp.archive.ubuntu.com/ubuntu jammy InRelease                                                                                                
ヒット:7 http://jp.archive.ubuntu.com/ubuntu jammy-updates InRelease                         
ヒット:8 http://jp.archive.ubuntu.com/ubuntu jammy-backports InRelease
ヒット:9 https://ppa.launchpadcontent.net/graphics-drivers/ppa/ubuntu jammy InRelease
ヒット:10 https://ppa.launchpadcontent.net/longsleep/golang-backports/ubuntu jammy InRelease
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
状態情報を読み取っています... 完了        
アップグレードできるパッケージが 55 個あります。表示するには 'apt list --upgradable' を実行してください。
bash

sudo apt upgradeをします。

そして、再起動。

nvidia-smiすると、こんな感じで表示されるようになりました。

Sun Mar  9 08:32:54 2025       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.144.03             Driver Version: 550.144.03     CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1650        Off |   00000000:01:00.0 Off |                  N/A |
| 30%   36C    P0             19W /   75W |      30MiB /   4096MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A       923      G   /usr/lib/xorg/Xorg                             22MiB |
|    0   N/A  N/A      1236      G   /usr/bin/gnome-shell                            3MiB |
|    0   N/A  N/A      1785      G   /usr/libexec/gnome-initial-setup                1MiB |
+-----------------------------------------------------------------------------------------+
fallback

5. ドライバーもアップデートする

ついでに、ドライバーもアップデートします。

nvidia-driver-570がおすすめされていたので、これを入れます。

sudo apt install -y nvidia-driver-570
bash

アップデートされました。

nvidia-smi
Sun Mar  9 10:48:10 2025       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.124.06             Driver Version: 570.124.06     CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1650        Off |   00000000:01:00.0 Off |                  N/A |
| 30%   34C    P8              4W /   75W |      27MiB /   4096MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A             966      G   /usr/lib/xorg/Xorg                       19MiB |
|    0   N/A  N/A            1254      G   /usr/bin/gnome-shell                      3MiB |
|    0   N/A  N/A            1722      G   /usr/libexec/gnome-initial-setup          2MiB |
+-----------------------------------------------------------------------------------------+
fallback

6. 課題

録画終了後の自動エンコードが動かなくなりました。。。

なんとしないと。