Skip to content

Latest commit

 

History

History
430 lines (300 loc) · 10.2 KB

README.md

File metadata and controls

430 lines (300 loc) · 10.2 KB

mac-artix

Artix (With Runit) dual boot installation guide for Macbook

  • ☑️ display
  • ☑️ audio
  • ☑️ internet connection, wifi
  • ☑️ keyboard (work perfectly as normal keyboard)
  • ☑️ trackpad & external mouse (with natural scroll and more)
  • ☑️ screen backlight
  • ☑️ keyboard backlight
  • ☑️ fan
  • ☑️ battery

Contents

Before you start

It's seem Macbook with T2 Security isn't support linux very well, view this discussions

Install Artix dual boot

Make space for Artix

Use Disk Utility Partition feature to add new Partition for Artix, follow this guide

Or if you already know how to use Disk Utility, then create a partition with FAT32 format.

Make installer USB

Download Artix base ISO here

Find usb by using lsblk or diskutil list, etc..., then:

# Assume usb disk is /dev/diskX
umount /dev/diskX
dd if=path/to/arch.iso of=/dev/diskX bs==1m

Boot it up

Hold alt/option when system bootup, then choose boot from USB.

⚠️ If you are using Retina Macbook, tty font will be very small. To get larger font, connect to wifi and run these commands:

sudo pacman -Sy terminus-font
setfont /usr/share/kbd/consolefonts/ter-132b.psf.gz

Or you can use some font already in /usr/share/kbd/consolefonts

Login

After boot up, choose keytable, lang or leave it default if you not sure what are they, then choose:

[From CD/DVD/ISO: artix.x86_64]

Then login with:

Username: artix
Password: artix

Partition

View all your partitions to choose correct one with:

lsblk

Then open cfdisk to partition own disk

# Assume my disk is /dev/sda
cfdisk /dev/sda

Then create these new partitions:

Size Type Description
128MB Apple HFS+ This is required in order to make artix dual boot with OSX
256MB Linux filesystem Artix file system
xMB Linux Swap If you have space, try to make it double size of your ram size
xGB Linux filesystem This is our home

Format and Mount

Assuming you have this after partitioning

Device Size Type
/dev/sda3 128MB Apple HFS+
/dev/sda4 256MB Linux filesystem
/dev/sda5 16GB Linux Swap
/dev/sda6 64GB Linux filesystem

Now let format it all:

mkfs.ext4 /dev/sda4
mkfs.ext4 /dev/sda6
mkswap /dev/sda5

Then mount & turn on swap:

mount /dev/sda6 /mnt
mkdir /mnt/boot
mount /dev/sda4 /mnt/boot
swapon /dev/sda5

Connect Wifi

Connect with connman

Example:

connmanctl              # Open connman
enable wifi             # Enable wifi
scan wifi               # Scan wifi
agent on                # Enable wireless agent
services                # List all scanned wifi
connect wifi_XXX        # Connect with wifi_XXX goes after your wifi name

Then check connection with:

ping -c 3 google.com

Install Base System

I'm using runit so:

basestrap /mnt base base-devel runit elogind-runit

Install Kernel

You can choose linux or linux-lts. I'v tried linux kernel on my MJLQ2-MBP but it cause udev stuck and we have to fix by edit grub default like:

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset quiet rootflags=data=writeback"

Although that fix udev get stuck but then you will can't control backlight of your MBP

So, i'v install linux-lts and everything work out of the box:

basestrap /mnt linux-lts linux-firmware

Generate fstab

Run this command:

fstabgen -U /mnt >> /mnt/etc/fstab

⚠️ If you are using SSD Drive, Open fstab config file:

vim /mnt/etc/fstab

Remove all discard in all lines & edit everything to look like:

/dev/sda4 /boot ext2 defaults,relatime,stripe=4 0 2 /dev/sda6 / ext4 defaults,noatime,data=writeback 0 1

Configure the Base System

Let chroot into own new Artix system:

artools-chroot /mnt

Set system clock:

ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc

Localization:

# Uncomment `en_US.UTF-8 UTF-8` (Or what ever locale you want) line in `/etc/locale.gen` file, then run:
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8

Add user:

useradd -m -G wheel your_username
passwd your_username   (Create your password)

# Also change your sudo password with:
passwd

Add sudo rights for our user by open /etc/sudoers file and uncomment this line:

%wheel ALL=(ALL) ALL

Create an initial ramdisk environment:

mkinitcpio -p linux-lts
# or linux if you using linux kernel

Configure Network

Set hostname:

echo artix > /etc/hostname   (Change artix with your preper hostname)

Install there packages:

pacman -S connman-runit dhcpcd wpa_supplicant

⚠️ If you only have wireless connection, be sure to install wpa_supplicant and make sure it install successfully

Enable connmand service:

ln -s /etc/runit/sv/connmand /etc/runit/runsvdir/default

Install the Bootloader

We will boot using OSX native EFI boot loader, so install this:

pacman -S grub-efi-x86_64

Change /etc/default/grub to look like:

GRUB_CMDLINE_LINUX_DEFAULT="quiet rootflags=data=writeback"

⚠ If you using linux kernel instead of linux-lts kernel, you may try this:

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset quiet rootflags=data=writeback"

Then create boot.efi with GRUB:

# Create empty "boot/grub/grub.cfg" file if it not exist
grub-mkconfig -o boot/grub/grub.cfg
grub-mkstandalone -o boot.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi --compress xz boot/grub/grub.cfg

❗ Important: Copy boot.efi to your usb or upload it somewhere, we'll need this to dual boot with OSX.

To copy it to usb, use:

mkdir /mnt/myusb && mount /dev/sdb /mnt/myusb
cp boot.efi /mnt/myusb/

Or upload it to file.io:

curl -F "file=@boot.efi" https://file.io

Reboot the System

If everything ok, now you can exit chroot and reboot (Back to OSX word)

exit             <- (exit chroot environment)
umount -R /mnt
reboot

Make Artix Dual Bootable

When OSX loaded. Using Disk Utility to format 128MB Apple HFS+ we have created & formatted before with Journaled format.

Then create this file structure inside:

|___mach_kernel   
|___System   
    |___Library   
        |___CoreServices   
            |___SystemVersion.plist   
            |___boot.efi              <- (is the boot.efi file we'v copied or uploaded in the previous step)  

Add below content to SystemVersion.plist:

<xml version="1.0" encoding="utf-8"?>
<plist version="1.0">
<dict>
    <key>ProductBuildVersion</key>
    <string></string>
    <key>ProductName</key>
    <string>Linux</string>
    <key>ProductVersion</key>
    <string>Artix Linux</string>
</dict>
</plist>

Then reboot and hold alt/option and enjoy Artix 😺

Install to make artix usable

Set tty default font

⚠️ Font in retina screen is very small, so this maybe the first step you should do . If you can see the font clearly, you don't have to do this step.

Install terminus-font (or whatever font you prefer, make sure it have large size):

sudo pacman -S terminus-font

create file /etc/vconsole.conf with content:

FONT=ter-132b

Install these default fonts (to make browser look suckless):

yay -S ttf-mac-fonts ttf-ms-fonts ttf-opensans

Install drivers

sudo pacman -S xf86-video-intel xf86-input-libinput mesa

Install require packages

Using pacman to install all these packages:

Package Description
xorg-server graphical server
xorg-xinit starts graphical server
xorg-xrandr resize & rotate utility for X
xorg-xsetroot utility to set your root window background to a given pattern or color
xorg-xev indentifying keycodes
picom lightweight compositor for X11
xwallpaper set wallpaper
arandr UI for screen adjustment

Install Window Manager

I build my own dwm, dmenu, st from suckless

But you can install any window manager you like

Bluetooth

pacman -S bluez bluez-runit bluez-utils ln -s /etc/runit/sv/bluetoothd /run/runit/service sv start bluetoothd sv restart bluetoothd

For bluetooth audio device, install these

sudo pacman -S pulseaudio-alsa pulseaudio-bluetooth

You may need install blueman for easily manage your bluetooth devices