Re: why does virtualbox keep all my old /lib/modules directories around?

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

 



Robert P. J. Day wrote:
>   i honestly don't recall how they came to be there, but i rarely
> install anything on my fedora system *not* via an actual .rpm package.

I don't know how Virtualbox works, but perhaps some version
in the past installed via rpm and then helpfully compiled
modules for updated kernels and installed those directly --
as opposed to how akmods work by generating a kmod package
and installing that?

>   so, clearly, kernel removal comes along to remove the corresponding
> /lib/modules directory, finds it still has content, and is forced to
> leave it there. that's annoying.

But much better than rpm removing directories that are not
empty and contain files which are not part of any package,
of couse. :)

> is there any option for kernel removal to at least warn
> that it can't delete the /lib/modules directory?

I'm not aware of any such options.  That would have to be
done in rpm, I believe.  And then it would likely warn far
more often than you'd want.

You could write a quick script which looked for orphaned
files under /lib/modules (and optionally cleaned them up)
fairly easily.

You do have to be careful to not remove some files generated
by depmod (which kmod packages call in their
%post scriptlets, at least).

Running something like this occasionally should help locate
any cruft:

    find /lib/modules/ ! -name 'modules.*' -print0 | \
        xargs -r0 rpm -qf | awk '/is not owned/ {print $2}'

That's not perfect by any means.  The awk portion is
particularly broken if the listed files contain spaces.  I
don't know of a way to have rpm output only the filename or
use a different separator.

If I was going to really use such a script I'd look at the
python rpm bindings most likely.

Short of that, I'd tighten the unowned filename extraction
in one way or another.  Matching the full line and stripping
out the leading 'file ' and trailing 'is not owned by any
package' is probably the simplest method -- not necessarily
done with awk.  It could be grep piped to sed, perl, or
whatever suits your tastes.

-- 
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Don't take life seriously, you'll never get out alive.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux