mirror of
https://codeberg.org/hyperreal/techne
synced 2024-11-01 14:23:06 +01:00
238 lines
5.9 KiB
Org Mode
238 lines
5.9 KiB
Org Mode
#+title: Void Linux
|
|
#+setupfile: ../org-templates/page.org
|
|
|
|
** Install on encrypted Btrfs
|
|
Source: [[https://gist.github.com/gbrlsnchs/9c9dc55cd0beb26e141ee3ea59f26e21][Void Linux Installation Guide]]
|
|
|
|
First, update xbps.
|
|
#+begin_src shell
|
|
xbps-install -Syu xbps
|
|
#+end_src
|
|
|
|
*** Partition disk
|
|
Install ~gptfdisk~.
|
|
#+begin_src shell
|
|
xbps-install -Sy gptfdisk
|
|
#+end_src
|
|
|
|
Run gdisk.
|
|
#+begin_src shell
|
|
gdisk /dev/nvme1n1
|
|
#+end_src
|
|
|
|
Create the following partitions:
|
|
| Partition Type | Size |
|
|
|----------------+-----------------|
|
|
| EFI | +600M |
|
|
| boot | +900M |
|
|
| root | Remaining space |
|
|
|
|
Create the filesystems.
|
|
#+begin_src shell
|
|
mkfs.vfat -nBOOT -F32 /dev/nvme1n1p1
|
|
mkfs.ext4 -L grub /dev/nvme1n1p2
|
|
cryptsetup luksFormat --type=luks -s=512 /dev/nvme1n1p3
|
|
cryptsetup open /dev/nvme1n1p3 cryptroot
|
|
mkfs.btrfs -L void /dev/mapper/cryptroot
|
|
#+end_src
|
|
|
|
Mount partitions and create Btrfs subvolumes.
|
|
#+begin_src shell
|
|
mount -o defaults,compress=zstd:1 /dev/mapper/cryptroot /mnt
|
|
btrfs subvolume create /mnt/root
|
|
btrfs subvolume create /mnt/home
|
|
umount /mnt
|
|
mount -o defaults,compress=zstd:1,subvol=root /dev/mapper/cryptroot /mnt
|
|
mkdir /mnt/home
|
|
mount -o defaults,compress=zstd:1,subvol=home /dev/mapper/cryptroot /mnt/home
|
|
#+end_src
|
|
|
|
Create Btrfs subvolumes for parts of the filesystem to exclude from snapshots. Nested subvolumes are not included in snapshots.
|
|
#+begin_src shell
|
|
mkdir -p /mnt/var/cache
|
|
btrfs subvolume create /mnt/var/cache/xbps
|
|
btrfs subvolume create /mnt/var/tmp
|
|
btrfs subvolume create /mnt/srv
|
|
btrfs subvolume create /mnt/var/swap
|
|
#+end_src
|
|
|
|
Mount EFI and boot partitions.
|
|
#+begin_src shell
|
|
mkdir /mnt/efi
|
|
mount -o rw,noatime /dev/nvme1n1p1 /mnt/efi
|
|
mkdir /mnt/boot
|
|
mount -o rw,noatime /dev/nvme1n1p2 /mnt/boot
|
|
#+end_src
|
|
|
|
*** Base system installation
|
|
If using ~x86_64~:
|
|
#+begin_src shell
|
|
REPO=https://mirrors.hyperreal.coffee/voidlinux/current
|
|
ARCH=x86_64
|
|
#+end_src
|
|
|
|
If using musl:
|
|
#+begin_src shell
|
|
REPO=https://mirrors.hyperreal.coffee/voidlinux/current/musl
|
|
ARCH=x86_64-musl
|
|
#+end_src
|
|
|
|
Install the base system.
|
|
#+begin_src shell
|
|
XBPS_ARCH=$ARCH xbps-install -S -R "$REPO" -r /mnt base-system base-devel btrfs-progs cryptsetup vim sudo dosfstools mtools void-repo-nonfree
|
|
#+end_src
|
|
|
|
*** chroot
|
|
Mount the pseudo filesystems for the chroot.
|
|
#+begin_src shell
|
|
for dir in dev proc sys run; do mount --rbind /$dir /mnt/$dir; mount --make-rslave /mnt/$dir; done
|
|
#+end_src
|
|
|
|
Copy DNS configuration.
|
|
#+begin_src shell
|
|
cp -v /etc/resolv.conf /mnt/etc/
|
|
#+end_src
|
|
|
|
Chroot.
|
|
#+begin_src shell
|
|
PS1='(chroot) # ' chroot /mnt/ /bin/bash
|
|
#+end_src
|
|
|
|
Set hostname.
|
|
#+begin_src shell
|
|
echo "hostname" > /etc/hostname
|
|
#+end_src
|
|
|
|
Set timezone.
|
|
#+begin_src shell
|
|
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
|
|
#+end_src
|
|
|
|
Synchronize the hardware clock.
|
|
#+begin_src shell
|
|
hwclock --systohc
|
|
#+end_Src
|
|
|
|
If using glibc, uncomment ~en_US.UTF-8~ from ~/etc/default/libc-locales~. Then run:
|
|
#+begin_src shell
|
|
xbps-reconfigure -f glibc-locales
|
|
#+end_src
|
|
|
|
Set root password.
|
|
#+begin_src shell
|
|
passwd root
|
|
#+end_src
|
|
|
|
Configure ~/etc/fstab~.
|
|
#+begin_src shell
|
|
UEFI_UUID=$(blkid -s UUID -o value /dev/nvme1n1p1)
|
|
GRUB_UUID=$(blkid -s UUID -o value /dev/nvme1n1p2)
|
|
ROOT_UUID=$(blkid -s UUID -o value /dev/mapper/cryptroot)
|
|
|
|
cat << EOF > /etc/fstab
|
|
UUID=$ROOT_UUID / btrfs defaults,compress=zstd:1,subvol=root 0 1
|
|
UUID=$UEFI_UUID /efi vfat defaults,noatime 0 2
|
|
UUID=$GRUB_UUID /boot ext4 defaults,noatime 0 2
|
|
UUID=$ROOT_UUID /home btrfs defaults,compress=zstd:1,subvol=home 0 2
|
|
tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
|
|
EOF
|
|
#+end_src
|
|
|
|
Setup Dracut. A "hostonly" install means that Dracut will generate a lean initramfs with everything you need.
|
|
#+begin_src shell
|
|
echo "hostonly=yes" >> /etc/dracut.conf
|
|
#+end_src
|
|
|
|
If you have an Intel CPU:
|
|
#+begin_src shell
|
|
xbps-install -Syu intel-ucode
|
|
#+end_src
|
|
|
|
Install GRUB.
|
|
#+begin_src shell
|
|
xbps-install -Syu grub-x86_64-efi os-prober
|
|
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id="Void Linux"
|
|
#+end_src
|
|
|
|
If you are dual-booting with another OS:
|
|
#+begin_src shell
|
|
echo "GRUB_DISABLE_OS_PROBER=0" >> /etc/default/grub
|
|
#+end_src
|
|
|
|
Setup encrypted swapfile.
|
|
#+begin_src shell
|
|
truncate -s 0 /var/swap/swapfile
|
|
chattr +C /var/swap/swapfile
|
|
chmod 600 /var/swap/swapfile
|
|
dd if=/dev/zero of=/var/swap/swapfile bs=1G count=16 status=progress
|
|
mkswap /var/swap/swapfile
|
|
swapon /var/swap/swapfile
|
|
|
|
RESUME_OFFSET=$(btrfs inspect-internal map-swapfile -r /var/swap/swapfile)
|
|
cat << EOF >> /etc/default/grub
|
|
GRUB_CMDLINE_LINUX="resume=UUID-$ROOT_UUID resume_offset=$RESUME_OFFSET"
|
|
EOF
|
|
#+end_src
|
|
|
|
Regenerate configurations.
|
|
#+begin_src shell
|
|
xbps-reconfigure -fa
|
|
#+end_src
|
|
|
|
Install Xorg and Xfce.
|
|
#+begin_src shell
|
|
xbps-install -Syu xorg xfce4
|
|
#+end_src
|
|
|
|
If you have a recent Nvidia GPU:
|
|
#+begin_src shell
|
|
xbps-install -Syu nvidia
|
|
#+end_src
|
|
|
|
Add user.
|
|
#+begin_src shell
|
|
useradd -c "Jeffrey Serio" -m -s /usr/bin/zsh -U jas
|
|
passwd jas
|
|
echo "jas ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers.d/jas
|
|
#+end_src
|
|
|
|
Enable system services.
|
|
#+begin_src shell
|
|
for svc in "NetworkManager" "crond" "dbus" "lightdm" "ntpd" "snapperd" "sshd"; do
|
|
ln -sf /etc/sv/$svc /var/service;
|
|
done
|
|
#+end_src
|
|
|
|
Disable bitmap fonts.
|
|
#+begin_src shell
|
|
ln -sf /usr/share/fontconfig/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/
|
|
xbps-reconfigure -f fontconfig
|
|
#+end_src
|
|
|
|
Setup package repository.
|
|
#+begin_src shell
|
|
echo "repository=https://mirrors.hyperreal.coffee/voidlinux/current" | tee /etc/xbps.d/00-repository-main.conf
|
|
|
|
# For musl
|
|
echo "repository=https://mirrors.hyperreal.coffee/voidlinux/current/musl" | tee /etc/xbps.d/00-repository-main.conf
|
|
#+end_src
|
|
|
|
Setup Pipewire for audio.
|
|
#+begin_src shell
|
|
mkdir -p /etc/pipewire/pipewire.conf.d
|
|
ln -sf /usr/share/examples/wireplumber/10-wireplumber.conf /etc/pipewire/pipewire.conf.d/
|
|
ln -sf /usr/share/applications/pipewire.desktop /etc/xdg/autostart/
|
|
#+end_src
|
|
|
|
Generate configurations.
|
|
#+begin_src shell
|
|
xbps-reconfigure -fa
|
|
#+end_src
|
|
|
|
Exit chroot, unmount disks, and reboot.
|
|
#+begin_src shell
|
|
exit
|
|
umount -lR /mnt
|
|
reboot
|
|
#+end_src
|