|
1 | 1 | # mac-artix
|
| 2 | +> Artix (With Runit) dual boot installation guide for Macbook |
2 | 3 |
|
| 4 | +<p align="center"> |
| 5 | + <img src="demo.png" width="1000"> |
| 6 | +</p> |
| 7 | + |
| 8 | +- :ballot_box_with_check: display |
| 9 | +- :ballot_box_with_check: audio |
| 10 | +- :ballot_box_with_check: internet connection, wifi |
| 11 | +- :ballot_box_with_check: keyboard (work perfectly as normal keyboard) |
| 12 | +- :ballot_box_with_check: trackpad & external mouse (with natural scroll and more) |
| 13 | +- :ballot_box_with_check: screen backlight |
| 14 | +- :ballot_box_with_check: keyboard backlight |
| 15 | +- :ballot_box_with_check: fan |
| 16 | +- :ballot_box_with_check: battery |
| 17 | + |
| 18 | + |
| 19 | +# Contents |
| 20 | + |
| 21 | +- [Install Artix dual boot](#install-artix-dual-boot) |
| 22 | + - [Make space for Artix](#make-space-for-artix) |
| 23 | + - [Make installer USB](#make-installer-usb) |
| 24 | + - [Boot it up](#boot-it-up) |
| 25 | + - [Login](#login) |
| 26 | + - [Partition](#partition) |
| 27 | + - [Format and Mount](#format-and-mount) |
| 28 | + - [Connect Wifi](#connect-wifi) |
| 29 | + - [Install Base System](#install-base-system) |
| 30 | + - [Install Kernel](#install-kernel) |
| 31 | + - [Generate fstab](#generate-fstab) |
| 32 | + - [Configure the Base System](#configure-the-base-system) |
| 33 | + - [Configure Network](#configure-network) |
| 34 | + - [Install the Bootloader](#install-the-bootloader) |
| 35 | + - [Reboot the System](#reboot-the-system) |
| 36 | + - [Make Artix Dual Bootable](#make-artix-dual-bootable) |
| 37 | + |
| 38 | +# Install Artix dual boot |
| 39 | + |
| 40 | +## Make space for Artix |
| 41 | + |
| 42 | +Use Disk Utility Partition feature to add new Partition for Artix, follow [this guide](https://wiki.archlinux.org/index.php/Mac#Arch_Linux_with_OS_X_or_other_operating_systems) |
| 43 | + |
| 44 | +Or if you already know how to use Disk Utility, then create a partition with FAT32 format. |
| 45 | + |
| 46 | +## Make installer USB |
| 47 | + |
| 48 | +Download artix base iso [here](https://iso.artixlinux.org/isos.php) |
| 49 | + |
| 50 | +Find usb by using `lsblk` or `diskutil list`, etc..., then: |
| 51 | + |
| 52 | +```sh |
| 53 | +# Assume usb disk is /dev/diskX |
| 54 | +umount /dev/diskX |
| 55 | +dd if=path/to/arch.iso of=/dev/diskX bs==1m |
| 56 | +``` |
| 57 | + |
| 58 | +## Boot it up |
| 59 | + |
| 60 | +Hold <kbd>alt/option</kbd> when system bootup, then choose boot from USB. |
| 61 | + |
| 62 | +:warning: If you are using Retina Macbook, tty font will be very small. To get larger font, [connect to wifi](connect-wifi) and run these commands: |
| 63 | + |
| 64 | +```sh |
| 65 | +sudo pacman -Sy terminus-font |
| 66 | +setfont /usr/share/kbd/consolefonts/ter-132b.psf.gz |
| 67 | +``` |
| 68 | + |
| 69 | +Or you can use some font already in `/usr/share/kbd/consolefonts` |
| 70 | + |
| 71 | +## Login |
| 72 | + |
| 73 | +After boot up, choose `keytable`, `lang` or leave it default if you not sure what is it, then choose: |
| 74 | + |
| 75 | +`[From CD/DVD/ISO: artix.x86_64]` |
| 76 | + |
| 77 | +Then login with: |
| 78 | + |
| 79 | +```sh |
| 80 | +Username: artix |
| 81 | +Password: artix |
| 82 | +``` |
| 83 | + |
| 84 | +## Partition |
| 85 | + |
| 86 | +View all your partitions to choose correct one with: |
| 87 | + |
| 88 | +```sh |
| 89 | +lsblk |
| 90 | +``` |
| 91 | + |
| 92 | +Then open cfdisk to partition own disk |
| 93 | + |
| 94 | +```sh |
| 95 | +# Assume my disk is /dev/sda |
| 96 | +cfdisk /dev/sda |
| 97 | +``` |
| 98 | + |
| 99 | +Then create these new partitions: |
| 100 | + |
| 101 | +|Size |Type |Description| |
| 102 | +|--- |--- |--- | |
| 103 | +|128MB |Apple HFS+ |This is required in order to make artix dual boot with OSX| |
| 104 | +|256MB |Linux filesystem |Artix file system| |
| 105 | +|xMB |Linux Swap |If you have space, try to make it double size of your ram size| |
| 106 | +|xGB |Linux filesystem |This is our home| |
| 107 | + |
| 108 | +## Format and Mount |
| 109 | + |
| 110 | +Assuming you have this after partitioning |
| 111 | + |
| 112 | +|Device |Size |Type| |
| 113 | +|--- |--- |---| |
| 114 | +|/dev/sda3 |128MB |Apple HFS+| |
| 115 | +|/dev/sda4 |256MB |Linux filesystem| |
| 116 | +|/dev/sda5 |16GB |Linux Swap| |
| 117 | +|/dev/sda6 |64GB |Linux filesystem| |
| 118 | + |
| 119 | +Now let format it all: |
| 120 | + |
| 121 | +```sh |
| 122 | +mkfs.ext4 /dev/sda4 |
| 123 | +mkfs.ext4 /dev/sda6 |
| 124 | +mkswap /dev/sda5 |
| 125 | +``` |
| 126 | + |
| 127 | +Then mount & turn on swap: |
| 128 | + |
| 129 | +```sh |
| 130 | +mount /dev/sda6 /mnt |
| 131 | +mkdir /mnt/boot |
| 132 | +mount /dev/sda4 /mnt/boot |
| 133 | +swapon /dev/sda5 |
| 134 | +``` |
| 135 | + |
| 136 | +## Connect Wifi |
| 137 | + |
| 138 | +Connect with [connman](https://wiki.archlinux.org/index.php/ConnMan) |
| 139 | + |
| 140 | +Example: |
| 141 | + |
| 142 | +```sh |
| 143 | +connmanctl # Open connman |
| 144 | +enable wifi # Enable wifi |
| 145 | +scan wifi # Scan wifi |
| 146 | +agent on # Enable wireless agent |
| 147 | +services # List all scanned wifi |
| 148 | +connect wifi_XXX # Connect with wifi_XXX goes after your wifi name |
| 149 | +``` |
| 150 | + |
| 151 | +Then check connection with: |
| 152 | + |
| 153 | +```sh |
| 154 | +ping -c 3 google.com |
| 155 | +``` |
| 156 | + |
| 157 | +From there you can install your favorite editor to prepare for next steps, example: |
| 158 | + |
| 159 | +```sh |
| 160 | +# I use vim |
| 161 | +sudo pacman -S vim |
| 162 | +``` |
| 163 | + |
| 164 | +## Install Base System |
| 165 | + |
| 166 | +I'm using runit so: |
| 167 | + |
| 168 | +```sh |
| 169 | +basestrap /mnt base base-devel runit elogind-runit |
| 170 | +``` |
| 171 | + |
| 172 | +## Install Kernel |
| 173 | + |
| 174 | +You can choose `linux` or `linux-lts`. I'v tried `linux` kernel on my [MJLQ2-MBP](https://support.apple.com/kb/sp719?locale=en_VN) but it cause udev stuck and we have to fix by edit grub default like: |
| 175 | + |
| 176 | +```sh |
| 177 | +GRUB_CMDLINE_LINUX_DEFAULT="nomodeset quiet rootflags=data=writeback" |
| 178 | +``` |
| 179 | + |
| 180 | +Although that fix udev get stuck but then you will can't control backlight of your MBP |
| 181 | + |
| 182 | +So, i'v install `linux-lts` and everything work out of the box: |
| 183 | + |
| 184 | +```sh |
| 185 | +basestrap /mnt linux-lts linux-firmware |
| 186 | +``` |
| 187 | + |
| 188 | +## Generate fstab |
| 189 | + |
| 190 | +Run this command: |
| 191 | + |
| 192 | +```sh |
| 193 | + fstabgen -U /mnt >> /mnt/etc/fstab |
| 194 | +``` |
| 195 | + |
| 196 | +:warning: If you are using SSD Drive, Open fstab config file: |
| 197 | + |
| 198 | +```sh |
| 199 | +vim /mnt/etc/fstab |
| 200 | +``` |
| 201 | + |
| 202 | +Remove all `discard` in all lines & edit everything to look like: |
| 203 | + |
| 204 | +|--- |--- |--- |--- |---| |
| 205 | +|/dev/sda4 |/boot |ext2 |defaults,relatime,stripe=4 |0 2| |
| 206 | +|/dev/sda6 |/ |ext4 |defaults,noatime,data=writeback |0 1| |
| 207 | + |
| 208 | +## Configure the Base System |
| 209 | + |
| 210 | +Let chroot into own new Artix system: |
| 211 | + |
| 212 | +```sh |
| 213 | +artools-chroot /mnt |
| 214 | +``` |
| 215 | + |
| 216 | +Set system clock: |
| 217 | + |
| 218 | +```sh |
| 219 | +ln -sf /usr/share/zoneinfo/Region/City /etc/localtime |
| 220 | +hwclock --systohc |
| 221 | +``` |
| 222 | + |
| 223 | +Localization: |
| 224 | + |
| 225 | +```sh |
| 226 | +# Uncomment `en_US.UTF-8 UTF-8` (Or what ever locale you want) line in `/etc/locale.gen` file, then run: |
| 227 | +locale-gen |
| 228 | +echo LANG=en_US.UTF-8 > /etc/locale.conf |
| 229 | +export LANG=en_US.UTF-8 |
| 230 | +``` |
| 231 | + |
| 232 | +Add user: |
| 233 | + |
| 234 | +```sh |
| 235 | +useradd -m -G wheel your_username |
| 236 | +passwd your_username (Create your password) |
| 237 | + |
| 238 | +# Also change your sudo password with: |
| 239 | +passwd |
| 240 | +``` |
| 241 | + |
| 242 | +Add sudo rights for our user by open `/etc/sudoers` file and uncomment this line: |
| 243 | + |
| 244 | +```sh |
| 245 | +%wheel ALL=(ALL) ALL |
| 246 | +``` |
| 247 | + |
| 248 | +Create an initial ramdisk environment: |
| 249 | + |
| 250 | +```sh |
| 251 | +mkinitcpio -p linux-lts |
| 252 | +# or linux if you using linux kernel |
| 253 | +``` |
| 254 | + |
| 255 | +## Configure Network |
| 256 | + |
| 257 | +Set hostname: |
| 258 | + |
| 259 | +```sh |
| 260 | +echo artix > /etc/hostname (Change artix with your preper hostname) |
| 261 | +``` |
| 262 | + |
| 263 | +Install there packages: |
| 264 | + |
| 265 | +```sh |
| 266 | +pacman -S connman-runit dhcpcd wpa_supplicant |
| 267 | +``` |
| 268 | + |
| 269 | +:warning: If you only have wireless connection, be sure to install `wpa_supplicant` and make sure it install successfully |
| 270 | + |
| 271 | +Enable connmand service: |
| 272 | + |
| 273 | +```sh |
| 274 | +ln -s /etc/runit/sv/connmand /etc/runit/runsvdir/default |
| 275 | +``` |
| 276 | + |
| 277 | +## Install the Bootloader |
| 278 | + |
| 279 | +We will boot using OSX native EFI boot loader, so install this: |
| 280 | + |
| 281 | +```sh |
| 282 | +pacman -S grub-efi-x86_64 |
| 283 | +``` |
| 284 | + |
| 285 | +Change `/etc/default/grub` to look like: |
| 286 | + |
| 287 | +```sh |
| 288 | +GRUB_CMDLINE_LINUX_DEFAULT="quiet rootflags=data=writeback" |
| 289 | +``` |
| 290 | + |
| 291 | +:⚠: If you using `linux` kernel instead of `linux-lts` kernel, you may try this: |
| 292 | + |
| 293 | +```sh |
3 | 294 | GRUB_CMDLINE_LINUX_DEFAULT="nomodeset quiet rootflags=data=writeback"
|
| 295 | +``` |
| 296 | + |
| 297 | +Then create boot.efi with GRUB: |
| 298 | + |
| 299 | +```sh |
| 300 | +# Create empty "boot/grub/grub.cfg" file if it not exist |
| 301 | +grub-mkconfig -o boot/grub/grub.cfg |
| 302 | +grub-mkstandalone -o boot.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi --compress xz boot/grub/grub.cfg |
| 303 | +``` |
| 304 | + |
| 305 | +:heavy_exclamation_mark: Important: Copy boot.efi to your usb or upload it somewhere, we'll need this to dual boot with OSX. |
| 306 | + |
| 307 | +To copy it to usb, use: |
| 308 | + |
| 309 | +``` |
| 310 | +mkdir /mnt/myusb && mount /dev/sdb /mnt/myusb |
| 311 | +cp boot.efi /mnt/myusb/ |
| 312 | +``` |
| 313 | + |
| 314 | +Or upload it to [file.io](https://www.file.io/): |
| 315 | + |
| 316 | +``` |
| 317 | +curl -F "[email protected]" https://file.io |
| 318 | +``` |
| 319 | + |
| 320 | +## Reboot the System |
| 321 | + |
| 322 | +If everything ok, now you can exit chroot and reboot (Back to OSX word) |
| 323 | + |
| 324 | +```sh |
| 325 | +exit <- (exit chroot environment) |
| 326 | +umount -R /mnt |
| 327 | +reboot |
| 328 | +``` |
| 329 | + |
| 330 | +## Make Artix Dual Bootable |
| 331 | + |
| 332 | +When OSX loaded. Using Disk Utility to format 128MB Apple HFS+ we have created & formatted before with `Journaled` format. |
| 333 | + |
| 334 | +Then create this file structure inside: |
| 335 | + |
| 336 | +``` |
| 337 | +|___mach_kernel |
| 338 | +|___System |
| 339 | + |___Library |
| 340 | + |___CoreServices |
| 341 | + |___SystemVersion.plist |
| 342 | + |___boot.efi <- (is the boot.efi file we'v copied or uploaded in the previous step) |
| 343 | +``` |
| 344 | + |
| 345 | +Add below content to `SystemVersion.plist`: |
| 346 | + |
| 347 | +```xml |
| 348 | +<xml version="1.0" encoding="utf-8"?> |
| 349 | +<plist version="1.0"> |
| 350 | +<dict> |
| 351 | + <key>ProductBuildVersion</key> |
| 352 | + <string></string> |
| 353 | + <key>ProductName</key> |
| 354 | + <string>Linux</string> |
| 355 | + <key>ProductVersion</key> |
| 356 | + <string>Artix Linux</string> |
| 357 | +</dict> |
| 358 | +</plist> |
| 359 | +``` |
| 360 | + |
| 361 | +Then reboot and hold <kbd>alt/option</kbd> and enjoy Artix 😺 |
| 362 | + |
0 commit comments