site  contact  subhomenews

First experiment creating a Void rootfs

September 17, 2023 — BarryK

This is fascinating! Previously, I haven't paid much attention to forum member's wiak and rockedge work with KLV/FirstRib projects. That's because I my attention was all on my own project. Then, very recently, I started to get interested in Void Linux -- really like it.

So, wondered about building EasyOS with Void Linux packages, and found that forum member peebee had already done a lot of work with VoidPup, with help from jamesbond, wiak and rockedge. Some scripts from VoidPup were very helpful and I soon had an EasyOS desktop running built from Void .xbps packages, and codenamed it "easyVoid". Created a forum thread to discuss this:

Decided need to understand the XBPS package manager better, and read some of wiak's explanations, as well as the online XBPS manual. Wiak described his "lightbulb moment" when he realised that he could create a simple rootfs using statically-linked 'busybox' and 'xbps' packages. This is a bootstrap rootfs, from which .xbps packages can be installed and a complete rootfs OS created, that can be chrooted-into, or booted-into from a bootloader such as GRUB or Limine.

wiak has created some great scripts to demonstrate this, for example this recent one:

"Build KLV xorg-minimal JWM mini"

I read some of his recent posts, also this very early one, in 2021:

"Building a root filesystem for use with WDL initrd"

As a learning exercise, I decided to create a script that builds a Void rootfs. But do it from scratch, written myself, so as to learn as much as possible. I created a tarball, that when expanded looks like this:


Inside the 'pkgs' folder:


...the same idea as wiak had, static 'busybox' and 'xbps' packages. Here is my 'populate-rootfs' script, broken up with extra explanation. Firstly there are two functions:


install_func() {
#pass in folder to be installed.
#currently in 'sandbox' folder.
#this will follow symlink folders in rootfs,
#do not follow if target file exists and is a symlink.
while read aF
if [ -d ${FOLDER}/"$aF" ];then
mkdir -p ../rootfs/"$aF"/
aD="$(dirname "$aF")"
mkdir -p ../rootfs/"$aD"/
if [ -h ${FOLDER}/"$aF" ];then
if [ -e ../rootfs/"$aF" ];then
if [ ! -h ../rootfs/"$aF" ];then
cp -a --remove-destination ${FOLDER}/"$aF" ../rootfs/"$aD"/
done <<_END1
$(find ${FOLDER} -mindepth 1 | sed -e "s%${FOLDER}/%%")

fix_symlinks_func() {
#simplify the symlinks. also detect circular symlinks.
#currently in 'sandbox' folder.
while read aL
[ ! "$aL" ] && continue
LANG=C busybox realpath ${aL} 2>&1 | grep -q 'Symbolic link loop'
if [ $? -eq 0 ];then
rm -f ../rootfs/usr/bin/${aL##*/} #delete circular loop.
aT="$(busybox readlink -n $aL)"
if [ -f ../rootfs/usr/bin/${aT##*/} ];then
if [ ! -h ../rootfs/usr/bin/${aT##*/} ];then
ln -snf ${aT##*/} ${aL} #simplify symlink.
done <<_END2
$(find ../rootfs/usr/bin -mindepth 1 -maxdepth 1 -type l)
while read aL
[ ! "$aL" ] && continue
LANG=C busybox realpath ${aL} 2>&1 | grep -q 'Symbolic link loop'
if [ $? -eq 0 ];then
rm -f ../rootfs/usr/lib/${aL##*/} #delete circular loop.
aT="$(busybox readlink -n $aL)"
if [ -f ../rootfs/usr/lib/${aT##*/} ];then
if [ ! -h ../rootfs/usr/lib/${aT##*/} ];then
ln -snf ${aT##*/} ${aL}
done <<_END2
$(find ../rootfs/usr/lib -mindepth 1 -maxdepth 1 -type l)

The purpose of these functions is for installing non-usrmerge packages. Well, in this case it is only my 'busybox' PET package. The first function makes sure that the installation follows the usr-merge folder hierarchy and doesn't overwrite a symlinked-folder. The second function tidies up the busybox applet symlinks.

Next, creation of the usr-merge folder hierarchy:

rm -rf rootfs 2>/dev/null
rm -rf sandbox 2>/dev/null
mkdir rootfs sandbox

cd rootfs
mkdir dev etc home mnt opt proc root run sys tmp usr var
mkdir -p usr/lib usr/bin
ln -s usr/bin bin
ln -s usr/bin sbin
ln -s bin usr/sbin
ln -s usr/lib lib
ln -s usr/lib lib64
ln -s lib usr/lib64
#some more...
mkdir -p usr/include usr/libexec usr/local/bin usr/share usr/lib32

Next, installing two local non-.xbps packages, 'busybox' and 'xbps-static':

###local non-xbps pkgs###
cd ../sandbox
# wget
../pet2dir ../pkgs/
install_func busybox-1.34.1-static-amd64
rm -f ../rootfs/pet.specs
rm -f ../rootfs/

mkdir xbps
tar -x --zstd --directory=xbps/ -f ../pkgs/xbps-static-static-0.59.1_6.x86_64-musl.tar.xz
install_func xbps

Next, I wanted to understand how to create a local repository of .xbps packages, so created a folder named 'repo' to put them in, and decided to install 'xbps-triggers'. The reason for doing this is that 'xbps-triggers' is required for installing .xbps packages from the online repositories. Although it can be installed later, as the first package installed after registering with an online repo, for the exercise, I decided to do it this way:

###local xbps pkgs###
cd ..
#install local .xbps pkgs using xbps package manager...
mkdir -p rootfs/repo
cp -a pkgs/xbps-triggers-0.125_1.x86_64.xbps rootfs/repo/
export XBPS_ARCH=x86_64
chroot rootfs /usr/bin/xbps-rindex -a /repo/xbps-triggers-0.125_1.x86_64.xbps
chroot rootfs /usr/bin/xbps-install --yes --repository=/repo xbps-triggers-0.125_1

...notice that XBPS_ARCH variable; xbps-install requires that.

Now to complete the bootstrap operation; register with an online repository and install the basic .xbps packages:

###online xbps pkgs###
#register online repo...
mkdir -p rootfs/etc/xbps.d
echo 'repository=' > rootfs/etc/xbps.d/00-repository-main.conf
echo 'repository=' > rootfs/etc/xbps.d/10-repository-nonfree.conf

###basic rootfs###
#SSL_NO_VERIFY_PEER=1 ./chroot-rootfs rootfs xbps-install -Suy xbps-triggers base-files xbps
#getting some "can't create ... system group (missing groupadd)" try add 'shadow' pkg...
SSL_NO_VERIFY_PEER=1 ./chroot-rootfs rootfs xbps-install -Suy xbps-triggers shadow base-files xbps
rm -f rootfs/usr/bin/*.static

...this installs the latest basic packages, including updating 'xbps-triggers' and 'xbps'. Notice the "SSL_NO_VERIFY_PEER=1" -- this is because accessing a https site is not yet setup. I did have the idea of installing a static 'openssl' binary, required to install the 'ca-certificates' package, but decided that is not necessary. Refer previous blog post:

That 'base-files' package takes care of that, installing 'ca-certificates', 'openssl, and other basic needed packages.

That's it ready to go. Install anything you want. You can chroot into the rootfs and run the 'xbps-install' program from inside, or just do it one-off like this in my script:

###install system rootfs###
./chroot-rootfs rootfs xbps-install -y base-system

###install jwm###
./chroot-rootfs rootfs xbps-install -y jwm

###install xorg###
./chroot-rootfs rootfs xbps-install -y xorg-server xorg-input-drivers xorg-video-drivers

ln -snf bash rootfs/usr/bin/sh #it was pointing to dash

...that installed 216 packages. Here is a list:

ii acl-2.3.1_1                          Access Control List filesystem support
ii acpid-2.0.34_2 ACPI Daemon (acpid) With Netlink Support
ii attr-2.5.1_1 Extended attribute support library for ACL support
ii base-files-0.143_3 Void Linux base system files
ii base-system-0.114_1 Void Linux base system meta package
ii bash-5.2.015_1 GNU Bourne Again Shell
ii brotli-1.1.0_1 Generic-purpose lossless compression algorithm
ii btrfs-progs-6.3.3_1 Btrfs filesystem utilities
ii bzip2-1.0.8_2 Freely available, patent free, high-quality data compressor
ii ca-certificates-20230311+3.92_1 Common CA certificates for SSL/TLS from Mozilla
ii cairo-1.16.0_2 Vector graphics library with cross-device output support
ii coreutils-9.3_1 GNU core utilities
ii cpio-2.14_1 GNU copy-in/out (cpio) with remote magnetic tape (rmt) support
ii dash-0.5.12_1 POSIX-compliant Unix shell, much smaller than GNU bash
ii dbus-libs-1.14.8_1 Message bus system - shared libraries
ii device-mapper-2.02.188_1 Device Mapper userspace library and tools
ii dhcpcd-10.0.2_1 RFC2131 compliant DHCP client
ii diffutils-3.10_1 GNU diff utilities
ii dnssec-anchors-20230213_1 DNSSEC trust anchors for the root zone
ii dosfstools-4.2_1 DOS filesystem tools
ii dracut-059_4 Low-level tool for generating an initramfs/initrd image
ii e2fsprogs-1.47.0_1 Ext2/3/4 Filesystem Utilities
ii e2fsprogs-libs-1.47.0_1 Ext2/3/4 Filesystem Utilities - shared libraries
ii ethtool-6.3_1 Utility for controlling network drivers and hardware
ii eudev-3.2.12_1 Fork of systemd-udev (enhanced userland device daemon)
ii eudev-libudev-3.2.12_1 Fork of systemd-udev (enhanced userland device daemon) - runtime library
ii expat-2.5.0_1 XML parser library written in C
ii f2fs-tools-1.15.0_1 Tools for the Linux Flash-Friendly File System (F2FS)
ii file-5.45_1 File type identification utility
ii findutils-4.9.0_1 GNU Find Utilities
ii fontconfig-2.14.2_1 Library for configuring and customizing font access
ii freetype-2.13.1_1 Font rendering engine and library API
ii fribidi-1.0.13_1 Free Implementation of the Unicode Bidirectional Algorithm
ii gawk-5.1.1_1 GNU awk utility
ii gdk-pixbuf-2.42.10_2 Image loading library for The GTK+ toolkit (v2)
ii glib-2.76.1_1 GNU library of C routines
ii glibc-2.36_1 GNU C library
ii glibc-locales-2.36_1 GNU C library - locale data files
ii gmp-6.3.0_1 Library for arbitrary precision arithmetic
ii graphite-1.3.14_1 Reimplementation of the SIL Graphite text processing engine
ii grep-3.11_1 GNU grep utility
ii gzip-1.13_1 GNU compression utility (replacement for compress)
ii hwids-0.373_1 Hardware Identification Databases
ii iana-etc-20230629_1 Unix /etc/services and /etc/protocols files
ii icu-libs-73.2_2 Robust and fully-featured Unicode libraries - shared libs
ii inih-57_1 Simple ini file parser library
ii iproute2-6.4.0_1 IP Routing Utilities
ii iptables-1.8.9_1 Linux IPv[46] packet filtering ruleset
ii iputils-20221126_1 Useful utilities for Linux networking (including ping)
ii ipw2100-firmware-1.3_6 Firmware for the Intel PRO/Wireless 2100 wifi cards
ii ipw2200-firmware-3.1_6 Firmware for the Intel PRO/Wireless 2200BG wifi cards
ii iw-5.19_1 Utility for nl80211 based CLI configuration of wireless devices
ii jbigkit-libs-2.2_2 Data compression library/utilities for bi-level high-resolution images - shared libraries
ii jwm-2.4.3_1 Light-weight window manager for the X11 Window System
ii kbd-2.6.2_1 Linux keyboard utilities
ii kmod-30_1 Linux kernel module handling
ii kpartx-0.9.6_1 Create device maps from partition tables
ii less-643_1 Pager program similar to more(1)
ii libICE-1.1.1_1 Inter Client Exchange (ICE) library for X
ii libSM-1.2.4_1 X Session Management Library
ii libX11-1.8.6_1 Base X libraries from Xorg
ii libXau-1.0.11_1 Authorization Protocol for X
ii libXdmcp-1.1.4_1 X Display Manager Control Protocol library
ii libXext-1.3.5_1 X Extension library
ii libXfixes-6.0.1_1 Xfixes library and extension of X RandR from modular
ii libXfont2-2.0.6_1 X font 2 Library
ii libXft-2.3.8_1 Library for configuring and customizing font access
ii libXi-1.8.1_1 X Input extension library
ii libXinerama-1.1.5_1 X PanoramiX extension library
ii libXmu-1.1.4_1 X Miscellaneous Utilities library
ii libXpm-3.5.16_1 X PixMap Library from modular Xorg X11
ii libXrandr-1.5.3_1 X RandR Library from
ii libXrender-0.9.11_1 X Render Library
ii libXt-1.3.0_1 X Toolkit Intrinsics library
ii libXtst-1.2.4_1 X Tst Library
ii libXvMC-1.0.13_1 XVideo Motion Compensation Library
ii libXxf86vm-1.1.5_1 Library for the XFree86-VidMode X extension
ii libaio-0.3.113_1 Linux-native asynchronous I/O facility (aio) library
ii libarchive-3.6.2_3 Library to read/write several different streaming archive formats
ii libblkid-2.38.1_4 Library to handle device identification
ii libcap-2.69_2 POSIX.1e capabilities suite
ii libcap-ng-0.8.3_2 Alternate POSIX capabilities library
ii libcap-progs-2.69_2 POSIX.1e capabilities suite - utilities
ii libcrypto3-3.1.2_1 Toolkit for Secure Sockets Layer and Transport Layer Security - crypto library
ii libdatrie-0.2.13_1 Implementation of double-array structure for representing trie
ii libdb-5.3.28_8 Berkeley DB embedded database system - C shared libraries
ii libdrm-2.4.115_1 Userspace interface to kernel DRM services
ii libedit-20230828.3.1_1 Port of the NetBSD Command Line Editor Library
ii libelf-0.189_1 Utilities to handle ELF object files - runtime library
ii libepoxy-1.5.10_1 Library for handling OpenGL function pointer management for you
ii libevdev-1.13.0_1 Wrapper library for evdev devices
ii libfdisk-2.38.1_4 Library for fdisk(8)
ii libffi-3.3_2 Library supporting Foreign Function Interfaces
ii libfontenc-1.1.7_1 Fontenc Library from
ii libgbm-23.1.3_1 Mesa Generic buffer management API - runtime
ii libgcc-12.2.0_3 GNU Compiler Collection - GCC library
ii libglapi-23.1.3_1 Free implementation of the GL API - shared library
ii libglvnd-1.6.0_1 GL Vendor-Neutral Dispatch library
ii libgudev-237_1 Library providing GObject bindings for libudev
ii libharfbuzz-8.2.0_1 OpenType text shaping engine - runtime library
ii libinput-1.23.0_1 Provides handling input devices in Wayland compositors and X
ii libjpeg-turbo- Derivative of libjpeg which uses SIMD instructions
ii libkmod-30_1 Linux kernel module handling - runtime shared library
ii libldap-2.4.58_2 OpenLDAP (Lightweight Directory Access Protocol) library
ii libldns-1.8.3_2 Modern DNS/DNSSEC library
ii libllvm15-15.0.7_1 Low Level Virtual Machine - runtime library
ii liblz4-1.9.4_1 LZ4 compression library
ii liblzma-5.4.4_1 XZ-format compression library
ii libmagic-5.45_1 File type identification library
ii libmnl-1.0.5_1 Minimalistic user-space library oriented to Netlink developers
ii libmount-2.38.1_4 Library for mount(8)
ii libnetfilter_conntrack-1.0.9_1 Library providing an API to the in-kernel connection tracking table
ii libnfnetlink-1.0.2_1 Low-level library for netfilter kernel/userspace communication
ii libnftnl-1.2.6_1 Low-level netlink interface to nf_tables
ii libnl3-3.5.0_1 Netlink Protocol Library Suite
ii libpcap-1.10.3_1 System-independent interface for user-level packet capture
ii libpciaccess-0.16_1 X11 PCI Access library
ii libpcre2-10.42_1 Perl Compatible Regular Expressions (2nd version) - shared libraries
ii libpng-1.6.40_1 Library for manipulating PNG images
ii libreadline8-8.2.001_1 GNU Readline Library
ii librsvg-2.56.3_1 SVG library for GNOME
ii libsasl-2.1.28_1 Cyrus SASL - runtime shared libraries
ii libsensors-3.6.0_1 Library to read temperature/voltage/fan sensors
ii libsmartcols-2.38.1_4 Table or Tree library from util-linux
ii libssl3-3.1.2_1 Toolkit for Secure Sockets Layer and Transport Layer Security - SSL/TLS library
ii libstdc++-12.2.0_3 GNU Compiler Collection - Standard C++ Library
ii libthai-0.1.29_1 Thai language support routines
ii libtirpc-1.3.2_1 Transport Independent RPC library (SunRPC replacement)
ii liburcu-0.14.0_1 Userspace RCU (read-copy-update) library
ii libusb-1.0.26_1 Library which allows userspace access to USB devices
ii libuuid-2.38.1_4 UUID library
ii libwacom-2.7.0_1 Library to identify wacom tablets
ii libxatracker-23.1.3_1 Mesa XA tracker interface library
ii libxbps-0.59.1_10 XBPS package system utilities - runtime library
ii libxcb-1.16_1 X protocol C-language Binding
ii libxcvt-0.1.2_1 VESA CVT standard timing modelines generator
ii libxkbfile-1.1.2_1 Xkbfile Library from
ii libxml2-2.11.4_3 Library providing XML and HTML support
ii libxshmfence-1.3_2 X Shared memory 'SyncFence' synchronization primitive
ii libzstd-1.5.5_2 Fast real-time compression algorithm
ii linux-6.3_1 Linux kernel meta package
ii linux-base-2023.05.29_1 Linux kernel base dependencies
ii linux-firmware-amd-20230804_1 Binary firmware blobs for the Linux kernel - AMD CPU/GPU microcode
ii linux-firmware-broadcom-20230804_1 Binary firmware blobs for the Linux kernel - Broadcom network blobs
ii linux-firmware-intel-20230804_1 Binary firmware blobs for the Linux kernel - Intel CPU/GPU microcode
ii linux-firmware-network-20230804_1 Binary firmware blobs for the Linux kernel - network
ii linux-firmware-nvidia-20230804_1 Binary firmware blobs for the Linux kernel NVIDIA GPU microcode
ii linux6.3-6.3.13_1 Linux kernel and modules (6.3 series)
ii lzo-2.10_2 Portable lossless data compression library
ii man-pages-6.05.01_1 Linux Documentation Project (LDP) manual pages
ii mdocml-1.14.6_7 UNIX manpage compiler toolset (mandoc)
ii mesa-23.1.3_1 Open source implementation of OpenGL and Vulkan
ii mesa-dri-23.1.3_1 Mesa DRI drivers
ii mit-krb5-libs-1.21.2_2 MIT Kerberos 5 implementation - runtime libraries
ii mtdev-1.1.6_1 Multitouch Protocol Translation Library
ii ncurses-6.4_1 System V Release 4.0 curses emulation library
ii ncurses-base-6.4_1 System V Release 4.0 curses emulation library - base terminfo files
ii ncurses-libs-6.4_1 System V Release 4.0 curses emulation library -- shared libraries
ii nettle-3.9.1_1 Low-level cryptographic library
ii nvi-1.81.6_19 Berkeley Vi Editor
ii openssh-9.4p1_2 OpenSSH free Secure Shell (SSH) client and server implementation
ii openssl-3.1.2_1 Toolkit for Secure Sockets Layer and Transport Layer Security
ii pam-1.5.3_2 Flexible mechanism for authenticating users
ii pam-base-0.4_2 PAM base configuration files
ii pam-libs-1.5.3_2 Flexible mechanism for authenticating users - runtime libraries
ii pango-1.50.14_1 Library for layout and rendering of text
ii pango-xft-1.50.14_1 Library for layout and rendering of text - X font rendering
ii pciutils-3.10.0_1 PCI bus related utilities
ii pixman-0.42.2_1 Library of low-level pixel manipulation routines
ii procps-ng-4.0.4_1 Utilities for monitoring your system and its processes
ii removed-packages-0.1.20230905_1 Uninstalls packages removed from repository
ii run-parts-4.11.2_2 Run scripts or programs in a directory
ii runit-2.1.2_15 UNIX init scheme with service supervision
ii runit-void-20230413_1 Void Linux runit scripts
ii sed-4.9_1 The GNU stream editor
ii shadow-4.8.1_2 Shadow password file utilities
ii shared-mime-info-2.2_1 Core database of common types
ii sudo-1.9.14p3_1 Allow others to run commands as root
ii tar-1.35_1 GNU tape archiver with remote magnetic tape support
ii tiff-4.5.1_1 Library and tools for reading and writing TIFF data files
ii traceroute-2.1.3_1 Traces the route taken by packets over an IPv4/IPv6 network
ii tzdata-2023a_2 Time zone and daylight-saving time data
ii usbutils-015_1 Linux USB utilities
ii util-linux-2.38.1_4 Miscellaneous linux utilities
ii util-linux-common-2.38.1_4 Miscellaneous linux utilities - common files
ii void-artwork-20221013_1 Void Linux artwork
ii wayland-1.22.0_1 Core Wayland window system code and protocol
ii which-2.21_4 Displays where a particular program in your path is located
ii wifi-firmware-1.3_4 WiFi firmware meta-package
ii wpa_supplicant-2.10_3 WPA/WPA2/IEEE 802.1X Supplicant
ii xbps-0.59.1_10 XBPS package system utilities
ii xbps-triggers-0.125_1 XBPS triggers for Void Linux
ii xcb-util-0.4.1_1 XCB utilities library
ii xf86-input-evdev-2.10.6_2 Xorg event device input driver
ii xf86-input-libinput-1.4.0_1 Generic input driver for the X.Org server based on libinput
ii xf86-input-synaptics-1.9.2_1 Xorg synaptics touchpad input driver
ii xf86-input-vmmouse-13.2.0_1 Xorg VMware virtual mouse input driver
ii xf86-input-wacom-1.2.0_1 Xorg Wacom tablet input driver
ii xf86-video-amdgpu-23.0.0_1 Xorg AMD Radeon RXXX video driver (amdgpu kernel module)
ii xf86-video-ati-22.0.0_1 Xorg ATI Radeon video driver
ii xf86-video-dummy-0.4.1_1 Xorg dummy video driver
ii xf86-video-fbdev-0.5.0_2 Xorg framebuffer video driver
ii xf86-video-intel-2.99.917.20210115_2 Xorg DDX Intel video driver
ii xf86-video-nouveau-1.0.17_2 Xorg opensource NVIDIA video driver
ii xf86-video-vesa-2.6.0_1 Xorg VESA video driver
ii xf86-video-vmware-13.4.0_1 Modular Xorg VMware virtual video driver
ii xfsprogs-6.4.0_1 Utilities for managing the XFS filesystem
ii xkbcomp-1.4.6_1 XKBD keymap compiler
ii xkeyboard-config-2.39_1 X Keyboard Configuration Database
ii xorg-input-drivers-7.6_4 input drivers meta-package
ii xorg-server-21.1.8_2 X11 server from
ii xorg-server-common-21.1.8_2 X11 server from common files
ii xorg-video-drivers-7.6_22 video drivers meta-package
ii zd1211-firmware-1.5_3 Firmware for the Zydas 1211 wifi cards
ii zlib-1.3_1 Compression/decompression Library

...pretty good for starting off a Linux distro, hey!

I did create an entry in Limine 'limine.cfg':

:Void rootfs sdb4
#KERNEL_CMDLINE=rw root=PARTUUID=1dea0b31-b2e5-4e7a-9952-d0b65a6fe0cc rootfstype=ext4
KERNEL_CMDLINE=rw root=/dev/sdb4 rootfstype=ext4

...however, got "Dracut warning: can't mount root filesystem" kernel panic. Don't know why. Those commented lines are tries to fix it.

Anyway, the idea is there, it should be possible to boot into the rootfs. I won't upload the script and packages, as will keep developing. This is an early learning exercise.    

Tags: easy