Hi All,
Fedora 38
I got stuff all the way back to fc31.
Can I delete all the non fc38 directories?
Many thanks, -T
# cd /usr/lib/modules # ls 5.14.16-201.fc34.x86_64 5.18.10-200.fc36.x86_64 6.2.9-200.fc37.x86_64 5.14.16-301.fc35.x86_64 5.5.17-200.fc31.x86_64 6.3.11-200.fc38.x86_64 5.14.18-300.fc35.x86_64 5.6.6-200.fc31.x86_64 6.3.12-100.fc37.x86_64 5.14.9-200.fc34.x86_64 5.6.7-200.fc31.x86_64 6.3.12-200.fc38.x86_64 5.15.10-200.fc35.x86_64 6.0.11-300.fc37.x86_64 6.3.7-100.fc37.x86_64 5.15.16-200.fc35.x86_64 6.0.12-200.fc36.x86_64 6.3.8-100.fc37.x86_64 5.15.18-200.fc35.x86_64 6.2.10-200.fc37.x86_64 6.4.10-200.fc38.x86_64 5.15.4-201.fc35.x86_64 6.2.12-200.fc37.x86_64 6.4.11-200.fc38.x86_64 5.15.6-200.fc35.x86_64 6.2.13-200.fc37.x86_64 6.4.12-200.fc38.x86_64 5.16.8-200.fc35.x86_64 6.2.15-200.fc37.x86_64
On 8/28/23 18:37, ToddAndMargo via users wrote:
Hi All,
Fedora 38
I got stuff all the way back to fc31.
Can I delete all the non fc38 directories?
Many thanks, -T
If this helps:
# rpm -qa | grep -i fc | grep -iv fc38 gpg-pubkey-cfc659b9-5b6eac67
I no longer have any rpm installed under fc38
On Mon, Aug 28, 2023 at 9:37 PM ToddAndMargo via users users@lists.fedoraproject.org wrote:
Fedora 38
I got stuff all the way back to fc31.
Can I delete all the non fc38 directories?
Removing old kernels leaves artifacts in /lib/modules, https://bugzilla.redhat.com/show_bug.cgi?id=2185410
Jeff
On 8/28/23 20:26, Jeffrey Walton wrote:
On Mon, Aug 28, 2023 at 9:37 PM ToddAndMargo via users users@lists.fedoraproject.org wrote:
Fedora 38
I got stuff all the way back to fc31.
Can I delete all the non fc38 directories?
Removing old kernels leaves artifacts in /lib/modules, https://bugzilla.redhat.com/show_bug.cgi?id=2185410
Jeff
Ah Ha!
Thank you
On 28 Aug 2023 at 18:37, ToddAndMargo via users wrote:
Date sent: Mon, 28 Aug 2023 18:37:11 -0700 To: Community support for Fedora users users@lists.fedoraproject.org Subject: /usr/lib/modules cleanup? Send reply to: Community support for Fedora users users@lists.fedoraproject.org From: ToddAndMargo via users users@lists.fedoraproject.org Copies to: ToddAndMargo ToddAndMargo@zoho.com
Hi All,
Fedora 38
I got stuff all the way back to fc31.
Can I delete all the non fc38 directories?
Can't say sure, but what I have done on my machines. I generally use /lib/modules that is link t /usr/lib/modules.
Generally found that only 3 of the directories are actually valid linked to the 3 latest kernels. The other ones are generally much smaller and just left offer stuff that somehow stopped the automatic removal from working.
Have a script cleanmodules2 #!/bin/bash x=$(du . -d 1 | sort -n|grep -v "[0-9][0-9][0-9][0-9][0-9][0-9]" | cut -s -f2 -d/) for a in $x; do echo "$a"; rm ./"$a"/* -f -r; rmdir "$a"; done
But would recommend running it without the rm and rmdir lines to make sure it isn't going to remove anything that is valid first.
Example of results I get. Current directory is already clean so nothing removed.
du . -d 1 | sort -n
128640 ./6.4.11-100.fc37.x86_64 128652 ./6.4.12-100.fc37.x86_64 128668 ./6.4.10-100.fc37.x86_64 385968 .
Generally old directories would have sizes smaller that 6 digits, grep -v "[0-9][0-9][0-9][0-9][0-9][0-9]" filters out all directories with 6 digits or more for size. cut -s elimanates the last line that doesn't have a second field after the /
The loop then processes each of the resulting directories to remove the files and then remove directory.
That has worked for me, but you setup might be different. Might be way to validate against kernel files in /boot or entries in /boot/local/entries but this works for me.
getting the ones to keep ls -1 /boot | grep vmlinuz | grep -v rescue |cut -b9-100 or ls -1 /boot/loader/entries/ | grep x86_64 | cut -f2,3 -d- | sed 's/.conf//g'
Both give me 6.4.10-100.fc37.x86_64 6.4.11-100.fc37.x86_64 6.4.12-100.fc37.x86_64
Would have to think about how to have it delete everything but thoses??
Good Luck. Perhaps someone else has a better process.
Many thanks, -T
# cd /usr/lib/modules # ls 5.14.16-201.fc34.x86_64 5.18.10-200.fc36.x86_64 6.2.9-200.fc37.x86_64 5.14.16-301.fc35.x86_64 5.5.17-200.fc31.x86_64 6.3.11-200.fc38.x86_64 5.14.18-300.fc35.x86_64 5.6.6-200.fc31.x86_64 6.3.12-100.fc37.x86_64 5.14.9-200.fc34.x86_64 5.6.7-200.fc31.x86_64 6.3.12-200.fc38.x86_64 5.15.10-200.fc35.x86_64 6.0.11-300.fc37.x86_64 6.3.7-100.fc37.x86_64 5.15.16-200.fc35.x86_64 6.0.12-200.fc36.x86_64 6.3.8-100.fc37.x86_64 5.15.18-200.fc35.x86_64 6.2.10-200.fc37.x86_64 6.4.10-200.fc38.x86_64 5.15.4-201.fc35.x86_64 6.2.12-200.fc37.x86_64 6.4.11-200.fc38.x86_64 5.15.6-200.fc35.x86_64 6.2.13-200.fc37.x86_64 6.4.12-200.fc38.x86_64 5.16.8-200.fc35.x86_64 6.2.15-200.fc37.x86_64
--
Computers are like air conditioners. They malfunction when you open windows
users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org 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@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
+------------------------------------------------------------+ Michael D. Setzer II - Computer Science Instructor (Retired) mailto:mikes@guam.net mailto:msetzerii@gmail.com Guam - Where America's Day Begins G4L Disk Imaging Project maintainer http://sourceforge.net/projects/g4l/ +------------------------------------------------------------+
On 8/28/23 20:27, Michael D. Setzer II via users wrote:
On 28 Aug 2023 at 18:37, ToddAndMargo via users wrote:
Hi All,
Fedora 38
I got stuff all the way back to fc31.
Can I delete all the non fc38 directories?
Can't say sure, but what I have done on my machines. I generally use /lib/modules that is link t /usr/lib/modules.
Generally found that only 3 of the directories are actually valid linked to the 3 latest kernels. The other ones are generally much smaller and just left offer stuff that somehow stopped the automatic removal from working.
Thank you!
I used the following
# cd /usr/lib/modules # mkdir temp # mv $( ls | grep -i fc | grep -v fc38 ) /usr/lib/modules/temp/.
# ls /usr/lib/modules/temp | grep -i fc38 <nothing>
# ls 6.3.11-200.fc38.x86_64 6.4.10-200.fc38.x86_64 6.4.12-200.fc38.x86_64 6.3.12-200.fc38.x86_64 6.4.11-200.fc38.x86_64 temp
cd /usr/lib/modules du -sh * and see how many have significant space used. The rpms seem to leave any extra compiled pieces that were delivered outside of the kernel rpm (rpm fusion additional modules, dkms compiled and other compiled modules) leaving a lot of mostly empty directories. I have a bunch of dirs going back to fc25 and all but the most recent 3 have <5MB in them (kernel rpm modules is 150M-200M).
On Tue, Aug 29, 2023 at 1:22 AM ToddAndMargo via users users@lists.fedoraproject.org wrote:
On 8/28/23 20:27, Michael D. Setzer II via users wrote:
On 28 Aug 2023 at 18:37, ToddAndMargo via users wrote:
Hi All,
Fedora 38
I got stuff all the way back to fc31.
Can I delete all the non fc38 directories?
Can't say sure, but what I have done on my machines. I generally use /lib/modules that is link t /usr/lib/modules.
Generally found that only 3 of the directories are actually valid linked to the 3 latest kernels. The other ones are generally much smaller and just left offer stuff that somehow stopped the automatic removal from working.
Thank you!
I used the following
# cd /usr/lib/modules # mkdir temp # mv $( ls | grep -i fc | grep -v fc38 ) /usr/lib/modules/temp/.
# ls /usr/lib/modules/temp | grep -i fc38
<nothing>
# ls 6.3.11-200.fc38.x86_64 6.4.10-200.fc38.x86_64 6.4.12-200.fc38.x86_64 6.3.12-200.fc38.x86_64 6.4.11-200.fc38.x86_64 temp _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org 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@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
On Mon, Aug 28, 2023 at 11:29 PM Michael D. Setzer II via users users@lists.fedoraproject.org wrote:
On 28 Aug 2023 at 18:37, ToddAndMargo via users wrote: [...]
Fedora 38
I got stuff all the way back to fc31.
Can I delete all the non fc38 directories?
Can't say sure, but what I have done on my machines. I generally use /lib/modules that is link t /usr/lib/modules.
Generally found that only 3 of the directories are actually valid linked to the 3 latest kernels. The other ones are generally much smaller and just left offer stuff that somehow stopped the automatic removal from working.
Have a script cleanmodules2 #!/bin/bash x=$(du . -d 1 | sort -n|grep -v "[0-9][0-9][0-9][0-9][0-9][0-9]" | cut -s -f2 -d/) for a in $x; do echo "$a"; rm ./"$a"/* -f -r; rmdir "$a"; done
But would recommend running it without the rm and rmdir lines to make sure it isn't going to remove anything that is valid first.
Example of results I get. Current directory is already clean so nothing removed.
du . -d 1 | sort -n
128640 ./6.4.11-100.fc37.x86_64 128652 ./6.4.12-100.fc37.x86_64 128668 ./6.4.10-100.fc37.x86_64 385968 .
Generally old directories would have sizes smaller that 6 digits, grep -v "[0-9][0-9][0-9][0-9][0-9][0-9]" filters out all directories with 6 digits or more for size. cut -s elimanates the last line that doesn't have a second field after the /
The loop then processes each of the resulting directories to remove the files and then remove directory.
That has worked for me, but you setup might be different. Might be way to validate against kernel files in /boot or entries in /boot/local/entries but this works for me.
getting the ones to keep ls -1 /boot | grep vmlinuz | grep -v rescue |cut -b9-100 or ls -1 /boot/loader/entries/ | grep x86_64 | cut -f2,3 -d- | sed 's/.conf//g'
Both give me 6.4.10-100.fc37.x86_64 6.4.11-100.fc37.x86_64 6.4.12-100.fc37.x86_64
Would have to think about how to have it delete everything but thoses??
`du -sh` shows in human readable:
$ du -sh /lib/modules/* 4.0K /lib/modules/6.2.13-300.fc38.x86_64 4.0K /lib/modules/6.2.14-300.fc38.x86_64 4.0K /lib/modules/6.2.15-300.fc38.x86_64 4.0K /lib/modules/6.3.11-200.fc38.x86_64 4.0K /lib/modules/6.3.12-200.fc38.x86_64 4.0K /lib/modules/6.3.4-201.fc38.x86_64 4.0K /lib/modules/6.3.5-200.fc38.x86_64 4.0K /lib/modules/6.3.6-200.fc38.x86_64 4.0K /lib/modules/6.3.7-200.fc38.x86_64 4.0K /lib/modules/6.3.8-200.fc38.x86_64 126M /lib/modules/6.4.10-200.fc38.x86_64 126M /lib/modules/6.4.11-200.fc38.x86_64 126M /lib/modules/6.4.12-200.fc38.x86_64
Switch to `-m`, for size in MB:
$ du -sm /lib/modules/* 1 /lib/modules/6.2.13-300.fc38.x86_64 1 /lib/modules/6.2.14-300.fc38.x86_64 1 /lib/modules/6.2.15-300.fc38.x86_64 1 /lib/modules/6.3.11-200.fc38.x86_64 1 /lib/modules/6.3.12-200.fc38.x86_64 1 /lib/modules/6.3.4-201.fc38.x86_64 1 /lib/modules/6.3.5-200.fc38.x86_64 1 /lib/modules/6.3.6-200.fc38.x86_64 1 /lib/modules/6.3.7-200.fc38.x86_64 1 /lib/modules/6.3.8-200.fc38.x86_64 126 /lib/modules/6.4.10-200.fc38.x86_64 126 /lib/modules/6.4.11-200.fc38.x86_64 126 /lib/modules/6.4.12-200.fc38.x86_64
Then, pipe to `awk` for a list of targets:
$ du -sm /lib/modules/* | awk '$1 < 10 { print $2 }' /lib/modules/6.2.13-300.fc38.x86_64 /lib/modules/6.2.14-300.fc38.x86_64 /lib/modules/6.2.15-300.fc38.x86_64 /lib/modules/6.3.11-200.fc38.x86_64 /lib/modules/6.3.12-200.fc38.x86_64 /lib/modules/6.3.4-201.fc38.x86_64 /lib/modules/6.3.5-200.fc38.x86_64 /lib/modules/6.3.6-200.fc38.x86_64 /lib/modules/6.3.7-200.fc38.x86_64 /lib/modules/6.3.8-200.fc38.x86_64
Jeff
On Mon, 28 Aug 2023 18:37:11 -0700 ToddAndMargo via users users@lists.fedoraproject.org wrote:
Hi All,
Fedora 38
I got stuff all the way back to fc31.
Can I delete all the non fc38 directories?
It is already completed, but for future reference, you can run something like rpm -qf 5.14.16-201.fc34.x86_64 in /usr/lib/modules and it will tell you file 5.14.16-201.fc34.x86_64 is not owned by any package if it is orphaned.