Skip to content

Instantly share code, notes, and snippets.

@ndgnuh
Last active September 20, 2019 09:25
Show Gist options
  • Save ndgnuh/2c8805f2b4f81af9bb1f517a00cfc191 to your computer and use it in GitHub Desktop.
Save ndgnuh/2c8805f2b4f81af9bb1f517a00cfc191 to your computer and use it in GitHub Desktop.
Compile/maintain void linux packages in chroot (for foreign distro users).

What is this for?

For people who don't use Void Linux, but want to use Void's xbps-src or maintain packages in Void's repo.

First setup

Create a loop device image. Change the count number if you want smaller/bigger image file.

sudo dd if=/dev/zero of=void.img bs=100M count=50
sudo losetup -fP void.img

After that, check your newly create loop device. In my case, the device is /dev/loop0.

losetup -a
/dev/loop0: []: (/path/to/void.img)

Format to ext4 and mount it.

sudo mkfs.ext4 /dev/loop0
sudo mkdir /mnt/void
sudo mount -o loop /dev/loop0 /mnt/void

Download the latest ROOTFS tarball from Void linux repo, extract it.

sudo wget https://alpha.de.repo.voidlinux.org/live/current/void-<your-arch-here>-ROOTFS-20181111.tar.xz
# or download manually here https://alpha.de.repo.voidlinux.org/live/current/
sudo tar xpfv <ROOTFS FILENAME>.tar.xz --xattrs-include='*.*' --numeric-owner

Chroot into /mnt/void

sudo chroot /mnt/void

Setup working DNS

echo 'nameserver 8.8.8.8' > /etc/resolv.conf

Install required stuff.

xbps-install -Su
xbps-install -S git proot eudev

Your Void chroot system is now ready.

Use proot instead of xbps-uunshare

I don't know how to get it working, even after adding the user to xbuilder group. In your void-packages folder run:

echo XBPS_CHROOT_CMD=proot >> etc/conf

Working with void-packages

Start working

sudo mount -o loop void.img /mnt/void
sudo mkdir /mnt/void/void-packages # if it didn't exist
sudo mount --bind /path/to/void-packages /mnt/void/void-packages
sudo mount --bind /proc /mnt/void/proc
sudo mount --bind /sys /mnt/void/sys
sudo mount --bind /dev /mnt/void/dev
# or just clone the void-repo there, but i don't think that's a good idea since it will make your img file big.

When you are done

sudo umount --recursive /mnt/void
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment