Ubuntu 21.04 on Mac Book Pro 11.1
Tags: ubuntu, macbookpro, linux, tutorial
Published: 2021-08-29 16:34:11

## Expect the unexpected...

Let's start this by revisit macos [Big Sur](https://www.apple.com/macos/big-sur/) oldest supported device. MacBook Pro (Retina, 13-inch, Late 2013) is one of them. Yet, I try to install it on my device a month ago, bugs exist but not stop the device to work; after a while I turn off the device. 

There are bugs that I cannot mitigate, one of them is (turn on) File Vault made my device fails to login. I've tried reset SMC, PRAM/NVRAM, even reset password from iCloud. Yes, there will be workaround like reinstall macos and disable File Vault after that or revert them using Time Machine. Note, this is the reason why you should backup your files before upgrade your OS.

I prefer install Linux at the point that no workaround left for me. I didn't backup my previous OS using Time Machine and important files already on my external disk. I choose Ubuntu because the server and container project use the same distro. One environment less maintenance burden.


## Boot Issue

Skip the install process, because we already feed by amount of tutorial before decided to install Linux on Mac. Proceed to the next step, boot. First boot to the device I got nothing but black blank screen. Mitigated this by boot from the same USB installer to install the distro, detailed step:

1. Press alt on the first chime and choose EFI from boot device which is the USB Installer, then add `nomodeset` parameter on the first boot option. You could change this by pressing letter `e` on the selected option.

2. Once you boot to Ubuntu, choose try ubuntu without install. Open terminal and mount the boot/efi partition. There will be two folder `EFI` and `grub`, you need to backup two files here.
    ```sh
    cp -b /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/ubuntu/shimx64.efi
    cp -b /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.efi 
    ```

3. Reboot your device, this time it will boot to your SSD.
![Boot success](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o1jdshkq0qlqypyj3ktb.png)


## Sound Issue

![Volume setting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yda8hcb40ubw8r6pb73s.png)
Boot to Ubuntu success and you don't need to install another driver here. Wifi working fine, display show no glitch but sound not working even if you set the volume to the highest. I try to install pavucontrol to see what the volume slider on the setting use for. You could do so by using command `sudo apt install pavucontrol`. My device show dummy-output, which is default if the mixer fail to detect the soundcard or driver not exist. Mitigated this using these steps:

1. Check mixer using `alsamixer`, you should see your soundcard and the volume setting on each. If there are no soundcard add `options snd-hda-intel model=auto dmic_detect=0` on the last line of `/etc/modprobe.d/alsa-base.conf`. You should use sudo here.
![Alsa mixer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/32snzgx6k6scwnjkni4n.png)

2. Mute PCH/PDIF and exec `sudo alsactl store` after exit.
![PCH/PDIF](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wermfugosmrmm8ett1jj.png)

3. Create alsa config on `$HOME` and exec `sudo alsa force-reload` after put content on it. I use nano to edit the file here,
    ```sh
    $ touch .asoundrc
    $ nano .asoundrc
    # put these inside the file
    # defaults.pcm.!card 1
    # defaults.ctl.!card 1
    ```
4. Reload alsa with `sudo alsa force-reload` and make sure pulse is running `pulseaudio --start`.
5. I don't use orca (screen reader) so uninstall this along with its dependencies. This is optional if your speaker still not working.
    ```sh
    # check if orca is running
    $ ps aux | grep speech
    $ ps aux | grep orca
    # remove them
    $ sudo apt remove --auto-remove speech-dispatcher
    # remove them and their deps
    $ sudo apt purge --auto-remove speech-dispatcher
    ```
These step, in my case also fix red light on headphone jack, which you can quick fix by select `Analog Surround 2.1 Output` on Sound configuration but not fix the sound problem.

Update: Three weeks after use this ubuntu version with wayland as its default windowing system.

## Touch-pad and Mouse Issue

![Touch-pad and Mouse Issue](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0mw2abaelulc03v1fgs.png)
Touch-pad do not respond to click, or double click. This issue happen not so often, or at least after logout for a while (> 1 min). Mouse affected same way with touch-pad, as I try to mitigate this issue with wireless mouse or wired mouse. The only workaround with this issue is restart `gdm`, which in my case will switch windowing system to X11.
```sh
 # press Ctrl+Alt+T if your keyboard still working
 $ sudo systemctl restart gdm3.service
 # wait until window restart, 
 # may take a while on blank screen
 $ sudo nano /etc/gdm3/custom.conf
 # Find line below and uncomment the next line to disable wayland on gdm
 # Uncomment the line below to force the login screen to use Xorg
 # WaylandEnable=false
```
What if your mouse or touchpad problem still persist after restart gdm? Well, there is workaround from the kernel mod, you have to edit `/etc/default/grub` and find the boot option which consist of this line `GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"` change it to:
```sh
# modify this file with sudo
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i8042.nomux i8042.reset"
# run this command to update the new config to grub
$ sudo update-grub2
# after these steps you should reboot your device to the config takes effect.
```
The option above will tell the grub to stop checking whether multiplexing controller exist or not, which in this case is PS/2 controller for the touchpad device, and reset it on reboot or suspend. You can read the full available option [here](https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt).
## Conclusion

I found another issue even after update the latest patch, will add another if any. 

Hope this will help you, thank you for reading.