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.


How can I keep the module from being loaded?

lp is built into the kernel, so blacklisting it won't work. The simple solution is to do rmmod lp to unload it once logged in. You can automate this by making an init script, or just putting this in your .bashrc -- use rmmod lp 2>nul so that if the module is already unloaded, it won't clutter your screen with an error.

I'm using Ubuntu 11.10 with the 3.0.0-x kernels from the kernel team PPA.

The long-term solution is to simply remove the module from the kernel, which of course requires building a custom kernel. Please see this community help page for more information on how to do this, if you choose to go this way.

  • I used to do it all the time, now... meh. – detly May 9 '12 at 7:37
  • Build custom kernels. Back when various wireless protocols weren't built in, or USB bluetooth/IR/3G dongles needed arcane tweaking of settings. It shows how long it's been that I forgot you couldn't blacklist a built-in module, and didn't think to check for it :P – detly May 9 '12 at 8:10
  • Unless VMWare needs access to the port upon bootup, an init script/upstart job should be sufficient. – ish May 9 '12 at 8:12

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.
  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

    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

Reboot and test!

lsmod | grep lp

(should be a null response)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.