Mac OS X on x86 Hardware 2008–2024 Technical Archive
InfiniteMac OSx86 › Leopard 10.5 › Removing a kext
25,673 reads · 2010-01-30
Report Leopard 10.5 Voodoo / XNU Kernel

Removing a kext

Hola. I need to remove the Voodoo PS/2 driver from my system to test something. Is it safe to simply rm -r /System/Library/Extensions/VoodooPS2Controller.kext in single-user mode? EDIT: Answering my own question; yes, it seems safe. I had…

Primary Author
@OSTwister Published 2010-01-30
Collection
Leopard 10.5
Archival Footprint
25,673 historical reads · 1 curated field notes (from 2 dispatches) · 2010-01-30
Credited Voices (2)
@OSTwister@lanceomni

Hola. I need to remove the Voodoo PS/2 driver from my system to test something. Is it safe to simply rm -r /System/Library/Extensions/VoodooPS2Controller.kext in single-user mode?

EDIT: Answering my own question; yes, it seems safe. I had a little trouble rebooting but that could have been other factors, Leopard is not stable in this VM yet. Actually after the reboot it stayed running for the longest yet.

Synthesized Community Field Notes

1 technical responses curated from 2 original dispatches

Field Note #1 @lanceomni 2010-01-30

I would suggest that you backup your extensions folder or at least the kext in question prior to removing it. You will also want to remove the Extensions.mkext cache file so that it is rebuilt without the kext you just removed. (Extensions.mkext is located in the /System/Library folder.)

Other Handy Single User Tips

Mount a USB thumb drive in Single User Mode -s
You can copy files to a USB thumb drive and then mount the drive in Single User Mode to correct certain issues.
Boot into Single User Mode without the USB thumb drive plugged in. You can do this by entering -s on start up.

1. Allow for the modification of files by typing:

/sbin/mount -uw /

2. Make a directory in /Volumes to mount your USB thumb drive to. We will call it "usbdrive" by typing:

mkdir /Volumes/usbdrive

3. Before we plug it in we need to take notice at what drives we see in /dev by typing (You might want to write them down):

ls /dev/disk*

4. Now plug in the usb thumb drive, wait a second then look for the new addition by typing:

ls /dev/disk*

5. Now lets mount it. Lets say you there are two new additions disk4 & disk4s1. Type the following (replace msdos with hfs depending on how the usb thumb drive is formatted. If you use it on a PC too then its most likely msdos):

mount -t msdos /dev/disk4s1 /Volumes/usbdrive

Then you can access your usb thumb drive at /Volumes/usbdrive

Copy kexts from your mounted USB thumb drive to your Extensions folder
Once you have the USB drive mounted you can move files around. For example you can do the following to install a kext stored on the USB thumb drive to your extensions folder. Assuming you followed the steps in the previous section.
1. Change directories to /System/Library This will shorten some of the commands we have to type in.

cd /System/Library

2. Make a backup copy of your kexts. First we will make a directory called "backup" in our root directory to store them. Open Terminal and type:

mkdir /backup

3. Copy your kexts to the new "backup" folder.

cp -r Extensions/ /backup/

4. Copy the kext from your USB thumb drive to the extensions folder (Replace MYKEXT.kext with the name of the kext you want to install Assuming that the file on is in the root directory of the USB thumb drive).

cp /Volumes/usbdrive/MYKEXT.kext Extensions/MYKEXT.kext

5. Set the proper permissions for the extensions folder.

chmod -R 755 Extensions/

6. Set the proper ownership for the extensions folder.

chown -R root:wheel Extensions/

7. Touch the extensions folder

touch Extensions/

8. Remove the extensions cache to force OSX to rebuild it with our new kext.

rm -rf Extensions.mkext

9. Reboot using the boot-flags -v -f
-v Verbose Mode displays useful information durring the boot process.
-f Forces OSX to load kexts from the extensions folder instead of the cache file. We did delete the cache file so this is just a precaution.

Install kernel stored on USB thumb drive
Once you have the USB drive mounted you can move files around. For example you can do the following to install a kext stored on the USB thumb drive to your extensions folder. Assuming you followed the steps in the previous section.

1. Make a backup copy of your existing kernel and name it mach_kernel.backup

cp -r /mach_kernel /mach_kernel.backup

2. Copy the new kernel from your USB thumb drive to the root directory

cp -r /Volumes/usbdrive/mach_kernel /mach_kernel

3. Correct ownership for all kernels

chown root:wheel /mach_kernel*

4. Correct permissions for all kernels

chmod 644 /mach_kernel*

*You need to have the same version kernel & system.kext for OSX to work properly
5. Change Directories to your /System/Library to shorten the remaining commands.

cd /System/Library

6. Copy the matching system.kext to your extensions folder.

cp -r /Volumes/usbdrive/system.kext Extensions/system.kext

8. Set proper permissions for your extensions folder

chmod -R 755 Extensions/

9. Set proper ownership for your extensions folder

chown -R root:wheel Extensions/

10. Touch the extensions folder

touch Extensions/

11. Remove the extensions cache and force OSX to rebuild it with the new one.

rm -rf Extensions.mkext

12. Reboot using the boot-flags -v -f
-v Verbose Mode displays useful information durring the boot process.
-f Forces OSX to load kexts from the extensions folder instead of the cache file. We did delete the cache file so this is just a precaution.

Sources & Contributor Provenance (2 credited usernames · Thread #5368)
UsernameDossier ContributionDispatchesActive Window
@OSTwisterPrimary Author12010-01-30
@lanceomniContributor12010-01-30