Debian 12 bookworm LXQt版をインストール - その2 (APT, NVIDIAドライバの設定)

前回の続き。今回はDebian 12をインストール後にした設定を書きます。

 

目次

 

 

今回作業したノートPCのスペックは以下。

 

APTの設定

  1. パネル (Windowsでいうタスクバー) からQTerminalを開く。


  2. ターミナルからVimをインストール。以下のコマンドを実行。

    sudo apt update
    sudo apt install vim



  3. ターミナルで

    sudo vim /etc/apt/source.list

    を実行し、 /etc/apt/source.list を以下のように編集。

    deb http://deb.debian.org/debian/ bookworm main non-free-firmware non-free contrib
    deb-src http://deb.debian.org/debian/ bookworm main non-free-firmware non-free contrib

    deb http://security.debian.org/debian-security bookworm-security main non-free-firmware non-free contrib
    deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware non-free contrib

    deb http://deb.debian.org/debian/ bookworm-updates main non-free-firmware non-free contrib
    deb-src http://deb.debian.org/debian/ bookworm-updates main non-free-firmware non-free contrib



  4. リポジトリを再び更新する。

    sudo apt update

 

 

NVIDIAドライバのインストール

  1. 以下のコマンドでインストール。

    sudo apt update
    sudo apt install nvidia-driver firmware-misc-nonfree



  2. インストールが終わったら再起動し、以下のコマンドを実行。

    nvidia-smi

    以下のようなログが出ればOK.



  3. ドライバの導入自体はこれで完了。
    しかし、筆者の環境ではドライバ導入後もNVIDIAGPUが使用されていなかった。調べたところ、NVIDIAGPUには NVIDIA Optimus という、NVIDIAGPUと、CPUの内蔵GPUを切り替えて使用する機能があるのだが、どうも Debian 12 向けのNVIDIAドライバだとその辺が上手く自動設定されず、CPUの内蔵グラフィックスのみが使用されてしまうみたい。
    この問題については、 X.org を手動設定することで解決できた。

    1. xrandr, x11-xserver-utils をインストール。

      sudo apt install xrandr x11-xserver-utils


    2. /etc/X11/xorg.conf を編集。

      sudo vim /etc/X11/xorg.conf

      以下の文字列を追加。

      Section "ServerLayout"
          Identifier "layout"
          Screen 0 "nvidia"
          Inactive "intel"
      EndSection

      Section "Device"
          Identifier "nvidia"
          Driver "nvidia"
          BusID "PCI:1:0:0"
      EndSection

      Section "Screen"
          Identifier "nvidia"
          Device "nvidia"
          Option "AllowEmptyInitialConfiguration"
      EndSection

      Section "Device"
          Identifier "intel"
          Driver "modesetting"
          BusID "PCI:0:2:0"
          #Option "AccelMethod" "none"
      EndSection

      Section "Screen"
          Identifier "intel"
          Device "intel"
      EndSection


    3. SDDM (LXQtの標準ディスプレイマネージャ) のセットアップ時に実行されるコマンドを編集。

      sudo vim /usr/share/sddm/scripts/Xsetup

      /usr/share/sddm/scripts/Xsetup の最後尾に以下の文字列を追加。

      xrandr --setprovideroutputsource modesetting NVIDIA-0
      xrandr --auto
      xrandr --dpi 96



    上記の設定を終え、再起動するとNVIDIAGPUが使用されるようになった。

    参考 : 

    https://wiki.debian.org/NVIDIA%20Optimus#Using_NVIDIA_GPU_as_the_primary_GPU