LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-09-2010, 01:05 AM   #1
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Lightbulb Slack: script detects orphan libraries, broken lib links, missing deps & stuff


My recent borked upgrade to -current inspired me to try to come up with a way to sanity-check the lib and bin dirs for broken library symlinks (possibly indicating missing libs) and for binaries and libraries that belong to no installed package, as well as missing dependencies.

This script is the result.

I've checked the script results manually, and it appears to be accurate, so I figured I'd post it here for a second opinion, and/or because others may find it useful too. I'm not aware of another popular method of doing this on Slackware, so here it is:

Current version: 1.07
UPDATED: Thu Mar 18 05:56:30 UTC 2010
Download: orphans.txt
Checksum: e49f7dd425df7430bfb2de7081d8cb27 orphans.txt
Code:
#!/bin/sh
# NOTE: As you see above, the shebang points to /bin/dash. If you have no Dash shell
# installed, change it to read #!/bin/bash or whatever Bourne-type shell you like.

# Author: Sasha Alexandr (GrapefruiTgirl) March 2010
# DISCLAIMER/LICENSE: GNU GPL v3 or greater.
# This script is provided with ABSOLUTELY NO WARRANTY in the hope
# that you will find it useful and/or entertaining.
# While the script does not change your system in any way
# the author takes no responsibility for how you use it, or how you
# might use the results produced by it. Use at own risk.
# You may modify or redistribute this program as you like.


version () {
 VERSION='Version 1.07'
 echo "$VERSION"
}


######################
# BUGFIXES & ChangeLog:
# BUGFIX: grep problem with cxxlibs libs on Slack13/32
#
# Version 1.01 - March 09 2010:
#-- Output the NVIDIA driver blurb only if nvidia.ko is present on the machine.
#-- Check if we're root; if not, quit due to inadequate read/access permissions.
#-- Break some long lines using \'s. Clear screen at start.
# Version 1.02 - March 10 2010:
#-- Adding checking for binaries missing dependencies.
#-- Making two modes of operation: default & 'ridiculous'
#   you can pass the 'ridiculous' option to the script, and 'Round 3' will search
#   a lot more directory paths for missing dependencies.
#-- Also fixed visual progress display - it displays dots now and will
#   not print stuff to the screen that confuses people (including myself).
#-- Formatted the output.log in a slightly more greppable fashion (I hope you like that!)
#-- Don't bother clearing screen at startup.
#-- Put everything into functions.
# Version 1.03 - skipped.
# Version 1.04 - March 12 2010:
#-- Added checking for orphan binaries (now Round 3)
#-- Added --version switch and --help switch
#-- changed mode switches to --basic and --full (instead of ridiculous or not)
#-- tuned up the search-path identifying code (no more using $PATH for bin dirs)
#-- by popular demand, the orphans.log file is now shown automatically upon completion.
#-- also by popular demand, the shebang now points to /bin/sh
# Version 1.05 - March 13 2010:
#-- remove /boot/initrd*/bin from $BINDIRS
#-- modify sanity-checking of libs/binaries identified in rounds 2+3
#   because the filename filtering is not perfect. Avoid non-[ELF|lib|ar] files.
#-- remove .pc files from the search (what was I thinking?! Silly ASCII files.)
#-- double-check that libs found in round2 are not in the /incoming/ folder in the
#   */packages/log file -- glibc-solibs are like this, causing false positives.
#-- lessen the use of `basename` -- use only where necessary (slight speed improvement)
#-- make the progress display more meaningful (but still slightly vague)
# Version 1.05.1 - later the same day..
#-- tiny correction of counting of the paths. very tiny. does not affect functionality.
# Version 1.06 - March 14 2010
#-- more bug fixes -- some paths not being checked.
#-- remove /boot/initrd* folders from search paths.
# Version 1.07 - March 17 2010
#-- add new mode & switch: --verify
#   This function checks that every single file contained in every allegedly installed
#   package, is actually present on the system where it is supposed to be.
#   The function ignores doinst.sh scripts and slack-desc files, and a few other things.
#   Read the comments verify_package_contents() for full ignore list.
######################


check_permissions () {
# Check permissions (are we root?)
if [ "$(id -u)" != '0' ]; then
  echo "Please su to root or use sudo to run this script. Exiting now."
  exit 1
fi
}


setup_basic () {
# Simulation has no relevance at this time. Your system will not be altered.
# This script currently just produces an output file for you to peruse.
# You decide what to do with the results.
# If $SIMULATION='true' nothing will be changed or deleted:
 SIMULATION='true'

# Kinda irrelevant/overkill, but where is ldconfig:
 LDCONFIG=$(which ldconfig)

# put the results in this file (in the CWD):
# when using --verify, log is called 'orphans.verify.log'; else just 'orphans.log'
if [ "$1" = 'verify' ]; then
    [ "$(pwd)" = '/' ] && RESULT=orphans.verify.log || RESULT=$(pwd)/orphans.verify.log
 else
    [ "$(pwd)" = '/' ] && RESULT=orphans.log || RESULT=$(pwd)/orphans.log
fi

# create fresh output file:
 echo
 echo "## orphans.sh $(version) for Slackware." | tee "$RESULT"
 echo "## Executed: $(date)" | tee -a "$RESULT"
 echo "## Mode of execution: $MODE" | tee -a "$RESULT"
 echo "## Results will be outputted to: $RESULT"
 echo "## ##########################################" >> "$RESULT"
 echo >> "$RESULT"
}


setup_ridiculous () {
printf "## Setting up, please wait.."

case $1 in ridiculous)
 # if $1 == 'ridiculous' then add these paths to the search
 # NOTE: may produce a lot of results!!
 LIB64DIRS=$( find / -type d -name 'lib64' 2>/dev/null | sed \
  -e '/^\/boot\/initrd-tree\/.*$/d' \
  -e '/^\/mnt\|tmp\|media\/.*$/d' \
  -e '/^\/usr\/src\/.*$/d' \
  -e '/^\/usr\/source\/.*$/d' )
 printf "."

 LIB32DIRS=$( find / -type d -name 'lib' 2>/dev/null | sed \
  -e '/^\/boot\/initrd-tree\/.*$/d' \
  -e '/^\/mnt\|tmp\|media\/.*$/d' \
  -e '/^\/usr\/src\/.*$/d' \
  -e '/^\/usr\/source\/.*$/d' \
  -e '/^\/usr\/libexec\/.*$/d' \
  -e '/^\/usr\/doc\/.*$/d' \
  -e '/^\/lib\/modules\/.*$/d' \
  -e '/^\/var\/cache\/.*$/d' \
  -e '/\/lib64\/.*$/d' )
 printf "."

 LIBEXECDIRS=$( find / -type d -name 'libexec' 2>/dev/null )
;;
esac
echo "."

# if $1 != 'ridiculous' then only check these bin paths
# and/or ld.so.conf known paths:

 BINDIRS=$( find / -type d -name 'bin' -or -name 'sbin' 2>/dev/null | sed \
  -e '/^\/mnt\|tmp\|media\/.*$/d' \
  -e '/^\/usr\/src\/.*$/d' \
  -e '/^\/boot\/initrd-tree\/.*$/d' \
  -e '/^\/usr\/source\/.*$/d' )

echo "## Done!"
}


count_packages () {
 # FYI, this many packages are apparently installed:
 NUMPKGS=$( ls /var/log/packages | wc -l )
 echo "## Count installed packages: $NUMPKGS" | tee -a "$RESULT"
}


broken_links () {
# round 1-- See if there are links pointing to non-existant libraries.
# This only checks stuff that the linker knows about.
 echo >> "$RESULT"
 echo "## Round 1/4 = Quick check for broken symlinks that might indicate missing libs.." | tee -a "$RESULT"
 $LDCONFIG 1>/dev/null 2>&1

 for LIB in $(ldconfig -v 2>&1 >/dev/null | grep 'Cannot stat' | awk '{print $4}' | tr -d ':'); do
   # this part is fast: no visual progress display.
   echo "1: Broken link to: $LIB" >> "$RESULT"
   printf "1:> Possibly comes from package:" >> "$RESULT"
   PKG="$(grep "$LIB" /var/log/packages/*)"
   [ ! "$PKG" ] && echo " Unknown." >> "$RESULT" || \
    printf "\n$(echo "$PKG" | cut -d: -f1 | awk -F/ '{print $5}').t?z\n" >> "$RESULT"
 done

 echo "## Done!" | tee -a "$RESULT"
}


orphan_stuff () {
# rounds 2+3 -- search lib dirs to see if every library
# on the machine belongs to an installed package:
echo >> "$RESULT"
echo "## Round 2/4 -- Checking for orphan libraries belonging to no installed package.." | tee -a "$RESULT"

# if there's an nvidia driver, put this into the output file:
if [ "$(find /lib/modules/$(uname -r) -name nvidia.ko)" ]; then
cat << END >> "$RESULT"
###########################################################
# WARNING! NVIDIA driver is present for the running kernel.
# If you've installed it using the nvidia driver installer
# instead of pkgtool, you will see "orphaned" files
# which do belong to the driver! Don't go crazy on them.
# They tend to be located in several locations, but here are
# some examples of NVIDIA driver filenames you might see:
# (NOTE: version numbers will vary)
# Orphaned library: /usr/lib64/libGLcore.so.190.53
# Orphaned library: /usr/lib64/libGL.so.190.53
# Orphaned library: /usr/lib64/libXvMCNVIDIA.so.190.53
# Orphaned library: /usr/lib64/libcuda.so.190.53
# Orphaned library: /usr/lib64/libglx.so.190.53
# Orphaned library: /usr/lib64/libnvidia-cfg.so.190.53
# Orphaned library: /usr/lib64/libnvidia-tls.so.190.53
# Orphaned library: /usr/lib64/libnvidia-wfb.so.190.53
# Orphaned library: /usr/lib64/libvdpau.so.190.53
# Orphaned library: /usr/lib64/libvdpau_nvidia.so.190.53
# Orphaned library: /usr/lib64/libvdpau_trace.so.190.53
# Orphaned library: /usr/lib64/nvidia_drv.so
# Orphaned library: /usr/lib64/tls/libnvidia-tls.so.190.53
###########################################################
END
fi

DIRCOUNT=$((1)); LIBINCR=$((0))
[ "$1" = 'ridiculous' ] && \
ALLDIRS="$LIB64DIRS
$LIB32DIRS
$LIBEXECDIRS" || ALLDIRS=$(cat /etc/ld.so.conf)
NUMDIRS=$(echo "$ALLDIRS" | wc -l)

echo "$ALLDIRS" | sort | uniq | \
while read DIR; do
  if [ "$DIR" ] && [ -d "$DIR" ]; then
    echo "# Evaluating library files in: $DIR" >> $RESULT
    LIBCOUNT=$(find "$DIR" -type f | egrep '*\.a$|*\.la$|*\.so|*\.so\.*$' | uniq | wc -l)
    for LIB in $(find "$DIR" -type f | egrep '*\.a$|*\.la$|*\.so|*\.so\.*$' | sort | uniq); do

      LIBINCR=$((LIBINCR+1))

      # visual progress display:
      DIRPROGRESS="$DIRCOUNT/$NUMDIRS"; LIBPROGRESS="$((LIBINCR*100/LIBCOUNT))"
      printf %b "\r## Path: $DIRPROGRESS  Done: $LIBPROGRESS%  "

      if [ -x "$LIB" ] && [ $(file "$LIB" | grep -c 'ELF\|current ar archive\|libtool library file') -ne 0 ]; then
        if [ ! "$(grep "$(echo "$LIB" | sed 's/^\///')" /var/log/packages/*)" ] && \
        [ ! "$(grep "$(echo "$DIR" | sed 's/^\///')/incoming/$(basename "$LIB")" /var/log/packages/*)" ]; then
          echo "2:> Orphan library file: $LIB" >> "$RESULT"
        fi
      fi
    done
  fi
  DIRCOUNT=$((DIRCOUNT+1)); LIBINCR=$((0))
done

echo "## Done!" >> "$RESULT"
printf %b "\r## Paths: $NUMDIRS/$NUMDIRS  Done!          \n"


# round 3/4 -- same as above, but evaluates BINARIES not LIBRARIES.
echo >> "$RESULT"
echo "## Round 3/4 -- Checking for orphan binaries belonging to no installed package.." | tee -a "$RESULT"

DIRCOUNT=$((1)); BININCR=$((0))
ALLDIRS="$BINDIRS
$LIB64DIRS
$LIB32DIRS
$LIBEXECDIRS"
NUMDIRS=$(echo "$ALLDIRS" | wc -l)

echo "$ALLDIRS" | while read DIR; do
  if [ "$DIR" ] && [ -d "$DIR" ]; then
    echo "# Evaluating binaries in: $DIR" >> $RESULT
    BINCOUNT=$(find "$DIR" -type f | egrep -v '*\.a$|*\.la$|*\.so|*\.so\.*$|\[' | uniq | wc -l)
    for BINARY in $(find "$DIR" -type f | egrep -v '*\.a$|*\.la$|*\.so|*\.so\.*$|\[' | sort | uniq); do

      BININCR=$((BININCR+1))

      # visual progress display:
      DIRPROGRESS="$DIRCOUNT/$NUMDIRS"; BINPROGRESS="$((BININCR*100/BINCOUNT))"
      printf %b "\r## Path: $DIRPROGRESS  Done: $BINPROGRESS%  "

      if [ -x "$BINARY" ] && [ $(file "$BINARY" | grep -c 'ELF') -ne 0 ]; then
        [ ! "$(grep "$(echo "$BINARY" | sed 's/^\///')" /var/log/packages/*)" ] && \
          echo "3:> Orphan binary file: $BINARY" >> "$RESULT"
      fi
    done
  fi
  DIRCOUNT=$((DIRCOUNT+1)); BININCR=$((0))
done

echo "## Done!" >> "$RESULT"
printf %b "\r## Paths: $NUMDIRS/$NUMDIRS  Done!          \n"
}


dependency () {
# round 4/4
# Checks for missing dependencies of installed binaries and other libs on the system.
# The --full mode checks every lib & bin dir it can find on the system
# instead of just the /bin dirs. Might be overkill - you decide.
echo >> "$RESULT"
echo "## Round 4/4 -- Checking for missing dependencies of installed libs/binaries.." | tee -a "$RESULT"

DIRCOUNT=$((1)); ITEMINCR=$((0))
# NUMDIRS & ALLDIRS are still set from above.

echo "$ALLDIRS" | while read DIR; do
  if [ "$DIR" ] && [ -d "$DIR" ]; then
    echo "# Evaluating objects in: $DIR" >> $RESULT
    ITEMCOUNT=$(find "$DIR" -type f | sort | uniq | wc -l)   
    for FILE in $(find "$DIR" -type f | sort | uniq); do

      ITEMINCR=$((ITEMINCR+1))

      # visual progress display:
      DIRPROGRESS="$DIRCOUNT/$NUMDIRS"; ITEMPROGRESS="$((ITEMINCR*100/ITEMCOUNT))"
      printf %b "\r## Path: $DIRPROGRESS  Done: $ITEMPROGRESS%  "

      if [ -x "$FILE" ] && [ $(file "$FILE" | grep -c 'ELF') -ne 0 ]; then
        if [ $(ldd "$FILE" 2>/dev/null | grep -c 'not found') -ne 0 ]; then
          echo "4: Missing dependencies for: $FILE" >> "$RESULT"
          echo "$(for i in $(ldd "$FILE" | grep 'not found' | sort | uniq | awk '{print $1}'); do
           echo "4:> Missing: $i"; done)" >> "$RESULT"
        fi
      fi
    done
  DIRCOUNT=$((DIRCOUNT+1)); ITEMINCR=$((0))

  fi
done

echo "## Done!" >> "$RESULT"
printf %b "\r## Paths: $NUMDIRS/$NUMDIRS  Done!          \n"
}


verify_package_contents () {
# checks that all files listed in the package install-log are really somewhere.
# devs- and sysvinit- packages are ignored
# .new files are ignored
# /install/* files are ignored
# /var/cache/* is skipped; nothing important there for these purposes.
# *src2pkg.auto build scripts are skipped
# /incoming/ folder is compensated for (glibc et al.)

echo >> "$RESULT"
PKGPROGRESS=$((1))

find /var/log/packages -type f | sort | uniq | less | \
 sed -e '/^\/var\/log\/packages\/devs-.*$/d' \
     -e '/^\/var\/log\/packages\/sysvinit-.*$/d' | \
 while read PACKAGELOG; do

     # visual progress display:
     printf %b "\r## Examining package: $PKGPROGRESS / $NUMPKGS"
 
     cat "$PACKAGELOG" | \
     sed -e '/^\.\/$/d;/^install\/.*/d' \
         -e '/^PACKAGE\|UNCOMPRESSED\|COMPRESSED\|.*:\|FILE LIST:/d' \
         -e '/.*\.new$/d' \
         -e '/^var\/cache\/.*$/d' \
         -e '/.*\.src2pkg\.auto$/d' \
         -e 's:/incoming/:/:' | \
     while read ITEM; do
       [ ! -e "/$ITEM" ] && echo "v: $(basename $PACKAGELOG) -- missing /$ITEM" >> "$RESULT" # && break
     done
 
 PKGPROGRESS=$((PKGPROGRESS+1))
 done

printf "\r## Examined packages: $NUMPKGS / $NUMPKGS\n"
echo "## Done!" | tee -a "$RESULT"
cat "$RESULT" | grep v: | awk '{print $2}' | uniq | sed '/^$/d' > "$RESULT.packages"
echo
echo "## A plain list of affected packages is saved as $RESULT.packages"
echo "## You can use that to automate reinstallation of these packages if you wish."
}


help () {
cat << END

 # orphans.sh
 # A tool for Slackers. Helps identify broken dependencies. Finds libraries
 # and binaries on the machine that belong to no known installed package.            
 # Identifies installed packages whose contents are missing from the system.

 # Author: Sasha Alexandr <crawlingwithsnakes at hush dot com>
 # Created: March 2010
 #
 # USAGE:

 $0 -h|--help    ( shows this help info you are reading right now )
 $0 -v|--version ( show which version of this script you have )
 $0 -b|--basic   ( the less exhaustive scan for messed up stuff )
 $0 -f|--full    ( the more exhaustive scan for messed up stuff )
 $0    --verify  ( check that contents of all installed packages 
                   are really installed )

 # --basic and --full work similarly, but --full searches in more locations.
 # --verify is independent of the other two modes.
 # That's all for now folks!

END
}

# script entry point:
# use --help for usage instructions.
case "$1" in

 version|-v|--v) version && exit 0 ;;

 help|usage|-h|--h|-usage|--usage|'?') help && exit 0 ;;

 --basic|-basic|basic|-b|--b|--full|-full|full|-f|--f)

    [ "$(echo -- "$1" | grep 'b')" ] && MODE=basic || MODE=ridiculous
    check_permissions
    setup_basic ogopogo
    setup_ridiculous $MODE
    count_packages
    # round 1
    broken_links
    # round 2 & 3
    orphan_stuff $MODE
    # round 4
    dependency
 ;;

 --verify)

    MODE='verify'
    check_permissions
    setup_basic $MODE
    count_packages
    verify_package_contents
 ;;

 *) help && exit 1 ;;

esac

# Next lines automatically puts the results file to the screen via 'less':
echo
echo "shell# cat $RESULT | less"
sleep 2 && cat "$RESULT" | less
#EOF
THANKS: Sahko, for posting that Arch script (and to whomever wrote that Arch script); that helped!
THANKS: To those who have provided feedback!
THANKS: Matt -- many bugs found!

Don't neglect to read the #comments in the script.

Feedback definitely welcome, especially bug reports:

If any directories are being EXcluded from the scanning, but they should be INcluded, do let me know, and I'll investigate- it's possible I've not perfectly identified/removed every likely/unlikely search destination from the search paths.

Enjoy,

Sasha

Last edited by GrapefruiTgirl; 03-18-2010 at 12:49 AM. Reason: Read the Changelog in the script #comments
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-09-2010, 01:30 AM   #2
Affromen
Member
 
Registered: Mar 2008
Location: Kaunas, Lithuania
Distribution: Slackware forever
Posts: 30

Rep: Reputation: 17
Maybe i am doing something wrong, but i get this output when trying this script:
Code:
# sh orphans.sh 
## Count installed packages: 813
## Checking for missing libraries (via broken symlinks)...
orphans.sh: line 30: -a: command not found
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
Usage: awk [POSIX or GNU style options] [--] 'program' file ...
POSIX options:		GNU long options:
	-f progfile		--file=progfile
	-F fs			--field-separator=fs
	-v var=val		--assign=var=val
	-m[fr] val
	-W compat		--compat
	-W copyleft		--copyleft
	-W copyright		--copyright
	-W dump-variables[=file]	--dump-variables[=file]
	-W exec=file		--exec=file
	-W gen-po		--gen-po
	-W help			--help
	-W lint[=fatal]		--lint[=fatal]
	-W lint-old		--lint-old
	-W non-decimal-data	--non-decimal-data
	-W profile[=file]	--profile[=file]
	-W posix		--posix
	-W re-interval		--re-interval
	-W source=program-text	--source=program-text
	-W traditional		--traditional
	-W usage		--usage
	-W use-lc-numeric	--use-lc-numeric
	-W version		--version

To report bugs, see node `Bugs' in `gawk.info', which is
section `Reporting Problems and Bugs' in the printed version.

gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.

Examples:
	gawk '{ sum += $1 }; END { print sum }' file
	gawk -F: '{ print $1 }' /etc/passwd
orphans.sh: line 42: {print $4}: command not found
Done.
## Searching for orphaned libraries (not belonging to an installed 
package)...
Usage: egrep [OPTION]... PATTERN [FILE]...
Try `egrep --help' for more information.
find: `basename' terminated by signal 13
find: `basename' terminated by signal 13
find: `basename' terminated by signal 13
find: `basename' terminated by signal 13
orphans.sh: line 86: *\.pc$|*\.a$|*\.la$|*\.so\.*: command not found
Usage: egrep [OPTION]... PATTERN [FILE]...
Try `egrep --help' for more information.
orphans.sh: line 86: *\.pc$|*\.a$|*\.la$|*\.so\.*: command not found
Usage: egrep [OPTION]... PATTERN [FILE]...
Try `egrep --help' for more information.
orphans.sh: line 86: *\.pc$|*\.a$|*\.la$|*\.so\.*: command not found
All done!
I am using bash as my shell.

Copy/paste might gone wrong too :/ would it be possible to host actual file? or maybe i do not have needed packages in my system?

Last edited by Affromen; 03-09-2010 at 01:33 AM.
 
Old 03-09-2010, 01:33 AM   #3
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Weird.. I will attach the file as an attachment -- copy/paste may have gone wrong from my end too. Give me a moment.

OK, file attached as "orphans.txt" which you can rename to "orphans.sh" or whatever you like and actually, I can add a checksum too.. Just a moment, and it will be there.

Last edited by GrapefruiTgirl; 03-09-2010 at 01:37 AM.
 
Old 03-09-2010, 01:37 AM   #4
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,845

Rep: Reputation: 452Reputation: 452Reputation: 452Reputation: 452Reputation: 452
Well, I used it, and it found "orphaned" libs. However, these libs all were for software I installed myself and not through the normal package way. I thought it might help me in my other quest, but so far no good.

That said - this is very nice work! And I do thank you for what will be a very useful tool!
 
Old 03-09-2010, 01:40 AM   #5
mlangdn
Senior Member
 
Registered: Mar 2005
Location: Kentucky
Distribution: Slackware64-current
Posts: 1,845

Rep: Reputation: 452Reputation: 452Reputation: 452Reputation: 452Reputation: 452
Did you change the script's top line from:

Code:
#!/bin/dash
to:

Code:
#!/bin/bash
 
Old 03-09-2010, 01:41 AM   #6
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Heh thanks mlangdn -- yes, it (perhaps I should make that more clear for newer Slackers) is most useful if your system has all its software installed via the package manager, either default slackpkgs, or ones made with src2pkg or whatever; as long as they are in a Slackware Package, they won't be reported as orphans.

I **try** on my system to follow the rules on this but yes, once in a while I end up installing *something* in a hurry to get onto the next thing, and forget to make a package.

Plus, as noted in the comments, stuff like the nvidia driver, which most of us install using the installer from nvidia, are also reported as orphaned.

Cheers!
Sasha
 
Old 03-09-2010, 01:41 AM   #7
Affromen
Member
 
Registered: Mar 2008
Location: Kaunas, Lithuania
Distribution: Slackware forever
Posts: 30

Rep: Reputation: 17
Thanks, seems to work well now:
Code:
# sh orphans.sh 
## Count installed packages: 813
## Checking for missing libraries (via broken symlinks)...
Done.
## Searching for orphaned libraries (not belonging to an installed 
package)...
/usr/i486-slackware-linux/lib/libstdc++-3-libc6.1-2-2.10.0.so                                                  
/usr/i486-slackware-linux/lib/libstdc++-3-libc6.2-2-2.10.0.so                                                  
/usr/i486-slackware-linux/lib/libstdc++.so.4.0.0                                                  
/usr/i486-slackware-linux/lib/libstdc++.so.5.0.7                                                  
All done!
May i ask some kind of noob question? Now that i have some orphaned libraries, what should i do with them? just remove the files?
 
Old 03-09-2010, 01:47 AM   #8
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
I would remove them, yes. HOWEVER -- it has been quite some time since I myself have used Slackware-NON-64, so please manually verify that the orphaned packages REALLY do not belong on your current system, and that they really have been upgraded with something else.

Chances are good that you can simply delete them; however I'd wait for feedback from someone maybe who is still running a comparable version of Slack to yours, to make sure that you have the correct & newer versions of those libs.

At a glance, it does look to me like you have several versions of a couple things there, but again, wait for better verification on those particular packages for your 32bit Slack.

Sasha
 
Old 03-09-2010, 01:57 AM   #9
Affromen
Member
 
Registered: Mar 2008
Location: Kaunas, Lithuania
Distribution: Slackware forever
Posts: 30

Rep: Reputation: 17
I tried to search for these files in site mentioned here:
http://www.linuxquestions.org/questi...a-file-793828/

and it seems that those files belongs to cxxlibs package which comes with slackware 13:
http://slak.homelinux.org/pkgs/?act=....1-2-2.10.0.so

And if i removepkg /var/log/packages/cxxlibs--6.0.10-i486-1.txz then your script shows no orphans at all but when i install this package back with slackpkg install package cxxlibs then those files appears again as orphans.

Not sure if it's good or bad, but thought i should let you know.

But that also might be caused by some problems not yet clear to me, as my system is acting bit weird after reverting from -current to stable :/
 
Old 03-09-2010, 02:03 AM   #10
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hmmmm.. Interesting.. Yes, I appreciate you letting me know, as it is certainly possible for bugs or weird behaviour on a machine other than my own (not that my machine is immune from weird behaviour, no!) and if it's a bug, I'll fix it.

You are running Slack 13.0 32bit right? Can you verify that version for me?
 
Old 03-09-2010, 02:09 AM   #11
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Oop! I see the problem. A fix will be ready shortly.
 
Old 03-09-2010, 02:13 AM   #12
Affromen
Member
 
Registered: Mar 2008
Location: Kaunas, Lithuania
Distribution: Slackware forever
Posts: 30

Rep: Reputation: 17
Quote:
Originally Posted by GrapefruiTgirl View Post
You are running Slack 13.0 32bit right? Can you verify that version for me?
Yes Slackware 13.0 32bit
 
Old 03-09-2010, 03:05 AM   #13
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Allrighty then.. Whew, that was weird.

I *think* the problem reported by Affromen is fixed -- but further testing will help make sure of that.

I downloaded the problem cxxlibs package for Slack13/32 and manually stuck the libs in my /usr/lib folder. I ran the script, and the erronious libs were detected as orphans (correctly). Then, I created a phony package logfile in /var/log/packages for the phony cxxlibs package, and ran the script again. The libs were now NOT detected as orphaned (correct again).
I deleted the phony logfile, and ran the script again! And again correctly, the libs/symlinks were reported as orphaned.

Finally I deleted all the phony libs I manually installed, and the script ran cleanly, reporting no errors about these things.

So... Using the exact same package that Affromen had trouble with, the problem is gone for me. Please let me know if this now works correctly for you (whoever )

Sasha

EDIT: See that weird crap at the start of the BUGFIXES line? Far as I can tell, that's the only instance of it, and I did the checksum WITH that typo in the file. There are no such typos in the actual code. It's caused by me using NANO text editor, with mouse support, and when I click back and forth between windows, this crap comes from the mouse. I've been fixing those stupid things all evening, but I missed that one.
Nano I think will not become my favorite editor :/

Last edited by GrapefruiTgirl; 03-09-2010 at 03:12 AM. Reason: Note about NANO
 
Old 03-09-2010, 03:17 AM   #14
Affromen
Member
 
Registered: Mar 2008
Location: Kaunas, Lithuania
Distribution: Slackware forever
Posts: 30

Rep: Reputation: 17
redownloaded orphans.txt and tried to run it again, but still same output on my machine:
Code:
# sh orphans.sh 
## Count installed packages: 813
## Checking for missing libraries (via broken symlinks)...
Done.
## Searching for orphaned libraries (not belonging to an installed package)...
/usr/i486-slackware-linux/lib/libstdc++-3-libc6.1-2-2.10.0.so
/usr/i486-slackware-linux/lib/libstdc++-3-libc6.2-2-2.10.0.so
/usr/i486-slackware-linux/lib/libstdc++.so.4.0.0
/usr/i486-slackware-linux/lib/libstdc++.so.5.0.7
All done!
maybe it is really something wrong with my system :/

There is orphans.log:
Code:
# cat orphans.log 
## Slackware check for orphaned/missing libraries: Tue Mar  9 11:10:53 GMT+2 2010

## Count installed packages: 813

## Checking for missing libraries (via broken symlinks)...


Done.
## Searching for orphaned libraries (not belonging to an installed package)...

###########################################################
# WARNING! If you have for e.g. an NVIDIA driver installed
# and have installed it using the nvidia driver installer
# instead of pkgtool, you will see "orphaned" files
# which do belong to the driver! Don't go crazy on them.
# Examples include stuff like these five here (and more):
# Orphaned library: /usr/lib64/ libnvidia-tls.so.190.53
# Orphaned library: /usr/lib64/ libnvidia-wfb.so.190.53
# Orphaned library: /usr/lib64/ libvdpau.so.190.53
# Orphaned library: /usr/lib64/ libvdpau_nvidia.so.190.53
# Orphaned library: /usr/lib64/tls/ libnvidia-tls.so.190.53
###########################################################

## Searching contents of: /usr/i486-slackware-linux/lib

## Searching contents of: /usr/lib/seamonkey

## Searching contents of: /usr/local/lib


All done!

Last edited by Affromen; 03-09-2010 at 03:19 AM.
 
Old 03-09-2010, 03:26 AM   #15
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Uhh.. Are you posting your log results in two pieces for a particular reason ?

If so, can you re-post it in one piece, as one log? I'm being a bit mixed up reading it the way it's posted (it's getting VERY late here for me!)

The first little piece you posted indicates some problem.. But the second file you pasted, it shows all A-OK
Sasha

Last edited by GrapefruiTgirl; 03-09-2010 at 03:28 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moved ALL libraries from /lib to /local/ teaser Linux - Newbie 10 07-25-2008 08:19 AM
Broken symlinks aren't red anymore LocoMojo Slackware 21 11-19-2007 09:24 AM
Removing .a libraries in /usr/lib/ kunkie Linux - General 1 08-27-2005 11:44 PM
Broken symlinks in '/' dir after compile and checkinstall Haiyadragon Slackware 3 02-08-2005 10:55 AM
Broken symlinks technopasta Linux - Software 1 05-29-2004 07:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration