Clean old folders in /usr/lib/modules?

Help for Current Versions of MX
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
User avatar
RallyDarkstrike
Posts: 151
Joined: Fri Jan 22, 2021 1:51 pm

Re: Clean old folders in /usr/lib/modules?

#11 Post by RallyDarkstrike »

Buck Fankers wrote: Thu Jul 25, 2024 10:32 pm
RallyDarkstrike wrote: Thu Jul 25, 2024 9:52 pm
Unrelated...but also related in the 'getting-more-space-back-on-a-small-hard-drive' theme......I've noticed there are 1.3GB of space being taken up by /var/cache/apt/archives......some cursory research online suggests it's safe to delete most of these as well? (Most are dated as being from over 1 or 2 years ago!)
I think, those may be APT cache files?
Old files that were used to update the system.

Anyway, I will suggest again ;) very nice MX tool called MX Cleanup.
With it, you can safely remove old APT cache files (Clear APT Cache) and some other stuff.

I had one Eee 32GB laptop and I hear your pain...

One more thing. Usually, I would not recommend bleach-bite, (hmm did I write name correctly?) this thing can sometimes go too deep and can potentially cause some problems. (I remember reading some on this topic) but there is one nice feature, wity this cleaning program, you can easily remove all locale files for all languages but the ones you are using. There are lots of those files (tens of thousands or hundreds of thousands?). While they are small, they do add up. Unfortunately it was few years ago, when I did this, so I can't give you detailed steps. Hope someone who knows, read this and post steps. Or see if you can find some YT video about it.
I do use Bleachbit....I'm no Linux expert, but I'm a power-user so I know what is safe to do with it and what isn't, so I do use it sparingly :) I have used the locale removal before and run it still on occasion as some updates bring unrequired locale files back.

MX Cleanup sadly does not remove the files I mentioned above...I've tried it!
Image

User avatar
RallyDarkstrike
Posts: 151
Joined: Fri Jan 22, 2021 1:51 pm

Re: Clean old folders in /usr/lib/modules?

#12 Post by RallyDarkstrike »

figueroa wrote: Thu Jul 25, 2024 10:47 pm You have 9.94GB remaining? You're never going to fill that up.
To be honest, it's taken a long time to get it to drop to less than 10GB, lol....but I sortof have 10GB free as a mental threshold on this thing, so I'd prefer if I had more than 10GB free, especially when I KNOW there is unneeded stuff sitting on the drive that no longer needs to be there! I just need to know the safe way of removing it :)
Image

User avatar
RallyDarkstrike
Posts: 151
Joined: Fri Jan 22, 2021 1:51 pm

Re: Clean old folders in /usr/lib/modules?

#13 Post by RallyDarkstrike »

MXRobo wrote: Thu Jul 25, 2024 11:24 pm MX Cleanup set weekly or monthly.
Approx: 32 GB – 10 = 22
80% rule of 32 ~ 25.5, so only 3.5 GB useful?
90% ~ 7 GB useful.
I have already tried MX Cleanup, it does not touch either of the things I've mentioned in my first post. It's all still there after I've run MX Cleanup.
Image

User avatar
RallyDarkstrike
Posts: 151
Joined: Fri Jan 22, 2021 1:51 pm

Re: Clean old folders in /usr/lib/modules?

#14 Post by RallyDarkstrike »

MadMax wrote: Sat Jul 27, 2024 1:10 pm I suggested apt clean in your other thread. Guess I was on the right path ;)

9.9 GB free is plenty. But just to make things a little more tidy: Are you using ext4? ext4 reserves 5 % of space by default for the root user. Even in case of a full disk 2-3% is plenty on a 32 GB drive. You can set the percentage with tune2fs.

Code: Select all

sudo tune2fs -m 2.5 /dev/sdX
Replace sdX with your root partition. This will set it to 2.5 percent. That's the value I'm using on all my ext4 drives. Don't set it lower than 1%, though, to be sure.
Also keep in mind that this reserved space is actually free, so ext4 uses it to reduce fragmentation no matter how high it is set.
EXT4, yes - probably won't need to something THIS in-depth, but I'll add it to my text file of 'random tidbits' that I can make use of down the road! :)
Image

User avatar
RallyDarkstrike
Posts: 151
Joined: Fri Jan 22, 2021 1:51 pm

Re: Clean old folders in /usr/lib/modules?

#15 Post by RallyDarkstrike »

@MadMax @Stuart_M @Buck Fankers @MXRobo

I stand corrected! sudo apt clean DID seem to get rid of the stuff in /var/cache/apt/archives - it just took a moment to update I guess! The limitations of a dual-core Celeron, I figure! ;)

Good, that's a bit of space back! Sitting pretty at whopping 11.4GB free now! :P

Now to just get that modules folder cleaned up a bit and I'll be golden!
Image

User avatar
RallyDarkstrike
Posts: 151
Joined: Fri Jan 22, 2021 1:51 pm

Re: Clean old folders in /usr/lib/modules?

#16 Post by RallyDarkstrike »

dolphin_oracle wrote: Thu Jul 25, 2024 9:00 pm yes, probably.

using "apt purge" along with the kernel package name should also clear those out, assuming you haven't cleared out the cache files that point to those package info. but deleting manually should be safe as long as its not a kernel that is currently installed.
I guess part of my problem is that I don't actually know for sure what kernels ARE installed now because the 'dpkg --list | grep linux-image' IS the command I always knew of to SEE what kernels are supposedly installed, but I'm pretty sure the 15 that are listed aren't all installed anymore?

I know I'm currently running 6.4.0-1mx-ahs-amd64 - and MX Cleanup tells me that 6.1.0-23-amd64 is also installed...that is the only one Cleanup lists...so as far as I know those are the only two I am SURE are installed?
Image

User avatar
dolphin_oracle
Developer
Posts: 22100
Joined: Sun Dec 16, 2007 12:17 pm

Re: Clean old folders in /usr/lib/modules?

#17 Post by dolphin_oracle »

RallyDarkstrike wrote: Sat Aug 10, 2024 9:36 pm
dolphin_oracle wrote: Thu Jul 25, 2024 9:00 pm yes, probably.

using "apt purge" along with the kernel package name should also clear those out, assuming you haven't cleared out the cache files that point to those package info. but deleting manually should be safe as long as its not a kernel that is currently installed.
I guess part of my problem is that I don't actually know for sure what kernels ARE installed now because the 'dpkg --list | grep linux-image' IS the command I always knew of to SEE what kernels are supposedly installed, but I'm pretty sure the 15 that are listed aren't all installed anymore?

I know I'm currently running 6.4.0-1mx-ahs-amd64 - and MX Cleanup tells me that 6.1.0-23-amd64 is also installed...that is the only one Cleanup lists...so as far as I know those are the only two I am SURE are installed?
anything in that list is actually installed. its just sometimes things get left behind at removal, which a "apt purge" will remove. it might not work if the apt cache has been cleaned up, but generally you can do an apt purge after a package has been removed. IIRC, those modules directories get left behind at removal/autoremoval. but if you can't apt purge you can delete whatever kernel is not actually installed.

looking at dpkg output there should be codes. ii is installed, rc would be "removed/conf files remain" or something similar.

https://linuxprograms.wordpress.com/201 ... dpkg-list/
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

Post Reply

Return to “MX Help”