Re: clean-up of old kernel fragments.

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

 



On Sat, Oct 26, 2024 at 5:43 PM home user via users
<users@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> On 10/25/24 12:45 PM, Jeffrey Walton wrote:
> > On Tue, Oct 22, 2024 at 8:42 PM home user via users
> > <users@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> >>
> >> (f-40; gnome; stand-alone dual-boot workstation; kernel 6.11.3)
> >>
> >> Selected command output...
> >>
> >> -bash.2[~]: rpm -qa kernel
> >> kernel-6.10.12-200.fc40.x86_64
> >> kernel-6.11.3-200.fc40.x86_64
> >> -bash.3[~]:
> >>
> >> -bash.3[~]: rpm -qa kernel-core
> >> kernel-core-6.10.12-200.fc40.x86_64
> >> kernel-core-6.11.3-200.fc40.x86_64
> >> -bash.4[~]:
> >
> > Related, be sure to look in /lib/modules for old kernel artifacts.
> > There have been several bugs related to proceccessing old kernel
> > removals. The removal scripts would _not_ remove the directory if they
> > were not empty, and the script had a bug that left a few small files.
> >
> > Something like this is safe to run to cleanup /lib/modules:
> >
> > # https://bugzilla.redhat.com/show_bug.cgi?id=2185410
> > clean_lib_modules() {
> >      if [[ -d "/lib/modules" ]]; then
> >          echo "Cleaning /lib/modules"
> >          # dirs=($(ls /lib/modules))
> >          mapfile -t dirs < <(ls /lib/modules)
> >          for dir in "${dirs[@]}"
> >          do
> >              dir="/lib/modules/${dir}"
> >              if [ "$(du -s -B 4096 "${dir}" | awk '{print $1}')" -lt 4096 ]
> >              then
> >                  echo "  removing ${dir}"
> >                  rm -rf "${dir}" 2>/dev/null
> >              fi
> >          done
> >      fi
> > }
>
> I do not fully understand that script, but I did the clean-up.  5 old directories, each having several times 4096 blocks were left behind.  I don't know if the problem is in dnf, a database, or something/somewhere else.  But post patching clean-up seems to be an ongoing problem.

The script uses `du` to count the size of files in the directory tree
of each [previously installed] kernel. If the size is less than 4K, it
deletes the directory tree. If the size is greater than 4K, then it is
not touched.

Here's an example of what causes the accumulation of leftovers in
/lib/modules from a Linux Mint machine. As I understand things, the
kernel uses the same scripts everywhere. Notice the "dpkg:
warning...".

Removing linux-modules-5.15.0-122-generic (5.15.0-122.132) ...
(Reading database ... 375164 files and directories currently installed.)
Purging configuration files for linux-modules-5.15.0-122-generic
(5.15.0-122.132) ...
dpkg: warning: while removing linux-modules-5.15.0-122-generic,
directory '/lib/modules/5.15.0-122-generic' not empty so not removed
Purging configuration files for linux-image-5.15.0-122-generic
(5.15.0-122.132) ...
Purging configuration files for linux-modules-extra-5.15.0-122-generic
(5.15.0-122.132) ...
...

> I'm still needing the answer to the core questions of this thread.

Jeff
-- 
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[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