Drawing from this nice guide. When in doubt, always consult the wiki.
Download the image from https://www.archlinux.org/ and format a USB drive:
lsblk -f # make sure you choose the right path! dd if=archlinux.img of=/dev/sdX bs=16M && sync disk
`diskutil list`
`sudo umount /dev/disk2` # again, choose the right path!
`dd if=archlinux.img of=/dev/rdisk2 bs=1m` # notice the path is /dev/**r**disk2 - this will transfer more quickly
# you'll get a notification from macOS like "the disk format isn't recognized" - no worries: simply remove the drive and proceed
If the USB fails to boot, make sure that secure boot is disabled in the BIOS configuration.
By default, the US keymap is loaded. Otherwise, consult the wiki to find your desired keyboard layout:
loadkeys sv-latin1
# timedatectl set-ntp true
Verify with timedatectl status
.
wifi-menu
This will be the partition scheme:
1 512MB EFI partition # Hex code ef00
2 250MB Boot partition # Hex code 8300
3 -rest Root # Hex code 8E00
gdisk /dev/sdX
- Zap the drive
x
z
- Write a new GPT table
o
- Partitioning
n (Add a new partition)
Partition number 1
First sector 2048 (default)
Last sector +512M
Hex code EF00
n (Add a new partition)
Partition number 2
First sector 1050624 (default)
Last sector +512M
Hex code 8300
n (Add a new partition)
Partition number 3
First sector 2099200 (default)
Last sector (hit Enter to use remaining disk space)
Hex code 8E00
- hit
p
to view the partitioning scheme, then confirm with:
w
Y
- LUKS formatting:
cryptsetup luksFormat /dev/sda3
Are you sure? YES
Enter passphrase (twice)
- Open the container:
lvm
is the name of the decrypted device - use whichever you prefer:
cryptsetup luksOpen /dev/sdX3 lvm
- Create LVM:
pvcreate /dev/mapper/lvm
vgcreate lvmvg /dev/mapper/lvm
lvcreate -L 8G lvmvg -n swapvol
lvcreate -l 100%FREE lvmvg -n rootvol
mkfs.vfat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.btrfs -L btrfs /dev/mapper/lvmvg-rootvol
mkswap /dev/mapper/lvmvg-swapvol
swapon /dev/mapper/lvmvg-swapvol
mount /dev/mapper/lvmvg-rootvol /mnt
btrfs subvolume create /mnt/root
btrfs subvolume create /mnt/home
umount /mnt
mount -o subvol=root,ssd,compress=lzo /dev/mapper/lvmvg-rootvol /mnt
mkdir /mnt/{boot,home}
mount -o subvol=home,ssd,compress=lzo /dev/mapper/lvmvg-rootvol /mnt/home
mount /dev/sda2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi
vim /etc/pacman.conf
- uncomment
Misc. Options
entries and add:
ILoveCandy
Install the system and include stuff needed for connecting to WiFi when booting into the newly installed system:
pacstrap /mnt base base-devel btrfs-progs grub grub-efi-x86_64 sudo zsh zsh-completions vim git efibootmgr dialog wpa_supplicant grml-zsh-config xdg-user-dirs wget
genfstab -pU /mnt >> /mnt/etc/fstab
- Make sure to include -pU!
vim /mnt/etc/fstab
- Change
relatime
on all non-boot partitions tonoatime
(reduces wear if using an SSD)
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
arch-chroot /mnt /bin/bash
ln -s /usr/share/zoneinfo/US/Central /etc/localtime
hwclock --systohc --utc
echo bikini-bottom > /etc/hostname
echo LANG=en_US.UTF-8 >> /etc/locale.conf
echo LANGUAGE=en_US >> /etc/locale.conf
echo LC_ALL=en_US.UTF-8 >> /etc/locale.conf
passwd
useradd -m -g users -G wheel -s /bin/zsh MYUSERNAME
passwd MYUSERNAME
- Consult the wiki for any necessary modules you might need:
vim /etc/mkinitcpio.conf
...
MODULES="i915 crc32c-intel ext4"
...
HOOKS="base udev autodetect modconf block encrypt lvm2 btrfs resume filesystems keyboard fsck"
...
mkinitcpio -p linux
grub-install
- Find the persistent UUID pathname for your root partition:
The encrypted LVM you made, not the
btrfs
subvolume:
NAME FSTYPE LABEL UUID
sda
├─sda1 vfat 294C-3908
├─sda2 ext4 3d02045e-aa03-4cb5-9503-7eea54bdedc8
└─sda3 crypto_LUKS d362beea-62e8-41de-90a6-eab3c70f2ce0 <--- this
Use blkid
to find it:
blkid
(find your encrypted root partition's uuid)
echo /dev/disk/by-uuid/<UUID> >> /etc/default/grub
- In
/etc/default/grub
edit the kernel parameters:
GRUB_CMDLINE_LINUX_DEFAULT="quiet transparent_hugepage=never"
GRUB_CMDLINE_LINUX="cryptdevice=/dev/disk/by-uuid/<insert encrypted root UUID here>:lvm:allow-discards root=/dev/mapper/lvmvg-rootvol rootflags=subvol=root resume=/dev/mapper/lvmvg-swapvol"
# save, exit and:
grub-mkconfig -o /boot/grub/grub.cfg
- Ignore any
lvmetad
warnings, they won't interfere with theconf
setup
exit
umount -R /mnt
swapoff -a
reboot
-
Login as
root
-
Connect to WiFi with
wifi-menu
-
Add normal user to sudoers:
visudo
Uncomment username ALL=(ALL) ALL
- Populate
home
directory with familiar directories and prepare Builds directory:
cd ~
xdg-user-dirs-update
mv Public ./Builds
- Install and configure Xorg and Gnome:
pacman -S xf86-video-intel xorg-server xorg-xinit gnome
# (will also install gdm)
# maintain authenticated session:
vim ~/.xserverrc
# add (note that the first line is not one of my comments, include it WITH the #):
#!/bin/sh
exec /usr/bin/Xorg -nolisten tcp "$@" vt$XDG_VTNR
# Exit and:
cp /etc/X11/xinit/xinitrc ~/.xinitrc
vim ~/.xinitrc
# Edit and add:
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
# add this to the bottom of the file:
exec gnome-session
# start X at login:
vim ~/.zprofile (or ~/.bash_profile if you prefer)
# add:
if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
exec startx
fi
Assuming all goes well, you should be ready to start setting up your userland. I usually enable gdm
and NetworkManager
to get the ball rolling, then install Chrome from the AUR, etc.
INFO: task btrfs-tranacti:191 blocked for more than 120 seconds.
See this forum topic for info. Also try clearing out ~/.cache
.
pacman -S snapper
snapper -c root create-config /
snapper -c home create-config /home
# You'll need to delete the automatically-generated subvolumes,
# as they are inherently flawed and shouldn't be relied upon (See [1])
btrfs subvolume delete /.snapshots
btrfs subvolume delete /home/.snapshots
# Now, create new subvolumes and mount them at the mountpoints snapper expects:
mkdir /snapshots
mkdir /.snapshots
mkdir /home/.snapshots
btrfs subvolume create /snapshots/root_snaps
btrfs subvolume create /snapshots/home_snaps
# Lookup subvolume ID for root_snaps and home_snaps,
# and mount them to their respective snapshot mountpoints
btrfs subvolume list -a /
mount -o compress=lzo,subvolid=<ROOT_SNAPS_ID> /dev/mapper/lvmvg-root /.snapshots
mount -o compress=lzo,subvolid=<HOME_SNAPS_ID> /dev/mapper/lvmvg-root /home/.snapshots
# Enable automatic snapshots
systemctl start snapper-timeline.timer snapper-cleanup.timer
systemctl enable snapper-timeline.timer snapper-cleanup.timer
mkfs.btrfs -L Backups /dev/sdbX
mount -o compress=lzo /dev/sdbX /mnt
pacaur -S snap-sync
sudo snap-sync
# Follow the directions to backup to the USB.
# It's possible you might have to create a 'Backups' directory at /mnt
# (I did for some reason, but can't remember why -.-')
echo 'alias -g pac="pacaur"' >> ~/.zshrc
pacman -S neovim
echo 'alias -g vim="neovim"' >> ~/.zshrc
# copy to system clipboard by putting this in init.vim:
noremap <C-y> "+y
export LC_ALL=en_US.UTF-8
Edit /etc/locale.conf
~/.Xmodmap
clear lock
clear control
keycode 66 = Control_L
add control = Control_L
keycode 37 = Escape NoSymbol Escape
setxkbmap -option apple:badmap
if [ -f $HOME/.Xmodmap ]; then
/usr/bin/xmodmap $HOME/.Xmodmap
fi
Otherwise it'll swallow your "<" / ">" keycodes