Sunday, April 17, 2022

How to install Ubuntu on Intel Macbook Air/Pro with T2 Security Chip

Currently you cannot easily install Linux onto an Apple computer which uses the T2 security chip because the Linux Kernel with the T2 support is not included in any of the currently released distributions as a default kernel. And cannot use the built-in keyboard, trackpad, bluetooth and neither WiFi nor ethernet.

(1) There is a patched Ubuntu ISO for Macbook Air/Pro (2018-2020) with T2 Security Chip hardware here. https://github.com/marcosfad/mbp-ubuntu/releases

(2) This ISO image requires you to install on the internal SSD and if you are on the lastest macOS Monterey, the internal SSD would be encrypted. It is not recommended to dual booting Macbook with both macOS and Linux unless you have good backups and are prepared to perform a clean install or restore from backup since you will at some point most likely do something which will prevent either OS from booting and possibly risk losing access to all the data in one or both operating systems.

(3) So it is probably better to use USB to boot up for testing out Linux on Macbook first.
You can download this installed ISO images here (2.64GB) and burn it to an USB stick with 128GB using balenaEtcher for Mac. You don't need to unzip the downloaded zip file as balenaEtcher can read zip file and write to the USB stick directly. The image has an extra 10GB exFAT partition, so that data can be exchanged offline with PC or Mac.

(4) The Macbook should be Disable Secure Boot and Set allowed boot media based on the instructions here https://support.apple.com/HT208330

(5) Then plug in the USB and restart the Macbook and press option key while bootup, then select EFI boot to startup Ubuntu. The installed version of this Ubuntu image, username and password are all ubuntu

(6) This patched Ubuntu ISO should worked for the butterfly keyboard, function keys, touch pad, bluetooth, display and audio. But the microphone might not be working. If the wifi is not working initially, the fix is here using the Terminal (control-option-T) commands


Fix wifi issue of ubuntu-mbp image
sudo dpkg -i /usr/src/iso-firmware.deb
#edit /etc/NetworkManager/NetworkManager.conf as below
sudo editor /etc/NetworkManager/NetworkManager.conf

NetworkManager.conf    Select all
[main] plugins=ifupdown,keyfile [ifupdown] managed=false [device] wifi.scan-rand-mac-address=no
#edit /etc/NetworkManager/conf.d/wifi_backend.conf and add # sign to stop iwd as below
sudo editor /etc/NetworkManager/conf.d/wifi_backend.conf

wifi_backend.conf    Select all
#[device] #wifi.backend=iwd


Then
# restart NetworkManager
sudo systemctl restart NetworkManager
sudo modprobe brcmfmac
Then reboot Ubuntu...



Ubuntu Short Cut Key on Mac
Move window to left or right
command + arrow (e.g. left or right)

Switch desktop
control + option + arrow (e.g. up or down)

Move current window to desktop command + shift + page up / page down
command + shift + fn + arrow (e.g. up or down)

Show all desktops
command

Change window
command + tab



Further Installation of Waydroid and sideload of Android apk on Ubuntu

shell script    Select all
sudo apt update sudo apt install python3-pip lxc curl wget -y sudo pip install pyclip export DISTRO="focal" && sudo curl https://repo.waydro.id/waydroid.gpg --output /usr/share/keyrings/waydroid.gpg && echo "deb [signed-by=/usr/share/keyrings/waydroid.gpg] https://repo.waydro.id/ $DISTRO main" > ~/waydroid.list && sudo mv ~/waydroid.list /etc/apt/sources.list.d/waydroid.list sudo apt update sudo apt install dkms -y # if old Linux Kernel get this https://github.com/anbox/anbox-modules # With Linux Kernel 5.17 (that is >=5.7), download and build Linux modules from here https://github.com/choff/anbox-modules wget https://github.com/choff/anbox-modules/archive/refs/heads/master.zip unzip master.zip cd anbox-modules-master/ sudo ./INSTALL.sh # check Linux kernel modules installed anbox-ashmem & anbox-binder dkms status # install waydroid sudo apt install waydroid -y
#sudo editor /etc/resolv.conf as
nameserver 8.8.8.8
nameserver 8.8.4.4
#sudo editor /etc/gbinder.d/anbox.conf as
[Protocol]
/dev/binder = aidl2
/dev/vndbinder = aidl2
/dev/hwbinder = hidl

[ServiceManager]
/dev/binder = aidl2
/dev/vndbinder = aidl2
/dev/hwbinder = hidl


Logout Ubuntu (PC keyboard: control-alt-delete / Mac keyboard: control-option-fn-delete)
And login again with "Ubuntu on Wayland" (setting at the bottom right hand corner)


# Download waydroid image (752.66 MB) then init
sudo waydroid init
sudo systemctl start waydroid-container
waydroid session start

# sideload apk (x86_64 apk only)
waydroid app install myapplication.apk

Color correction of WayDroid
Go to Settings App -> Accessibility -> Color inversion (on)

If you want to install Ubuntu Mate Desktop, the terminal command is
sudo apt-get update
sudo apt-get install ubuntu-mate-desktop

No comments: