Lstat /lib/libgdal.so.26.0.4 Bad message

I keep getting this error when doing operations such as apt purge and ldconfig

/sbin/ldconfig.real: Cannot lstat /lib/libgdal.so.26.0.4 Bad message

Google is not being of much use so I turn here…

I am running jetpack 5.1.1

For context I was attempting to get openCV with CUDA as seen in the instructions here…

Compiling OpenCV from Source | OpenCV | RidgeRun - RidgeRun Developer Connection

What do you see from:
ls -l /lib/lbgdal.so*

XX@ubuntu:/$ sudo ls -l /lib/lbgdal.so*
ls: cannot access ‘/lib/lbgdal.so*’: No such file or directory
XX@ubuntu:/$ sudo ls -l /lib/libgdal.so*
ls: cannot access ‘/lib/libgdal.so.26.0.4’: Bad message
XX@ubuntu:/$

when looking further

michael@ubuntu:/lib$ ls -a
ls: cannot access ‘libgdal.so.26.0.4’: Bad message
ls: cannot access ‘ppr’: Bad message
ls: cannot access ‘mono’: Bad message

That library is completely missing, at least in that location. That’s why it is failing.

What do you see from:
ls -l /usr/lib/libgdal.so*

And:
ls -l /usr/lib/ogdi/libgdsal.so*

What do you see from:
dpkg -l | grep 'libgdal'

XX@ubuntu:/$ sudo ls -l /usr/lib/libgdal.so*
[sudo] password for XX:
ls: cannot access ‘/usr/lib/libgdal.so.26.0.4’: Bad message

XX@ubuntu:/$ sudo ls -l /usr/lib/ogdi/libgdsal.so*
ls: cannot access ‘/usr/lib/ogdi/libgdsal.so*’: No such file or directory

XX@ubuntu:/$ dpkg -l | grep ‘libgdal’
ii libgdal26 3.0.4+dfsg-1build3 arm64 Geospatial Data Abstraction Library

It seems the package used to be there, but content is missing. Does this help?
sudo apt-get --reinstall install libgdal26
(check if the files show up)

XX@ubuntu:~$ sudo apt-get --reinstall install libgdal26
[sudo] password for XX:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
apt-clone archdetect-deb bogl-bterm busybox-static cryptsetup-bin cython3
dctrl-tools dpkg-repack freeglut3 gir1.2-gst-plugins-bad-1.0
gir1.2-timezonemap-1.0 gir1.2-xkl-1.0 grub-common libarmadillo-dev
libarpack2-dev libatk-bridge2.0-dev libatspi2.0-dev libavresample-dev
libavresample4 libblas-dev libcfitsio-dev libcfitsio-doc libcharls-dev
libdap-dev libdapserver7v5 libdbus-1-dev libdebian-installer4 libepoxy-dev
libepsilon-dev libexif-dev libflann-dev libflann1.9 libfreexl-dev
libfwupdplugin1 libfyba-dev libgdcm-dev libgdcm3.0 libgeos-dev libgif-dev
libgl2ps-dev libgl2ps1.4 libgphoto2-dev libhdf5-mpi-dev libhdf5-openmpi-103
libhdf5-openmpi-dev libilmbase-dev libjson-c-dev libjsoncpp-dev libkml-dev
libkmlconvenience1 libkmlregionator1 libkmlxsd1 liblapack-dev liblept5
libminizip-dev libnetcdf-c++4 libnetcdf-cxx-legacy-dev libogdi-dev
libogg-dev libopenexr-dev libopenjp2-7-dev libopenni-dev
libopenni-sensor-pointclouds0 libopenni0 libopenni2-0 libopenni2-dev
libpcl-apps1.10 libpcl-common1.10 libpcl-features1.10 libpcl-filters1.10
libpcl-io1.10 libpcl-kdtree1.10 libpcl-keypoints1.10 libpcl-ml1.10
libpcl-octree1.10 libpcl-outofcore1.10 libpcl-people1.10
libpcl-recognition1.10 libpcl-registration1.10 libpcl-sample-consensus1.10
libpcl-search1.10 libpcl-segmentation1.10 libpcl-stereo1.10
libpcl-surface1.10 libpcl-tracking1.10 libpcl-visualization1.10
libpoppler-dev libpoppler-private-dev libproj-dev libqhull-dev libqhull-r7
libqt5designercomponents5 libqt5positioning5 libqt5quickparticles5
libqt5quickshapes5 libqt5quicktest5 libqt5quickwidgets5 libqt5sensors5
libqt5webchannel5 libqt5webkit5 libqt5webkit5-dev libqt5x11extras5
libsocket++1 libspatialite-dev libsuperlu-dev libtesseract4 libtheora-dev
libtimezonemap-data libtimezonemap1 liburiparser-dev libvtk6.3 libvtk7-java
libvtk7-jni libvtk7.1p libvtk7.1p-qt libwayland-bin libwayland-dev
libwebp-dev libxerces-c-dev libxkbcommon-dev libxmlb1 libxss-dev libxt-dev
libxtst-dev libzstd-dev openni-utils os-prober python3-automat python3-cbor
python3-constantly python3-hamcrest python3-hyperlink python3-icu
python3-incremental python3-lz4 python3-mpi4py python3-opengl python3-pam
python3-png python3-pydot python3-pyqrcode python3-pyqt5.qtopengl
python3-pyqt5.qtwebkit python3-snappy python3-trie python3-twisted-bin
python3-u-msgpack python3-ubjson python3-wsaccel python3-zope.interface
qdoc-qt5 qhelpgenerator-qt5 qt5-assistant qtattributionsscanner-qt5
qtdeclarative5-dev qtdeclarative5-dev-tools qttools5-dev qttools5-dev-tools
qttools5-private-dev rdate ros-noetic-actionlib-tutorials
ros-noetic-common-tutorials ros-noetic-ddynamic-reconfigure
ros-noetic-geometry-tutorials ros-noetic-gl-dependency
ros-noetic-interactive-marker-tutorials ros-noetic-joint-state-publisher-gui
ros-noetic-librealsense2 ros-noetic-librviz-tutorial
ros-noetic-nodelet-tutorial-math ros-noetic-pcl-msgs
ros-noetic-pluginlib-tutorials ros-noetic-qt-dotgraph ros-noetic-qt-gui
ros-noetic-qt-gui-cpp ros-noetic-qt-gui-py-common ros-noetic-qwt-dependency
ros-noetic-ros-tutorials ros-noetic-roscpp-tutorials ros-noetic-roslint
ros-noetic-rospy-tutorials ros-noetic-rqt-action ros-noetic-rqt-bag
ros-noetic-rqt-bag-plugins ros-noetic-rqt-console ros-noetic-rqt-dep
ros-noetic-rqt-graph ros-noetic-rqt-gui ros-noetic-rqt-gui-cpp
ros-noetic-rqt-gui-py ros-noetic-rqt-launch ros-noetic-rqt-logger-level
ros-noetic-rqt-moveit ros-noetic-rqt-msg ros-noetic-rqt-nav-view
ros-noetic-rqt-plot ros-noetic-rqt-pose-view ros-noetic-rqt-publisher
ros-noetic-rqt-py-common ros-noetic-rqt-py-console
ros-noetic-rqt-reconfigure ros-noetic-rqt-robot-dashboard
ros-noetic-rqt-robot-monitor ros-noetic-rqt-robot-plugins
ros-noetic-rqt-robot-steering ros-noetic-rqt-runtime-monitor
ros-noetic-rqt-rviz ros-noetic-rqt-service-caller ros-noetic-rqt-shell
ros-noetic-rqt-srv ros-noetic-rqt-tf-tree ros-noetic-rqt-top
ros-noetic-rqt-topic ros-noetic-rqt-web ros-noetic-rviz-plugin-tutorials
ros-noetic-rviz-python-tutorial ros-noetic-turtle-actionlib
ros-noetic-turtle-tf ros-noetic-turtle-tf2 ros-noetic-turtlesim
ros-noetic-urdf-tutorial ros-noetic-visualization-marker-tutorials
ros-noetic-visualization-tutorials ros-noetic-webkit-dependency tasksel
tasksel-data tcl tcl-dev tcl-vtk7 tcl8.6-dev tk
ubuntu-advantage-desktop-daemon vtk7 wayland-protocols x11proto-record-dev
x11proto-scrnsaver-dev
Use ‘sudo apt autoremove’ to remove them.
The following packages will be REMOVED:
python3-twisted
0 upgraded, 0 newly installed, 1 reinstalled, 1 to remove and 5 not upgraded.
1 not fully installed or removed.
Need to get 5,373 kB of archives.
After this operation, 12.6 MB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 Index of /ubuntu-ports focal/universe arm64 libgdal26 arm64 3.0.4+dfsg-1build3 [5,373 kB]
Fetched 5,373 kB in 3s (2,065 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database … 213310 files and directories currently installed.)
Removing python3-twisted (18.9.0-11ubuntu0.20.04.2) …
dpkg: error processing package python3-twisted (–remove):
unable to securely remove ‘/usr/lib/python3/dist-packages/twisted/_threads/test/test_threadworker.py.dpkg-tmp’: Structure needs cleaning
dpkg: too many errors, stopping
Errors were encountered while processing:
python3-twisted
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Is this just something I will have to reinstall the OS for?

I see ROS in there. I think (but am far from certain) that ROS may be what interferes with that package. Let’s try something else first. Let’s remove no longer required packages, which has the command mentioned in that log:
sudo apt-get autoremove

After that, make sure to update:
sudo apt-get update

Then see if out of date packages can actually update (from packages still present):
sudo apt-get upgrade

Now see if that package is still listed (errors might have prevented getting this far though):
dpkg -l | grep 'libgdal'

Then search, and more than one libgdal package will show up, but see if that particular 26 version still shows up:
apt search libgdal

It might be time to remove libgdal and then reinstall it from scratch. My fear is that even if you reinstall, then possibly something from ROS might do this again (and I am guessing about ROS, although the apt command results from your above log guarantee ROS is at least related to the problem).

1 Like

I manged to get fix the file system using fsck and now i am able to reinstall libgdal26

When doing ls -l /usr/lib/libgdal.so*
XX@ubuntu:/$ ls -l /usr/lib/libgdal.so* lrwxrwxrwx 1 root root 17 Mar 29 2020 /usr/lib/libgdal.so.26 -> libgdal.so.26.0.4 -rw-r--r-- 1 root root 18426680 Mar 29 2020 /usr/lib/libgdal.so.26.0.4

The issue is now gone

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.