Removing "kext" kernel extensions

Discussion in 'Mac OS X System & Mac Software' started by vikingshelmut, Feb 16, 2002.

  1. vikingshelmut

    vikingshelmut 100% Bull Plop

    Joined:
    Dec 5, 2001
    Messages:
    66
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Über Genius
    Location:
    Cupertino, CA
    Just wanted to ask everybody their thoughts regarding removing unnecessary kernel extensions from the "extensions" folder in os X. I've noticed extensions in there for ADB, SCSI, and other devices that I don't use, or ever plan on using. Is it save to remove a kext from the extensions folder? From what I understand, these are treated similar to extensions in 9, but I might be wrong. Are there other references to a kext in the system that could cause a problem when booting?

    I might be wrong, but I just figured that at startup, the system looks in this directory, and if anything is present, loads it into the kernel. There is a lot of stuff in there that I don't need, so I want to get rid of it (backed up of course), to hopefully produce a smaller, more stable kernel (less kernel panics!).

    Anybody test this out? Any negative results? Let me know!
     
  2. Alexandert

    Alexandert gonneawaycameback

    Joined:
    Sep 28, 2001
    Messages:
    791
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Haubtschuhle
    Location:
    /dev/null
    Try it!:)
    But in Linux the Kernel knows what to load. If somethings missing...:(
     
  3. blb

    blb `'

    Joined:
    Apr 9, 2001
    Messages:
    651
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    CO, USA
    Actually, looking at /etc/rc, it appears the cache should be rebuilt if anything in the Extensions directory is changed (the -ot part):

    Code:
    if [ ! -f /System/Library/Extensions.mkext -o \
         /System/Library/Extensions.mkext -ot /System/Library/Extensions ]; then
    # rebuild cache here
    
    So anytime anything updates the /System/Library/Extensions directory, a reboot should rebuild it.
     
  4. blb

    blb `'

    Joined:
    Apr 9, 2001
    Messages:
    651
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    CO, USA
    Of course, since kernel extensions are only loaded on a need-basis, deleting them shouldn't affect performance much (only when rebuilding that cache).

    To see what extensions are currently loaded, run

    Code:
    sudo kmodstat
    
    According to my system, 63 are currently loaded.
    Also, note, there are (on my system anyway) 104 .kext directories under /System/Library/Extensions but there are many more than this, as some kext's have kext's inside (ie, /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/IOUSBUserClient.kext).
     
  5. vikingshelmut

    vikingshelmut 100% Bull Plop

    Joined:
    Dec 5, 2001
    Messages:
    66
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Über Genius
    Location:
    Cupertino, CA
    Thanks for the quick responses. Some quick questions, though.

    The rebuild cache process - this happens at every startup? If so, then this is theoretically like restarting 9 to unload an extension from memory (except that kext files arn't loaded in memory?)

    So, why does apple have all these kexts installed on machines which don't require that kext. Shouldn't the installer be able to recognize that that new G4 Dual 1ghz you have on your desk doesn't have a freakin' ADB port?


    Anybody actually test this out?
     
  6. Alexandert

    Alexandert gonneawaycameback

    Joined:
    Sep 28, 2001
    Messages:
    791
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Haubtschuhle
    Location:
    /dev/null
    YOUR MAC DOES NOT LOAD THE EXTENSIONS YOU DONT NEED!!!
    Use the command above to see what is loaded!:eek: :)
     
  7. Aqualung

    Aqualung Banned

    Joined:
    Nov 6, 2001
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Ann Arbor
    Might as well leave them in case you need them in the future. They don't take up much HD space, and OS X only loads them when needed.

    Habits from using OS 9 are no longer useful. These extensions aren't like OS9's, where the fewer, the better.
     
  8. stormbringer

    stormbringer Registered

    Joined:
    Feb 12, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Graphic/Web Designer
    Location:
    CST
    When issuing this command from terminal, what user are you logged in as? When I try this from the command line (looged in as a user with admin permissions) the systems next response is <Password:>. When I type in my password it responses with <sudo: kmodstat: command not found>??!!

    I used this command before when trouble shotting my Adaptec card! That was under 10.1.5. Would 10.2.4 make a difference?
     
  9. stormbringer

    stormbringer Registered

    Joined:
    Feb 12, 2003
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Graphic/Web Designer
    Location:
    CST
    Opps, it appears that the borad doesn't like you using left and right arrow.

    Repost:
    When issuing this command from terminal, what user are you logged in as? When I try this from the command line (looged in as a user with admin permissions) the systems next response is Password:. When I type in my password it responses with sudo: kmodstat: command not found.??!!

    I used this command before when trouble shotting my Adaptec card! That was under 10.1.5. Would 10.2.4 make a difference?
     
  10. kenny

    kenny Registered

    Joined:
    Sep 21, 2000
    Messages:
    499
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Unix Geek
    Location:
    Concord, NC
    Maybe not 10.2.4, but just 10.2.x... It doesn't work on my 10.2.3 machine either. The command under 10.2.? is kextstat. I'm not so sure that it's not loading up stuff that it doesn't need, though:


    45 0 0x1dd80000 0x6000 0x5000 com.apple.iokit.SCSITaskUserClient (1.2.3) <38 36 5 4 3 2>
    64 0 0x14f84000 0x6000 0x5000 com.apple.driver.AppleADBMouse (2.0.7d1) <15>


    Could be that these contain code that is used by devices other than SCSI and ADB, so I'm not real interested in removing them just to "see what will happen", but I question their presence on my PowerBook...
     
  11. lurk

    lurk Mitä?

    Joined:
    Mar 30, 2002
    Messages:
    2,088
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Land o' skeeterz
    I don't know if it is at all relevant to this case but FireWire is a SCSI derivative and it may well have common components in Apple's implementation. So just because you don't have a scsi card in your powerbook having the scsi module loaded may still make perfect since.

    -Eric
     
  12. kenny

    kenny Registered

    Joined:
    Sep 21, 2000
    Messages:
    499
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Unix Geek
    Location:
    Concord, NC
    That's true... I forgot about the SCSI/FW relationship.

    I got curious about ADB, too, and I guess that on the 'Books, at least, the keyboard and trackpad are still ADB-esque. During early boot (well before disks even get mounted) there's a line in /var/log/system.log that reads "mach_kernel: ADB present:8c". Interesting...
     

Share This Page