Sharing a USB Printer with Samba and Xen

Discussion in 'Server Operation' started by atjensen11, Oct 17, 2008.

  1. atjensen11

    atjensen11 New Member

    Okay, so I have been really experimenting with Xen and trying to virtualize many of my machines with different configurations.

    I have had a lot of success with using the pciback.hide command with Network Adapters and then assigning them to a VM in the configuration file. One of the virtual machines is a Samba print server which I would like to add print server abilities with CUPS and Samba. I thought I would try same PCI hiding technique for the USB printer.

    Here is some background:
    Code:
    root@big10:~# lsusb
    Bus 005 Device 001: ID 0000:0000
    Bus 004 Device 001: ID 0000:0000
    Bus 003 Device 002: ID 03f0:6204 Hewlett-Packard DeskJet 5150c
    Bus 003 Device 001: ID 0000:0000
    Bus 002 Device 001: ID 0000:0000
    Bus 001 Device 001: ID 0000:0000
    root@big10:~# lspci | grep USB
    00:1d.0 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #1 (rev 02)
    00:1d.1 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #2 (rev 02)
    00:1d.2 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #3 (rev 02)
    00:1d.3 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #4 (rev 02)
    00:1d.7 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02)
    
    I have tried only forwarding the USB controller that has the printer plugged in. I saw the printer (/dev/usb/lp0) in the VM, but test prints to the printer resulted in a bunch of jibberish printed on the paper. I tried forwarding all the controllers with the same result.

    Has anyone had any luck and willing to share how they set up a USB printer in a VM?
     
  2. falko

    falko Super Moderator

    Are there maybe any errors in your logs?
     
  3. atjensen11

    atjensen11 New Member

    I thought I had responded previously, but it doesn't appear that way.

    Anyhow, I did check several log files related to my attempts to hide portions of the USB Controller and/or devices from the Xen Dom0 machine and then specify them in a DomU.

    At some points, it appeared as though I might be successful in that when I looked in the /dev folder on the DomU, I would see the link created for the printer just as it was automatically created when I plugged the printer into the Dom0 machine. This was promising too from the standpoint of when I went into CUPS and installed a printer, one of the options in the drop down included the USB printer.

    However, print jobs sent to that printer always failed and littered my logs with errors, none of which seemed decipherable by me.

    Even when the USB printer was shown, if I ran the lsusb command on the DomU, it never returned any devices. So it never appeared as though the device was actually installed as a USB device.

    In the end, I just left the printer installed on the Dom0 and configured Samba to share it out to my network. It wasn't the ideal work around, but it is working for the time being.
     

Share This Page