###### tags: `tutorials` `linux` `ubuntu` `GPU` `Intel integrated graphics` # 將 Linix 桌面 GUI 使用 Intel 內顯,而非獨立 nvidia 顯卡的方式 ## 檢視系統內所有顯示卡 ```bash= ! $ lspci | grep "VGA" ``` ## 修改 `/etc/X11/xorg.conf` (不存在則新增) ```bash= ! $ sudo vim /etc/X11/xorg.conf ``` :::warning 這裡使用 `vim` 編輯,若不存在會自動建立 ::: - 內容應類似於以下文件 ```= ! Section "ServerLayout" Identifier "layout" Screen 0 "intel" Screen 1 "nvidia" EndSection Section "Device" Identifier "intel" Driver "intel" BusID "PCI:0@0:2:0" Option "AccelMethod" "SNA" EndSection Section "Screen" Identifier "intel" Device "intel" EndSection Section "Device" Identifier "nvidia1" Driver "nvidia" BusID "PCI:1@0:0:0" Option "ConstrainCursor" "off" EndSection Section "Device" Identifier "nvidia2" Driver "nvidia" BusID "PCI:2@0:0:0" Option "ConstrainCursor" "off" EndSection Section "Screen" Identifier "nvidia" Device "nvidia1" Option "AllowEmptyInitialConfiguration" "on" Option "IgnoreDisplayDevices" "CRT" EndSection ``` - `Section`: 定義一個區塊,後面接上區塊類型 - `ServerLayout`: 系統設定顯示 - `Screen`: 螢幕顯示區塊 - `Device`: 顯示卡裝置 - `Identifier`: 定義區塊名稱 - `Driver`: 裝置驅動 - `BusID`: 是裝在主機的哪個插槽(`lspci | grep "VGA"` 裡的資訊) - `Option`: 特殊設定選項 :::info 文件解釋 - 有 3 個顯示卡裝置 - 插在 `PCI:0@0:2:0`,driver 使用 `intel driver`,名為 `intel` (`7`~`12` 行) - 插在 `PCI:1@0:0:0`,driver 使用 `nvidia driver`,名為 `nvidia1` (`19`~`24` 行) - 插在 `PCI:2@0:0:0`,driver 使用 `nvidia driver`,名為 `nvidia2` 的裝置 (`26`~`31` 行) - 有 2 個螢幕裝置設定 - 使用 `intel` 顯示卡,名為 `intel` 的螢幕裝置設定 (`14`~`17` 行) - 使用 `nvidia1` 顯示卡,名為 `nvidia` 的螢幕裝置設定 (`33`~`38` 行) - 實體螢幕設定 - `0` 號螢幕使用名為 `intel` 的螢幕裝置設定 (第 `3` 行) - `1` 號螢幕使用名為 `nvidia` 的螢幕裝置設定 (第 `4` 行) ::: :::warning 不想讓顯卡跑桌面程式就把所有和 `nvidia` 有關的內容都刪掉 > 以範例為例,也就是將文件改為 > ```= > Section "ServerLayout" > Identifier "layout" > Screen 0 "intel" > EndSection > > Section "Device" > Identifier "intel" > Driver "intel" > BusID "PCI:0@0:2:0" > Option "AccelMethod" "SNA" > EndSection > > Section "Screen" > Identifier "intel" > Device "intel" > EndSection > ``` ::: ## 重新開機使其生效 ```bash= ! $ sudo reboot now ``` :::warning 重新開機後可以使用 `nvidia-smi` 指令檢視顯卡是否還有執行桌面 GUI 程式 ::: # Issue {%hackmd @jimmy801/nv_login_loop %} {%hackmd @jimmy801/no_screen %}