Page 1 of 1

[Resolved] Can a printer driver be used on a Linux host with a Windows guest?

Posted: 21. Jun 2019, 19:05
by Vanasati
I have a Windows 7 virtual machine and Ubuntu 18.04 LTS as the host. I have an HP printer and hplip lacks a feature I need which is available in the Windows drivers. I would like to know if it's possible to allow access to my USB ports to the Windows virtual machine using the guest additions and install the HP drivers on Windows to print a document using the virtual machine.

I also would like to know the risks of allowing a Windows guest to access my USB ports. Is it safe if I use a clean Windows VM with network access disabled (because Windows 7 support will end next year and it's the only modern version of Windows I can run on my computer as it can run fine with 512 MB of RAM while Windows 8 and 10 can't) and if I keep VirtualBox and the Guest Additions up-to-date?

Thanks in advance.

Re: Can a printer driver be used on a Linux host with a Windows guest?

Posted: 21. Jun 2019, 21:40
by scottgus1
You can pass USB devices into a guest. It is usually recommended to have devices like printers on the host PC and sher them into your guest, but in your case, to get better capability from the drivers, it might be an interesting idea.

I would not have a problem having an old OS still running if I needed it. I have XP on an old PC running some backup software for my house network. No internet, it's just fine. May not be much need to update Virtualbox regularly either, unless the host OS requires it.

See USB basics and troubleshooting and follow the steps carefully. If you have trouble, see step 8 for the info we will need to help further.

Re: Can a printer driver be used on a Linux host with a Windows guest?

Posted: 21. Jun 2019, 22:32
by Vanasati
Okay, I read the thread and if you don't mind I'll write the steps here before trying to do it just to make sure I understood it correctly.
First I have to install the extension pack (its package name in the Ubuntu repositories is virtualbox-ext-pack). I must add my user to the vboxusers group, too.
Once done, I turn the virtual machine on (which already has the Guest Additions installed) and I go to Settings > USB > USB 2.0 (EHCI) Controller.
Afterwards, (and considering a printer is an idling device and the on-the-fly option works, because I'm not sure what kind of device it is) I just would have to go to Devices > USB > and choose the printer. And if the Windows VM has the drivers installed, I should be able to print a document from the VM.

Am I right?

Re: Can a printer driver be used on a Linux host with a Windows guest?

Posted: 21. Jun 2019, 23:05
by socratis
Vanasati wrote:access to my USB ports to the Windows virtual machine using the guest additions
The Guest Additions (GAs) have nothing to do with USB. The Extension Pack does, which provides support for USB2/3. That's why you need the ExtPack.
Vanasati wrote:First I have to install the extension pack (its package name in the Ubuntu repositories is virtualbox-ext-pack)
No, don't. If you installed VirtualBox from the Ubuntu repositories, then that's a fork. You should completely remove/uninstall/delete/purge their version and install the official version from the Linux Downloads section of VirtualBox.
Vanasati wrote: turn the virtual machine on (which already has the Guest Additions installed) and I go to Settings > USB > USB 2.0 (EHCI) Controller
No. You can't change the settings while the VM is running, they're greyed out. You wouldn't change the hardware on a running computer, would you?
Vanasati wrote:I just would have to go to Devices > USB > and choose the printer
That's what on-the-fly means, while the VM is running.
Vanasati wrote:And if the Windows VM has the drivers installed, I should be able to print a document from the VM.
In theory, yes.
Vanasati wrote:I also would like to know the risks of allowing a Windows guest to access my USB ports
Zero.

Re: Can a printer driver be used on a Linux host with a Windows guest?

Posted: 24. Jun 2019, 18:26
by Vanasati
I understand that if I try to follow the USB sharing tutorial with the Ubuntu fork and something doesn't work I should either use the most recent version or ask it on the Ubuntu forums, but I decided to try it with the version found in the Ubuntu repositories and it worked. I can print documents from the Windows VM flawlessly, and the feature I needed works as well.

Thanks, socratis and scottgus1 for your help. And thanks to Oracle and the VirtualBox team for making this possible.

Re: Can a printer driver be used on a Linux host with a Windows guest?

Posted: 25. Jun 2019, 09:12
by socratis
Vanasati wrote:with the Ubuntu fork and something doesn't work I should either use the most recent version or ask it on the Ubuntu forums
That would be correct now and in future correspondence ;)

One of the things that fail with the forks is the interaction between the main program and the Oracle ExtPack. Interesting (in a good way) that it worked.

Marking as [Resolved].