Re: Solution for when rpm -e just spins at 100% CPU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I could be completely wrong, but wouldn't:
    rpm --erase --justdb <hand-deleted-package>

Work just the same way?

Looking at 'rpm --help', the --justdb option is used to touch only the
database, without affecting the filesystem, and can be used for install,
upgrade and erase modes...

Just a thought...

In the Murky Past Andy Green did say:
> Hi folks -
>
> I found a while ago I had managed to do something to deeply irritate my
> rpm database, such that trying to rpm -e some kernel packages to clean up
> was causing rpm to eat huge amounts of memory and sit there spinning
> forever at 100% CPU.  I asked about it on the rpm list some time ago but
> nobody replied (too busy shaking their head sadly I guess).
>
> Yesterday I was in a wild mood, since I found I was now unable to even
> install any kernel packages on this machine, so I tried again to delete
> old kernel packages while watching what rpm was doing with strace.
>
> I found that rpm was spinning touching files from old kernel packages that
> I had deleted by hand.  I did not expect rpm to care since I was asking it
> to delete the package, but for whatever reason rpm becomes highly
> irritated and sits there eating CPU forever in these circumstances,
> spinning between touching a handful of nonexistant filepaths.
>
> After some threshing around, I developed this small script, which I now
> commit to future Googlers with the same problem:
>
> #!/bin/bash
> # rpmghost  andy@xxxxxxxxxxx  2004-04-15
>
> echo "Faking up nonexistant files..."
>
> LIST=`rpm -q --list $1 | tac `
>
> for i in $LIST ; do
>  if [ ! -e "$i" -a ! -d "$i" ] ; then
>   if [ ! -d `dirname "$i"` ] ; then
>     mkdir -p `dirname "$i"`
>   fi
>   touch $i
>  fi
> done
>
> The rpmghost script takes one argument which is a package versioned name,
> not filepath, just versioned name, like kernel-2.6.1-1.65.
>
> rpm has an idea of what files belong to what package stashed in its
> database, the script gets rpm to list this for a given package, turns the
> list upside down (so the parent directories are listed last, allowing the
> dirname/touch trick to work) and then creates zero-length files for every
> file in the directory structure.  It basically makes a ghosttown for a
> deleted package footprint.  That's all that is needed.
>
> For people in the same situation with the kernel, for example, you can
> list what kernel versions rpm knows about
>
> rpm -q kernel
>
> Then run this script on each deleted version in turn, eg, if you call the
> script is called rpmghost
>
> rpmghost kernel-2.6.1-1.65
>
> (obviously use the actual kernel version you deleted the files for).
>
> After doing this for each deleted-by-hand package version, rpm -e became
> its old happy self and successfully deleted the packages.  And I was able
> to install new kernels... but from now on I will use rpm -e to delete the
> files rather than rm -rf ;-)
>
-- 
Regards, Mike Insch, CCA, DipHE           ______________________________
      ___ ______  ___   ___  __   _      | AntiSpam System In Use With  |
     / _ \| __  \| _ \ / _ \|  \ | |     | This Domain! Address Reapers |
    | | | |   __/|| | | /_\ \ | \| |     | Will Be Tracked and          |
    | |_| | |\ \ ||_| | ___ | |\ | |     | Blacklisted! For More Info,  |
asxx@\___/|_| \_\|___/|_| |_|_| \__|.org | Mail as-info AT ordan.org    |



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux