[SOLVED] slackpkg clean-system wants to remove /var/log/packages as a package
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This issue is triggered each time there's at least one package in /var/log/packages that does not match the slackware package naming scheme, ie. name-version-arch-build :
Code:
# no version
my-package--x86_64-1
# no arch
my-package-1.2.3--2
# no build
my-package-1.2.3-x86-64-
The script below (code extracted, and slightly modified, from slackpkg core-functions.sh) allows to identify the packages with wrong name :
Code:
ROOT=""
TMPDIR="/tmp/slackpkg.debug"
WORKDIR=/var/lib/slackpkg
CONF="/etc/slackpkg"
[ ! -e "$TMPDIR" ] && mkdir -p $TMPDIR
# Creates files with mirror package names (spkg), local package
# names (lpkg) and packages unique to one or other file (dpkg)
#
function listpkgname() {
cut -f2 -d\ ${TMPDIR}/pkglist | sort > ${TMPDIR}/spkg
cut -f2 -d\ ${TMPDIR}/tmplist | sort > ${TMPDIR}/lpkg
cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \
cut -f2-6 -d\ |sort | uniq -u | \
cut -f1 -d\ | uniq > ${TMPDIR}/dpkg
}
function applyblacklist() {
grep -vEw -f ${TMPDIR}/blacklist
}
# Function to make install/reinstall/upgrade lists
#
function makelist() {
local i
grep -vE "(^#|^[[:blank:]]*$)" ${CONF}/blacklist > ${TMPDIR}/blacklist
ls -1 $ROOT/var/log/packages/* | awk -f /usr/libexec/slackpkg/pkglist.awk | applyblacklist > ${TMPDIR}/tmplist
cat ${ROOT}/${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist
listpkgname
for i in $(comm -2 -3 ${TMPDIR}/lpkg ${TMPDIR}/spkg) ; do
PKGDATA=( $(grep -- "^local $i " ${TMPDIR}/tmplist) )
[ ! "$PKGDATA" ] && continue
if [ "${PKGDATA[5]}" = "/var/log/packages" ] ; then
echo "found package that does not match slackware package naming scheme !!!"
echo " PKGDATA=${PKGDATA[*]}"
echo ""
fi
LIST="$LIST ${PKGDATA[5]}"
unset PKGDATA
done
#echo -e $LIST | tr \ "\n" | uniq
}
makelist
Usage sample:
Code:
$ bash debug-slackpkg.sh
found package that does not match slackware package naming scheme !!!
PKGDATA=local my-package x86_64 1 my-package--x86_64-1 /var/log/packages tgz
This issue is triggered each time there's at least one package in /var/log/packages that does not match the slackware package naming scheme, ie. name-version-arch-build :
[...]
--
SeB
This was it!!!
Your script found an entry for Google Chrome that didn't comply with Slackware package naming conventions. Now, out of curiosity: How did you find out??? I mean, that something like a stupid package name could cause an effect like this?
Fun fact: I didn't have Google Chrome installed, actually. Still, running
Code:
# removepkg google-chrome--x86_64-1
removed a ton of empty folders. I guess I had Chrome installed quite a while back in time, not using a SlackBuild script, but the Google installer.
Learning: Not following the Slackware path will earn you a slap in the face sooner or later, always.
Again, so many thanks for tracking this down and adapting and sharing the script! And thanks to all of you guys here for sharing your ideas and your efforts in tracking this down. I'll mark the thread as SOLVED.
If you look at makelist(), you'll see that package names are extracted from the column #5 (ie <name>) in file TMPDIR/pkglist :
Code:
LIST="$LIST ${PKGDATA[5]}"
In the case of local packages, the column #6 (<path>) is always "/var/log/packages", so, the statement "LIST=$LIST ${PKGDATA[5]}" can only returns the path instead of the name when one of the columns on left of #5 is missing.
If you run it again, do you get another (or the same) package?
After I remove the package and I run your script there are no more packages but I still cannot clean my system without getting the /var/log/packages messages as I did originally. I also reboot, shutdown and reboot as well. I ran upgrade and update as well.
After I remove the package and I run your script there are no more packages but I still cannot clean my system without getting the /var/log/packages messages as I did originally. I also reboot, shutdown and reboot as well. I ran upgrade and update as well.
I am running the newest kernel as well
5.4.77 SMP
Can you run the command below and attach the generated file :
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.