Ubuntu – How to prevent the lp module from loading on boot

kernel

I use some software under a VMWare VM that needs to access the parallel port. If the lp kernel module is loaded, VMWare's Player can't access the port. I need to unload the module every time I want to use it under my virtual machine, and since I never use it under Ubuntu itself, it'd be nice if it was just not loaded by default.

I've tried adding blacklist lp to /etc/modprobe.d/blacklist.conf and running sudo update-initramfs -k all -u, but lsmod shows that it's still loaded after I boot. How can I keep the module from being loaded? I'm using Ubuntu 11.10 with the 3.0.0-x kernels from the kernel team PPA.

Best Answer

Building a custom kernel is not necessary

This is my procedure (legacy app, virtualized in vmware player, needing access to parallel port dongle)

in order for the parallel port dongle to work, the Ubuntu user needs to be a member of the lp group. As root (or sudo):

vigr    (add user to group lp)
vigr -s (repeat)

Next, you need to prevent the kernel module lp from loading

  1. Edit /etc/modules to ensure lp is not loaded at boot:

    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    
    #lp
    rtc
    
  2. Blacklist lp module (Ubuntu 10 and later) to allow the player to have access to it.

    Create a file: /etc/modprob.d/blacklist-vmware.conf

    #/etc/modprob.d/blacklist-vmware.conf
    blacklist lp
    
  3. Execute the following to update boot image:

    dpkg-reconfigure linux-image-$(uname -r)
    
  4. Edit /etc/default/cups to look like this:

    # Cups configure options
    
    # LOAD_LP_MODULE: enable/disable to load "lp" parallel printer driver module
    LOAD_LP_MODULE=no
    

Reboot and test!

lsmod | grep lp

(should be a null response)