Install Zorin 15.3 OS on Macbook Pro (Mid 2010)
Tags: ubuntu, macbookpro, nvidia
Published: 2022-05-03 21:11:49

## Why Install Zorin OS 15.3, you ask? 

Let me tell you why. After a week of agonising hit and trial methodologies and following countless tutorials/threads including very promising ones like this one - https://www.if-not-true-then-false.com/2021/debian-ubuntu-linux-mint-nvidia-guide/

I stumbled upon the following article https://jeremy.geek.nz/2021/08/23/using-legacy-nvidia-gpus-in-ubuntu-20-04/ explaining the fact the NVidia 340.108 is only supported by the linux kernel version `5.4.x`. 

The question why this specific version, that is because the Mid 2010 Macbook Pro comes with NVidia GeForce 320M graphics card. The only driver that supports this card it the NVidia 340.108 other than the default non performant open source nouveau x drivers.

I started looking around for a good distro that support kernel version `5.4.x`and to my delight I found Ubuntu 18.04 LTS supports this kernel and will continue to do so till 2028. This implies if all goes to plan my Mid 2010 can still be useful.

This also means that the steps mentioned here should be applciable not just for Zorin OS 15.3 but also for other Ubuntu 18.04 based distros as well.

## Download the required OS

In case you want to continue with the Zorin OS, you can download 15.3 version from [here](https://zorin.com/os/download/15/core/64/). Download the iso image and burn it to a USB using tool like [Etcher](https://www.balena.io/etcher/). 

## Install Zorin OS

Once you have the OS burned plug the USB to the Mac book you want to install it on and restart the machine. As the machine boots up press the `Option`/`alt` key to get boot device seletion screen. Choose the module on which you have burned the Zorin image recently. The key point here is to uncheck the following options on the `Updates and other software` screen - 

* Other options
 * Download updates while installing ubuntu
 * Install third-party software for graphics and wi-fi hardware and additional media formats.

Proceed with the installation as usual.

## Post installation steps

Once the installation is completed and you are logged in to the newly installed OS. Perform the following tasks without restarting the machine - 

* Install all the updates, this can be done graphically or via CLI ensuring you `DO NOT REBOOT` the system
* Setup the PCI-E bus identifiers. For this task you can follow [this](https://askubuntu.com/questions/264247/proprietary-nvidia-drivers-with-efi-on-mac-to-prevent-overheating/613573#613573) thread for creating the `/etc/grub/01_enable_vga.conf` file, but `DO NOT REBOOT` your system.
* Check to see if the OS recognizes the underlying hardware using the following command - `sudo ubuntu-drivers devices`. The output of the command should look something like this - 

```shell
== /sys/devices/pci0000:00/0000:00:17.0/0000:04:00.0 ==
modalias : pci:v000010DEd000008A0sv0000106Bsd000000C2bc03sc00i00
vendor   : NVIDIA Corporation
model    : MCP89 [GeForce 320M]
driver   : nvidia-340 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

== /sys/devices/pci0000:00/0000:00:15.0/0000:02:00.0 ==
modalias : pci:v000014E4d0000432Bsv0000106Bsd0000008Dbc02sc80i00
vendor   : Broadcom Limited
model    : BCM4322 802.11a/b/g/n Wireless LAN Controller (AirPort Extreme)
driver   : bcmwl-kernel-source - distro non-free
```

> I had a hard time with Ubuntu 22.04 to get the output where the OS recognizes the NVidia card using the above command, even after installing the `patched` version of the NVidia GeForce 320M 340.108 drivers with kernel version `5.15` or `5.17`.

* Install `Additional Drivers` using the GUI or CLI - `sudo ubuntu-drivers autoinstall`, once again `DO NOT REBOOT` the system post-installation.
* The next steps are taken from the post [here](https://forums.developer.nvidia.com/t/black-screen-after-install-of-nvidia-driver-ubuntu/109312/2). 
 * Install nvidia-prime - `sudo apt install --reinstall nvidia-prime`
 * Switch to nvidia - `sudo prime-select nvidia`

> NOTE: I did not remove the stray blacklist files as specified in the article, if you get the black screen after all then please follow all the instructions.

* Finally run the following command to generate the xconfig file - `sudo nvidia-xconfig`
* At this point please reboot your machine

## Moment of truth

Ideally if all goes well, you should be greeted to your OS login or desktop screen without any issues. You can run the following command to see if everthing is working as expected - 

```shell
nvidia-smi
Tue May  3 16:44:05 2022
+------------------------------------------------------+
| NVIDIA-SMI 340.108    Driver Version: 340.108        |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce 320M        Off  | 0000:04:00.0     N/A |                  N/A |
| N/A   51C   P12    N/A /  N/A |    181MiB /   252MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Compute processes:                                               GPU Memory |
|  GPU       PID  Process name                                     Usage      |
|=============================================================================|
|    0            Not Supported                                               |
+-----------------------------------------------------------------------------+
```

![Nvidia-Settings-Post-Driver-Install](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gywx7f3oxokohmonu7ed.png)

I hope this article helps someone who is also trying to increase the life of their mac books.