removing kernel modules is safe?

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

removing kernel modules is safe?

#1 Post by nosystemdthanks »

always looking for ways to customise distros and make them smaller.

yesterday i found that support for minix filesystems isnt a standard feature. slacko has or had it, early versions of puppy relied on it, i even found out my own distro has it. for debian-based distros, cat /proc/config.gz | grep MINIX_FS is the way to tell. for the earliest versions of puppy, you have to convert vmlinuz to vmlinux and run grep.

when i say "removing kernel modules" i mean moving them out of /lib/modules and seeing what happens. obviously some modules will be needed to boot, let alone function properly. the minix kernel module can be removed, i believe.

what else could we (optionally) get rid of?

this applies to modules that arent integrated in the kernel. the idea that you can make a tighter kernel with fewer modules isnt new. but i never hear about people deleting stuff from /lib/modules.

mine is 5% of 1gb. id have to reboot to be sure, or i might try this in qemu. but for example i usually remove the wireless card from my laptop (on the rare occasion when i need wifi, they have usb versions.)

theres > 100 items in kernel/drivers/net/wireless. i could probably just move those and then check the general stability for a while. have other people tried this sort of thing? this is what zdrv does, right? i mean it moves optional stuff to a different sfs.
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#2 Post by mikeb »

No problem if you don't need the driver(s).
Did the same for XP...makes for a much smaller driver store.

Worth running 'depmod' afterwards to rebuild the kernel module database...it may not happen automatically.

lsmod in a terminal shows what you are actually using.

Of course this is all ok for your own use but may not be so useful for a public release.

One approach is to make an sfs of removed drivers so they can be added back easily.....I believe adrive is helpful there.

mike

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#3 Post by bigpup »

Anything not needed for your hardware can be removed, but then you have an OS that will only support your specific computer.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#4 Post by amigo »

You should find out which modules are being loaded and then selectively use rmmod to check whether anything breaks. Or use modinfo to read what the modules says about itself.

User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

#5 Post by nosystemdthanks »

very cool. youre all confirming things i suspected, but then that was the point of this thread. thanks.

i got very expert at removing unnecessary components in windows 9x. took a few years, but i learned a lot about stripping down gnu/linux too. but i was never sure about /lib/modules. i do use rmmod, modprobe and lsmod. (and rmmod of course, doesnt remove the file, it just unloads it.)
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

ITSMERSH

#6 Post by ITSMERSH »

mikeb wrote:No problem if you don't need the driver(s).
Did the same for XP...makes for a much smaller driver store.

Worth running 'depmod' afterwards to rebuild the kernel module database...it may not happen automatically.

lsmod in a terminal shows what you are actually using.

Of course this is all ok for your own use but may not be so useful for a public release.

One approach is to make an sfs of removed drivers so they can be added back easily.....I believe adrive is helpful there.

mike
Some one may prove me wrong, but I think it is the fdrv that is more appropriated in addition to the zdrv in new puppies for drivers and stuff.

I have a fdrv_4.1.11_tahr64_2.sfs with lots of stuff in /lib just like the zdrv does.

I think the adrv is more for a use of applications etc.

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#7 Post by Keef »

Isn't there a way of compiling a kernel that just builds currently used modules? I think i tried it once, but it was years ago.
After a quick search, it may be 'localmodconfig' I'm thinking of.

Post Reply