Here’s a clear, step-by-step guide to rebuilding libmount + mount (util-linux) from source on Void Linux. This is usually not required, but if your system is broken due to version mismatches, building from source can fix it.
✅ 1. Install build dependencies#
You need the development tools and headers:
sudo xbps-install -Sy base-devel
sudo xbps-install -Sy pkg-config gettext-develVoid Linux splits packages, so you also need required -devel packages:
sudo xbps-install -Sy util-linux-develIf you’re rebuilding because util-linux is broken, the above command may fail — that’s okay, you can still build without it.
✅ 2. Download the latest util-linux source#
Util-linux contains mount, umount, libmount, etc.
wget https://www.kernel.org/pub/linux/utils/util-linux/v2.41/util-linux-2.41.tar.xz
tar xf util-linux-2.41.tar.xz
cd util-linux-2.41Replace 2.41 with the release you need.
✅ 3. Configure the build#
Run:
./configure --prefix=/usr --disable-all-programs --enable-mount --enable-libmountExplanation:
--prefix=/usr→ installs into/usr/binand/usr/lib--disable-all-programs→ disables everything except what you explicitly enable--enable-mount→ builds themountcommand--enable-libmount→ buildslibmount.so
✅ 4. Build it#
make -j$(nproc)This compiles mount and libmount.
✅ 5. Install (careful!)#
This can overwrite system binaries. Safer method: install to a temporary directory first.
make DESTDIR="$HOME/mount-test" installYou’ll find new binaries in:
$HOME/mount-test/usr/bin/mount
$HOME/mount-test/usr/lib/libmount.so.*Test them before installing system-wide.
⚠️ 6. Test without installing#
Run the newly-built mount using an absolute path:
$HOME/mount-test/usr/bin/mount --version
ldd $HOME/mount-test/usr/bin/mountMake sure it properly links to the newly built libmount.so.
⚠️ 7. If everything works, install to the system#
Only do this if your current system is already broken:
sudo make install🩹 If your system is badly broken#
You may also need to temporarily set:
export LD_LIBRARY_PATH=/usr/local/lib:/usr/libOr override mount’s linked library:
LD_PRELOAD=/usr/lib/libmount.so.1 mount🔍 Want easier debugging first?#
I can guide you through:
- checking conflicting libmount versions
- verifying the
/usr/libsymlinks - using
xbpsto fetch the correct.xbpspackage - reinstalling util-linux cleanly
If you want, tell me:
ls -l /usr/lib/libmount*
xbps-query -l | grep util-linux
mount --version