Installing alongside Arch Linux

From Void Linux Wiki
Jump to: navigation, search

Medic template.svgThis article or section needs expansion.

Reason: The Chroot section is incomplete. (Discuss)

This is a guide for advanced Arch users, who wish to try out Void Linux side by side with their usual setup. Instead of the usual GRUB2 and Dracut, we'll use Syslinux and mkinitcpio, which we already know and love from Arch. This guide may be incomplete, please extend and fix it.

Arch Linux Installation

Start by doing a full Arch install.

Recommended:

  • LVM with a spare partition for Void Linux / btrfs with separate subvolume for Void
  • Full disk encryption
  • Syslinux

Install Void from Arch

Install the Void Linux Package manager (xbps-git) from the AUR using the AUR helper of your choice, or boot from a live Void image.

Create a new partition for Void Linux and mount it:

# mkfs.ext4 /dev/mapper/lvm-voidlinux
# mount /dev/mapper/lvm-voidlinux /mnt/voidlinux

If using btrfs, simply mount the btrfs subvolume to the mount point. For example:

# mount -o compress=lzo,subvol=@void /dev/mapper/cryptroot /mnt/voidlinux

This assumes a flat structure of subvolumes, one which is mounted to / for your Arch installation (e.g. @arch) and one for your Void installation. You can optionally have a subvolume that is shared for your boot files that is mounted to /boot for both installations (assuming its not a UEFI installation). For example, the subvolume layout might look like:

subvolid=5
  |
  ├── @void
  |
  ├── @arch
  |
  └── @home

Mount boot:

# mkdir /mnt/voidlinux/boot
# mkdir /boot/voidlinux # subfolder avoids conflicts with arch
# mount --bind /boot/voidlinux /mnt/voidlinux/boot

Here, if using btrfs, one can use a separate subvolume to be mounted to /boot that can be shared between the installations (if not using UEFI).

Install the base system (option A: glibc - as used in Arch and other mainstream distributions):

# xbps-install -S -R http://repo.voidlinux.eu/current -r /mnt/voidlinux base-system

Install the base system (option B: musl libc - for the cool kids):

# export XBPS_ARCH=x86_64-musl
# xbps-install -S -R http://repo.voidlinux.eu/current/musl -r /mnt/voidlinux base-system

Chroot

Chroot into Void Linux:

# pacman -S arch-install-scripts
# touch /mnt/voidlinux/etc/resolv.conf
# arch-chroot /mnt/voidlinux

Set a root password and whatnot (detailed version):

# passwd root
# chown root:root /
# chmod 755 /
# echo totallynotarchlinux > /etc/hostname
# vi /etc/rc.conf
# vi /etc/fstab
# vi /etc/default/libc-locales # glibc only

Install Arch Linux' mkinitcpio in Void Linux and build your initramfs:

# xbps-install -S mkinitcpio mkinitcpio-encrypt mkinitcpio-udev
# exit
# cp /etc/mkinitcpio.conf /mnt/voidlinux/etc/mkinitcpio.conf
# cp /etc/vconsole.conf /mnt/voidlinux/etc/vconsole.conf
# arch-chroot /mnt/voidlinux
# mkinitcpio -g /boot/initramfs-4.2.8_1.img -k 4.2.8_1
# exit
Note: This setup will not create new initramfs images on kernel updates. A custom XBPS hook should be able to do that though, so this is your homework. Add it to the wiki, when you're done.

If running the locale command post-reboot returns an error like:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

then it might be necessary to run:

# xbps-install -f glibc-locales

Configure bootloader

Syslinux

Copy-paste the Arch Linux target in your /boot/syslinux/syslinux.cfg, rename it to Void Linux and change the root LVM partition, kernel image to (../voidlinux/vmlinuz-4.5.7_1) and initramfs (to something like ../voidlinux/initramfs-4.7.5_1.img). Now reboot.

GRUB

Simply copy your Arch entry in /boot/grub/grub.cfg to /etc/grub.d/40_custom and modify it for your Void installation to point to the initramfs and kernel images for Void. Then run grub-mkconfig in Arch. Alternatively, create grub.cfg in Void and make the custom entry for your Arch installation.

Post Installation

Familiarise with xbps and xbps-src, they work a bit different from pacman and makepkg. Runit is what you traded in systemd for. Also check out the Post Installation article.