Skip to content

Instantly share code, notes, and snippets.

@nihilismus
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nihilismus/3888a82b6f83eda9a837 to your computer and use it in GitHub Desktop.
Save nihilismus/3888a82b6f83eda9a837 to your computer and use it in GitHub Desktop.
script to search for missing packages using ldd, objdump and slackpkg.
root@slackware-current: cat missing-packages.log
Searching with ldd...
/usr/bin/capinfos [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/capinfos [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/capinfos [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/captype [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/captype [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/dftest [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/dftest [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/dftest [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/dumpcap [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/editcap [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/editcap [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/mergecap [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/mergecap [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/randpkt [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/randpkt [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/rawshark [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/rawshark [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/rawshark [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/reordercap [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/reordercap [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/transmission-gtk [transmission-2.84-x86_64-3_hba] => libicule.so.51 [?]
/usr/bin/transmission-gtk [transmission-2.84-x86_64-3_hba] => libicuuc.so.51 [?]
/usr/bin/transmission-gtk [transmission-2.84-x86_64-3_hba] => libicudata.so.51 [?]
/usr/bin/tshark [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/tshark [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/tshark [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/wireshark [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/wireshark [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/wireshark [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/wireshark-qt [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/wireshark-qt [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/wireshark-qt [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
Searching with objdump...
/usr/lib64/alsa-lib/libasound_module_pcm_a52.so [alsa-plugins-1.0.28-x86_64-1_hba] => libavcodec.so.55 [?]
/usr/lib64/alsa-lib/libasound_module_pcm_a52.so [alsa-plugins-1.0.28-x86_64-1_hba] => libavutil.so.52 [?]
/usr/lib64/alsa-lib/libasound_module_rate_lavcrate.so [alsa-plugins-1.0.28-x86_64-1_hba] => libavcodec.so.55 [?]
/usr/lib64/alsa-lib/libasound_module_rate_lavcrate.so [alsa-plugins-1.0.28-x86_64-1_hba] => libavutil.so.52 [?]
/usr/lib64/cmus/ip/cdio.so [cmus-2.6.0-x86_64-1_hba] => libcdio_cdda.so.1 [?]
/usr/lib64/cmus/ip/cdio.so [cmus-2.6.0-x86_64-1_hba] => libcdio.so.13 [?]
/usr/lib64/cmus/ip/ffmpeg.so [cmus-2.6.0-x86_64-1_hba] => libavformat.so.55 [?]
/usr/lib64/cmus/ip/ffmpeg.so [cmus-2.6.0-x86_64-1_hba] => libswresample.so.0 [?]
/usr/lib64/imlib2/loaders/gif.so [imlib2-1.4.7-x86_64-1_hba] => libgif.so.4 [?]
root@slackware-current:
root@slackware-current: cat missing-packages.log
Searching with ldd...
/usr/bin/animate [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/animate [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/animate [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/compare [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/compare [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/compare [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/composite [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/composite [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/composite [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/conjure [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/conjure [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/conjure [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/convert [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/convert [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/convert [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/display [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/display [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/display [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/emacs-24.5-with-x11 [emacs-24.5-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/emacs-24.5-with-x11 [emacs-24.5-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/identify [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/identify [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/identify [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/import [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/import [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/import [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/mogrify [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/mogrify [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/mogrify [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/montage [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/montage [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/montage [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/stream [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/stream [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/bin/stream [imagemagick-6.9.1_7-x86_64-1] => libwmflite-0.2.so.7 [libwmf-0.2.8.4-x86_64-6]
/usr/lib64/qt/bin/assistant [qt-4.8.7-x86_64-1] => libgstapp-1.0.so.0 [gst-plugins-base-1.4.5-x86_64-1]
/usr/lib64/qt/bin/assistant [qt-4.8.7-x86_64-1] => libgstpbutils-1.0.so.0 [gst-plugins-base-1.4.5-x86_64-1]
/usr/lib64/qt/bin/assistant [qt-4.8.7-x86_64-1] => libgstvideo-1.0.so.0 [gst-plugins-base-1.4.5-x86_64-1]
/usr/lib64/qt/bin/assistant [qt-4.8.7-x86_64-1] => libgstaudio-1.0.so.0 [gst-plugins-base-1.4.5-x86_64-1]
/usr/lib64/qt/bin/assistant [qt-4.8.7-x86_64-1] => libgstbase-1.0.so.0 [gstreamer-1.4.5-x86_64-1]
/usr/lib64/qt/bin/assistant [qt-4.8.7-x86_64-1] => libgstreamer-1.0.so.0 [gstreamer-1.4.5-x86_64-1]
Searching with objdump...
/usr/lib64/kde4/kcm_adobe_flash_player.so [flashplayer-plugin-11.2.202.491-x86_64-1_hba] => libkdeui.so.5 [kdelibs-4.14.6-x86_64-1]
/usr/lib64/kde4/kcm_adobe_flash_player.so [flashplayer-plugin-11.2.202.491-x86_64-1_hba] => libkutils.so.4 [kdelibs-4.14.6-x86_64-1]
/usr/lib64/kde4/kcm_adobe_flash_player.so [flashplayer-plugin-11.2.202.491-x86_64-1_hba] => libkdecore.so.5 [kdelibs-4.14.6-x86_64-1]
/usr/lib64/python2.7/lib-dynload/_tkinter.so [python-2.7.10-x86_64-1] => libtk8.6.so [tk-8.6.4-x86_64-1]
/usr/lib64/qt/plugins/sqldrivers/libqsqlmysql.so [qt-4.8.7-x86_64-1] => libmysqlclient.so.18 [mariadb-10.0.18-x86_64-1]
/usr/lib64/qt/plugins/sqldrivers/libqsqlodbc.so [qt-4.8.7-x86_64-1] => libiodbc.so.2 [libiodbc-3.52.10-x86_64-1]
/usr/lib64/vlc/plugins/codec/libx264_plugin.so [vlc-2.2.1-x86_64-2_hba] => libx264.so.138 [?]
/usr/lib64/vlc/plugins/demux/libmkv_plugin.so [vlc-2.2.1-x86_64-2_hba] => libmatroska.so.5 [?]
/usr/lib64/vlc/plugins/demux/libmkv_plugin.so [vlc-2.2.1-x86_64-2_hba] => libebml.so.3 [?]
/usr/lib64/zathura/cb.so [zathura-cb-0.1.2-x86_64-1_hba] => libgirara-gtk3.so.1 [?]
/usr/lib64/zathura/ps.so [zathura-ps-0.2.2-x86_64-1_hba] => libgirara-gtk3.so.1 [?]
#!/bin/sh
# bob-missing-packages: searches for missing packages using ldd,
# objdump and slackpkg.
#
# Copyright © 2015 Antonio Hernández Blas <hba.nihilismus@gmail.com>
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://www.wtfpl.net/ for more details.
search_with_ldd() {
echo "Searching with ldd..."
for dir in $(echo $PATH | sed 's/:/ /g' | sort); do
if [ -d $dir ]; then
for file in $(find $dir -type f | sort); do
if [ ! -x "$file" ]; then
continue
fi
if [ "$file" = "/sbin/ldconfig" ]; then
continue
fi
if grep "$(echo $file | sed 's:^/::')" /var/log/packages/glibc* 1>/dev/null 2>/dev/null; then
continue
fi
if grep "$(echo $file | sed 's:^/::')" /var/log/packages/gcc* 1>/dev/null 2>/dev/null; then
continue
fi
echo ":: $file ..."
if file $file | grep 'ELF' 1>/dev/null; then
if ldd $file | grep 'not found' 1>/dev/null; then
pkg=$(basename $(grep -E "^$(echo $file | sed 's:^/::')$" --recursive /var/log/packages | sed 's/:.*//'))
libraries=$(ldd $file | grep 'not found' | sed 's/ =>.*//')
for library in $libraries; do
in_package="$(slackpkg file-search $library | grep uninstalled | sed 's/^.* //' | xargs)"
if [ -z "$in_package" ]; then
in_package="$(grep $library --recursive /var/log/packages | sed -e 's/:.*//' -e 's:.*/::')"
if [ -n "$in_package" ]; then
continue
fi
in_package="?"
fi
echo "$file [$pkg] => $library [$in_package]"
done
fi
fi
done
fi
done
}
search_with_objdump() {
echo "Searching with objdump..."
ldconfig_temp=$(mktemp /tmp/ldconfig_temp.XXXXXX)
ldconfig -v 2>/dev/null 1>$ldconfig_temp
for pkgfile in $(grep -E '\.so$' --recursive /var/log/packages | sort); do
pkg=$(basename $(echo $pkgfile | sed 's/:.*//'))
file=$(echo $pkgfile | sed 's/^.*:/\//')
if [ -x $file ]; then
if grep "$(echo $file | sed 's:^/::')" /var/log/packages/glibc* 1>/dev/null 2>/dev/null; then
continue
fi
if grep "$(echo $file | sed 's:^/::')" /var/log/packages/gcc* 1>/dev/null 2>/dev/null; then
continue
fi
echo ":: $file ..."
libraries=""
if objdump -x $file 2>/dev/null | grep 'NEEDED' 1>/dev/null; then
libraries=$(objdump -x $file 2>/dev/null | grep 'NEEDED' | sed 's/^.* //')
for library in $libraries; do
if ! ldconfig -v 2>/dev/null | grep $library 1>/dev/null; then
in_package="$(slackpkg file-search $library | grep uninstalled | sed 's/^.* //' | xargs)"
if [ -z "$in_package" ]; then
in_package="$(grep $library --recursive /var/log/packages | sed -e 's/:.*//' -e 's:.*/::')"
if [ -n "$in_package" ]; then
continue
fi
in_package="?"
fi
echo "$file [$pkg] => $library [$in_package]"
fi
done
fi
fi
done
rm -f $ldconfig_temp
}
( search_with_ldd
search_with_objdump
) 2>&1 | grep -v '::' 2>&1 > missing-packages.log
# EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment