Wednesday, August 30, 2023

Install Cuda Toolkit 11.8 & Realtek wifi 8852ce on Ubuntu 20.04

Nvidia driver & Cuda

- ubuntu clean install, with "download additional drivers" option marked

(otherwise we get a black screen right after installation, even though we use onboard vga in case of a Supermicro MB);

- update ubuntu, reboot;

$ sudo apt update
$ sudo reboot

- install needed packages;

$ sudo apt install mc, ssh, make, gcc, g++, build-essential

- strongly recommended - switch from console to ssh via another pc, to avoid any black screen issues and loss of display;

- exit graphical interface, otherwise installer will fail;

$ sudo init 3

- remove any nvidia drivers and/or cuda version that were/if were installed;

$ sudo apt purge nvidia*
$ sudo apt remove nvidia-*
$ sudo apt autoremove && sudo apt clean
$ sudo rm /etc/apt/sources.list.d/cuda*
$ sudo rm -rf /usr/local/cuda*

source:

https://gist.github.com/MihailCosmin/affa6b1b71b43787e9228c25fe15aeba


- (in some cases) remove the nouveau driver

$ sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
$ sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf" 
$ cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
blacklist nouveau
options nouveau modeset=0
$ sudo update-initramfs -u
$ sudo reboot

- download and install Nvidia driver (run file)

$ wget https://us.download.nvidia.com/XFree86/Linux-x86_64/535.104.05/NVIDIA-Linux-x86_64-535.104.05.run
$ sudo sh NVIDIA-Linux-x86_64-535.104.05.run

- download and install Cuda toolkit 11.8 (run file)

$ wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
 $ sudo sh cuda_11.8.0_520.61.05_linux.run

- options to install - unmark the nvidia driver, in case you have another version installed;

- You may get a warning at the end about the nvidia driver version, but the installation should succeed;

- quoted from Cuda postinstall instructions;

Please make sure that

 -   PATH includes /usr/local/cuda-11.8/bin

 -   LD_LIBRARY_PATH includes /usr/local/cuda-11.8/lib64, or, add /usr/local/cuda-11.8/lib64 to /etc/ld.so.conf and run ldconfig as root

- follow the postinstall instructions above and add the path lines to "/home/user/.bashrc"; (replace user with your username);

 $ nano /home/user/.bashrc

- add the lines at the end of the file and save the changes;

export PATH="/usr/local/cuda-11.8/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH"

- reboot;

- check Cuda version;

 $ nvcc --version
###################################################################################
##################### Latest experience with Supermicro+Nvidia ##########################
##################################################################################
After Ubuntu install (20.04, 22.04, even 24.04) with the monitor connected to Aspeed VGA onboard, might encounter black display at the login screen or stuck in Supermicro logo even though  the OS is fully booted and working.
The solution: 
 - blacklist the nouveau driver, 
 - enable nomodeset in the grub configuration 
 -> during post with editing the grub parameters
 ---> add "nomodeset" near "quiet splash"
 --->Save and boot F10 or Ctrl+X
 -> after boot through ssh or console, edit the /etc/default/grub file
 ---> add "nomodeset" near "quiet splash" 
 ---> run update-grub and reboot
 - enable nvidia proprietary driver from the "Additional drivers"
 - reboot
-----------------------------------------------------------------------------------------------------------------------------

Realtek 8852ce Wifi driver
source 


- remove the ineffective driver:

sudo dkms remove rtl88x2ce/35403 --all

- install the correct driver:

sudo apt install --reinstall git bc
git clone https://github.com/lwfinger/rtw89.git
cd rtw89
make
sudo make install

- You will probably need to disable Secure Boot. Reboot. (didn't check, it worked without it)

When your kernel version changes, then you need to do the following:

cd ~/rtw89
git pull
make clean
make
sudo make install

EDIT: Let’s load the required firmware:

cd /usr/lib/firmware/
sudo mkdir rtw89
sudo wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/rtw89/rtw8852c_fw.bin