I was hoping to set up Endeavour with a custom partitioning scheme not directly supported by Calamares (as far as I can tell).
- Two drives, each with three partitions.
- Parition 1 on each is a Fat32 partition for esp, synced via pacman hooks.
- Parition 2 on each is a separate swap partition (on the theory that parallelizing swap will be good for performance)
- An mdadm raid-1 array mirroring the third partitions.
- The mdadm array formatted as xfs, with the options
su=64k,sw=1 -m crc=1,reflink=1
I have a script that seems like it ought to work, but when I run Calamares (online or offline), at the manual partitioning screenm, I only see the XFS-formatted md0, but not the existing fat32 and swap partitions, which means I cannot edit them and manually set their moutpoints.
Ideally, I would like to have a totally hands-off installation with everything preconfigured beforehand, but based on what I have read, the installer cannot go completely unsupervised and there is no automation-friendly alternative.
Is what I am trying to do realistic, or should I give up and just use plain Arch if I want special disk setups?
My current script:
#!/bin/bash
set -euo pipefail
# Devices
# DISK1="/dev/sdb"
# DISK2="/dev/sdg"
PRIMARY_DISPLAY=DP-2
DISK1=$1
DISK2=$2
# Partitions
ESP_SIZE="2GiB"
SWAP_SIZE="64GiB"
# Cleanup
sudo wipefs -a "$DISK1" "$DISK2"
sudo sgdisk --zap-all "$DISK1" "$DISK2"
# Partition layout: ESP (1), SWAP (2), RAID (3)
for DISK in "$DISK1" "$DISK2"; do
sudo sgdisk -n1:0:+$ESP_SIZE -t1:ef00 "$DISK"
sudo sgdisk -n2:0:+$SWAP_SIZE -t2:8200 "$DISK"
sudo sgdisk -n3:0:0 -t3:fd00 "$DISK"
done
# Wait for partitions
udevadm settle
# Create RAID1 array
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 \
"${DISK1}3" "${DISK2}3" --metadata=1.2
# Format partitions
sudo mkfs.vfat -F32 "${DISK1}1"
sudo mkfs.vfat -F32 "${DISK2}1"
sudo mkswap "${DISK1}2"
sudo mkswap "${DISK2}2"
# Format XFS with reflink and metadata checksum
sudo mkfs.xfs -d su=64k,sw=1 -m crc=1,reflink=1 /dev/md0
# Mount for Calamares
sudo mount /dev/md0 /mnt
sudo mkdir -p /mnt/boot
sudo mount "${DISK1}1" /mnt/boot
# Setup mdadm.conf for installed system
sudo mkdir -p /mnt/etc
sudo mdadm --detail --scan | sudo tee /mnt/etc/mdadm.conf
# Inform the kernel of partition table changes
sudo partprobe "$DISK1"
sudo partprobe "$DISK2"
# Copy Calamares config overrides
sudo mkdir -p /mnt/etc/calamares/modules
cat | sudo tee /mnt/etc/calamares/modules/partition.conf <<EOF
---
mount:
- mountPoint: /
device: /dev/md0
fs: xfs
format: false
- mountPoint: /boot
device: ${DISK1}1
fs: vfat
format: false
swap:
- device: ${DISK1}2
enabled: true
priority: 100
- device: ${DISK2}2
enabled: true
priority: 100
EOF
cat | sudo tee /mnt/etc/calamares/modules/bootloader.conf <<EOF
---
bootLoader: grub
efiBootLoader: true
EOF
# Create mirror-esp hook and script
sudo mkdir -p /mnt/usr/local/bin
cat | sudo tee /mnt/usr/local/bin/mirror-esp <<'EOS'
#!/bin/bash
set -euo pipefail
SRC=/boot
DST=/boot2
mkdir -p "$DST"
mount /dev/sdg1 "$DST"
rsync -a --delete "$SRC/" "$DST/"
umount "$DST"
EOS
sudo chmod +x /mnt/usr/local/bin/mirror-esp
sudo mkdir -p /mnt/etc/pacman.d/hooks
cat | sudo tee /mnt/etc/pacman.d/hooks/mirror-esp.hook <<EOF
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = linux*
[Action]
Description = Mirroring ESP to /dev/sdg1...
When = PostTransaction
Exec = /usr/local/bin/mirror-esp
EOF
# Create weston.ini to specify the primary display for Wayland
sudo mkdir -p /mnt/etc/xdg/weston
cat | sudo tee /mnt/etc/xdg/weston/weston.ini <<EOF
[output]
name=$PRIMARY_DISPLAY
primary=true
EOF
cat | sudo tee /mnt/etc/calamares/modules/packages.conf <<EOF
---
packages:
- base # Core system files
- linux-lts # Long-term support kernel
- linux-lts-headers # Kernel headers for building modules
# KDE Plasma and Applications
- plasma-meta # Base KDE Plasma desktop environment
- kde-applications-meta # Common KDE applications (incl. ark, kwallet, etc.)
# Networking & SSH
- openssh # SSH server/client
- fail2ban # Ban IPs after failed login attempts
- wireguard-tools # WireGuard VPN support
# Disk & Power Tools
- gptfdisk # GPT partitioning tools (gdisk)
- powertop # Power consumption tuner
- smartmontools # Disk SMART diagnostics
- hdparm # Disk parameter tuner
- nvme-cli # NVMe drive utility
- sysstat # iostat, mpstat, etc.
# RAID / ZFS
- zfs-dkms # ZFS kernel module (LTS-compatible)
# File & System Info Tools
- filelight # KDE disk usage visualizer
- fastfetch # Terminal system info display
- bat # Syntax-highlighted cat replacement
- ripgrep # Fast recursive grep
- exa # Enhanced ls alternative
- fzf # Fuzzy finder for terminal
- htop # Terminal process monitor
- bmon # Bandwidth monitor
- iftop # Real-time bandwidth usage by connection
- lsof # List open files
- strace # Trace system calls of a process
- nvtop # Real-time NVIDIA GPU process monitor
- usbutils # for lsusb, useful with peripheral debugging.
- pciutils # for lspci, helpful for hardware checking.
- ethtool # advanced network tuning.
- ntfs-3g # NTFS read/write support (for shared drives with Windows).
- rsync # rsync
- man-db # man-db
- man-pages # man-pages
# Dev & Shell Tools
- devtools # Arch packaging tools (makepkg, etc.)
- git # Version control system
- vim # Terminal text editor
- tmux # Terminal multiplexer
- stow # Dotfile symlink manager
- zsh # Z shell
- zsh-autosuggestions # Autosuggestions for Zsh
- zsh-autocomplete # Zsh completion enhancements
# KDE Wallet Integration
- kwallet # KDE Wallet backend
- kwalletmanager # GUI for managing KDE Wallets
- kwallet-pam # KDE Wallet PAM integration
- ksshaskpass # SSH key unlock integration for KDE
# Networking/Diagnostics
- nmap # Network scanner
- tcpdump # Packet capture tool
- netcat # Versatile networking tool
- traceroute # Trace route to a host
- wireshark-cli # CLI packet analyzer
# Multimedia & Audio
- ffmpeg # Media conversion and encoding
- gst-plugin-va # Video acceleration plugins (VA-API)
- strawberry # Music player (Qt-based alternative to Clementine)
# Downloads & Torrents
- transmission-qt # Qt-based torrent client
# Boot/Login Display
- sddm # KDE-compatible display/login manager
- xorg # X11 server
# Security
- yubikey-manager # YubiKey configuration utility
- gnupg # GPG encryption and key management
- gpgme # GPG API for applications
EOF
echo "Done. You can now launch Calamares and install to the prepared partitions."