How to Fix “Can’t Find ext2fs Library” Error When Installing extundelete-0.2.0 on CentOS 5.6


2 views

You're encountering this error because the extundelete tool relies on the ext2fs library (part of e2fsprogs-devel) for low-level ext filesystem operations. While your system has e2fsprogs and e2fsprogs-libs installed, the development headers are required for compilation.

First, let's confirm what's actually installed:


# Check installed e2fsprogs packages
rpm -qa | grep e2fsprogs

# Verify library paths
ldconfig -p | grep ext2fs

For CentOS 5.6, you'll need to explicitly install the development package:


yum install e2fsprogs-devel

If you're getting dependency errors due to the older OS version, try:


yum --disablerepo=\* --enablerepo=base install e2fsprogs-devel

If the standard package isn't available, you can compile from source:


wget https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.39/e2fsprogs-1.39.tar.gz
tar xvf e2fsprogs-1.39.tar.gz
cd e2fsprogs-1.39
./configure
make
make install

After installation, ensure the linker can find the libraries:


export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
ldconfig

Now try configuring extundelete again with explicit paths:


./configure LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include"
make
sudo make install

If you still encounter issues:

  • Check /usr/local/lib for libext2fs.* files
  • Verify /etc/ld.so.conf includes relevant paths
  • Consider using a newer CentOS version if possible

When attempting to install extundelete-0.2.0 on CentOS 5.6, the configure script fails with the critical error:

./configure
Configuring extundelete 0.2.0
configure: error: Can't find ext2fs library

This occurs despite having e2fsprogs packages installed:

yum list |grep e2fs
e2fsprogs.i386 1.39-33.el5 installed
e2fsprogs-libs.i386 1.39-33.el5 installed
e2fsprogs-devel.i386 1.39-33.el5 base

The extundelete utility specifically requires the ext2fs development libraries to compile. While the base e2fsprogs packages are present, the system isn't properly locating the development headers and libraries during compilation.

After testing multiple approaches, here's the most reliable fix:

# Install required development packages
yum install e2fsprogs-devel -y

# Specify library paths explicitly
export CFLAGS="-I/usr/include/et -I/usr/include/e2fsprogs"
export LDFLAGS="-L/lib -L/usr/lib -lext2fs"

# Then run configure
./configure

If you've built e2fsprogs from source, use these configure options:

./configure --with-ext2fs-lib=/path/to/lib \
            --with-ext2fs-includes=/path/to/include

If the issue persists:

  • Verify the exact path to libext2fs: find / -name "libext2fs*" 2>/dev/null
  • Check for 32/64 bit mismatch if on x86_64 systems
  • Try installing compat packages: yum install e2fsprogs-libs.i686

Here's a full working sequence:

# Clean start
make distclean
rm -rf config.cache

# Set environment
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH

# Configure
./configure --prefix=/usr/local

# Build and install
make
make install