Discussion:
file delete
(too old to reply)
faeychild
2022-03-08 23:30:34 UTC
Permalink
One thing I notice is how long it can take to delete some files after an
update.
One in particular is "cpupower". It seems to take forever.

So I was curious about what was happening. I though deleting was a
matter of removing the inode.

regards
--
faeychild
Running plasmashell 5.20.4 on 5.15.25-desktop-1.mga8 kernel.
Mageia release 8 (Official) for x86_64 installed via Mageia-8-x86_64-DVD.iso
David W. Hodgins
2022-03-08 23:49:25 UTC
Permalink
Post by faeychild
One thing I notice is how long it can take to delete some files after an
update.
One in particular is "cpupower". It seems to take forever.
So I was curious about what was happening. I though deleting was a
matter of removing the inode.
It's updating the files in /var/lib/rpm that keep track of things like which files
are owned by which package. Whichever package is last to be deleted in a transaction
will be the one that appears to be taking all of the time as it's updating the files
for all of the packages in that transaction.

Regards, Dave Hodgins
faeychild
2022-03-09 21:27:22 UTC
Permalink
Post by David W. Hodgins
It's updating the files in /var/lib/rpm that keep track of things like which files
are owned by which package. Whichever package is last to be deleted in a transaction
will be the one that appears to be taking all of the time as it's updating the files
for all of the packages in that transaction.
Regards, Dave Hodgins
thanks Dave.

Just like the nvidia wrapper.
The more kernels laying around the longer it takes
--
faeychild
Running plasmashell 5.20.4 on 5.15.25-desktop-1.mga8 kernel.
Mageia release 8 (Official) for x86_64 installed via Mageia-8-x86_64-DVD.iso
David W. Hodgins
2022-03-09 22:00:59 UTC
Permalink
Post by faeychild
The more kernels laying around the longer it takes
There are several scripts floating around to remove old kernels. I use the
following ...

$ cat /usr/local/sbin/oldkernelsrm
#!/bin/bash
# Set number of packages to keep. Must be 1 or greater
declare -i NumberOfVersionsToKeep=2
set -u
ListInstalledPackages() {
LatestPrefixStart="${LatestPrefix%%-*}"
if [ "virtualbox" == "${LatestPrefixStart}" ] ; then
PackagePrefix="virtualbox-kernel"
elif [ "vboxadditions" == "${LatestPrefixStart}" ] ; then
PackagePrefix="vboxadditions-kernel"
elif [ "xtables" == "${LatestPrefixStart}" ] ; then
PackagePrefix="xtables-addons-kernel"
else
PackagePrefix="$LatestPrefix"
fi
RpmOutputLines=($(rpm -qa $PackagePrefix-\[0-9\]*|sort -V))
PackageCount=${#RpmOutputLines[@]}
if (( $PackageCount > $NumberOfVersionsToKeep )) ; then
LinesKeep=$(( $PackageCount - $NumberOfVersionsToKeep ))
RemoveListNew=("$(printf "%s\n" "${RpmOutputLines[@]}"|head -n $LinesKeep)")
RemoveList=(${RemoveList[@]-} ${RemoveListNew[@]})
fi
}
ProcessLatest() {
x="${LatestPackage%-*}" # strip last hyphen and following (removes rpm Release)
x="${x%-*}" # strip last hyphen and following (removes rpm Version')
LatestPrefix="${x%-*}" # strip last hyphen and following (removes '-latest')
ListInstalledPackages
}
RemoveList=( )
LatestPackagesList=($(rpm -qa *latest |grep -v perl-latest|sort))
for LatestPackage in "${LatestPackagesList[@]}"; do
ProcessLatest
done
if (( ${#RemoveList[@]} > 0 )) ; then
urpme --wait-lock ${RemoveList[@]}
fi
exit

After saving the above in the text file, don't forget to mark it executable.

Regards, Dave Hodgins
faeychild
2022-03-10 20:28:24 UTC
Permalink
Post by David W. Hodgins
After saving the above in the text file, don't forget to mark it executable.
Regards, Dave Hodgins
I see that it mentions virtualbox - a small complication.

I used to do it the hard way with MCC, listing all the kernels and
sorting carefully through the mess, triple quadruple checking.

Until I discovered MCC could list just the installed files - the moment
of stupid
--
faeychild
Running plasmashell 5.20.4 on 5.15.25-desktop-1.mga8 kernel.
Mageia release 8 (Official) for x86_64 installed via Mageia-8-x86_64-DVD.iso
David W. Hodgins
2022-03-10 21:17:56 UTC
Permalink
Post by faeychild
Post by David W. Hodgins
After saving the above in the text file, don't forget to mark it executable.
I see that it mentions virtualbox - a small complication.
It handles any of the kernel related "latest" packages ...
$ urpmq -y latest|grep kernel|sort -u
kernel-desktop586-devel-latest
kernel-desktop586-latest
kernel-desktop-devel-latest
kernel-desktop-latest
kernel-linus-devel-latest
kernel-linus-latest
kernel-linus-source-latest
kernel-server-devel-latest
kernel-server-latest
kernel-source-latest
virtualbox-kernel-desktop-latest
virtualbox-kernel-server-latest
xtables-addons-kernel-desktop586-latest
xtables-addons-kernel-desktop-latest
xtables-addons-kernel-server-latest

It has the exception logic needed to handle the differences in naming patterns
between the kernels and the vb/xtables kernel packages.

qa team members using it have to be careful to say no to the removal if it will
uninstall any of the "latest" packages as the requires would no longer be met,
such as when there have been several kernels installed without a corresponding kmod
update, but other than that it works well. We have to wait till the kmod packages
are updated too (kmod includes both the vb and xtables kernel packages).

For regular users who do not install kernels from updates testing, it works fine
at any time.
Post by faeychild
I used to do it the hard way with MCC, listing all the kernels and
sorting carefully through the mess, triple quadruple checking.
Until I discovered MCC could list just the installed files - the moment
of stupid
:-)

Regards, Dave Hodgins
faeychild
2022-03-11 08:23:55 UTC
Permalink
Post by David W. Hodgins
$ urpmq -y latest|grep kernel|sort -u
I sometimes lose awareness of just how many data lists are stored locally

regards


faeychild
Running plasmashell 5.20.4 on 5.15.25-desktop-1.mga8 kernel.
Mageia release 8 (Official) for x86_64 installed via Mageia-8-x86_64-DVD.iso
Loading...