Testing out minimal distros to run my hypervisor. Debian is fine and light enough, but the server doesn’t come for at least another day, so I’ve got time. I’ve been hearing about Arch for ever and I haven’t really looked into it, but it sounds exactly like what I’m looking for.
Arch boots into live cli environment, and then you have to manually partition the disk to start.
So, how do I want to do this?
Update the first partition must be the efi partition, and it cannot be in LVM, so do that first
fdisk /dev/sda
# g to create GPT table, n to make new, t to change type, and w to write
g
n
+1G
t
uefi
# make LVM partition
n
w
# boot partition is FAT32 - efi mandates as a standard
mkfs.fat -F 32 /dev/sda1
mkfs.fat -F 32 /dev/rootVG/bootLV
# swap
mkswap /dev/rootVG/swapLV
# the rest
mkfs.ext4 /dev/rootVG/rootLV
mount shit under /mnt. This better get less do-it-yourself real soon or I’m going back to debian. But, if I can slap these in a script I’ll be fine.
# mount root filesystem
mount /dev/rootVG/rootLV /mnt
# make all those mf mount points you just had to have
mount --mkdir /dev/rootVG/bootLV /mnt/boot
mount --mkdir /dev/rootVG/varLV /mnt/var
and so on...
# enable swap
swapon /dev/rootVG/swapLV
Package list:
base linux linux-firmware vim efibootmgr grub intel-ucode networkmanager dosfstools exfatprogs e2fsprogs ntfs-3g lvm2 sshd sudo
pacstrap -K /mnt base linux linux-firmware
fstab
# Generate an fstab file (use -U or -L for UUID or labels)
genfstab -L /mnt >> /mnt/etc/fstab
chroot to new install
# fancy smancy arch version of chroot
arch-chroot /mnt
set a bunch of shit you normally never have to…
# time zone
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
# hw clock
hwclock --systohc
# Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8
# fuck, install vim with 'pacman -S vim' if you forget it
locale-gen
# Create the locale.conf(5) file, and set the LANG variable accordingly
echo LANG=en_US.UTF-8 >> /etc/locale.conf
echo archkvm >> /etc/hostname
# because we are using LVM we need to create a new initramfs. Also needed for encryption and RAID.
# edit /etc/mkinitcpio.conf
# remove udev and replace with systemd
# insert vlm2 between block and filesystems
HOOKS=(base systemd ... block lvm2 filesystems)
# rebuild image
mkinitcpio -P
# install lvm2 and rebuild again because it gave you an error about exactly that
pacman -S lvm2
mkinitcpio -P
root password
passwd
install bootloader – I’m doing grub for now, but I may either put the /boot partition outside of LVM and load directly from UEFI.
# install grub and efibootmgr (if you haven't already)
pacman -S grub efibootmgr
# mount efi partition
mount --mkdir /dev/sda1 /boot/efi
# install grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
# make grub config
grub-mkconfig -o /boot/grub/grub.cfg
NOTE: it is here where you realize the efi partition can NOT be on an LVM partition, even though GRUB is fine with /boot being there. Starting over and updating notes. fml
cross fingers and reboot
# exit chroot
exit
umount -R /mnt
reboot
Aaaaannnd voila!!!
The most basic-bitch linux distro I’ve ever seen. Well, except for LFS, and I guess Gentoo was possibly worse because you had to wait five hours of compiling to realize you fucked up. But this is what I wanted. A Hypervisor should be very minimal.