USB Printer problems

Discussions related to using VirtualBox on Linux hosts.
Post Reply
JClosed
Posts: 12
Joined: 6. Aug 2008, 17:58

USB Printer problems

Post by JClosed »

I am using a Linux host and running a Windows XP guest. In this guest machine I am using a USB connected printer (Brother HL2030). This works great using the supplied windows printer drivers. So no problems here...

The real problems start after using the virtual machine. If I shut down the XP guest my printer is not longer functioning on the host machine. Print jobs are placed in the printer queue, but not printed. Only after a restart of the host machine all jobs are printed at once. Connecting or/and disconnecting the USB printer in the VirtualBox settings does not help very much. The printer stays disconnected.

I tried to find a answer to this problem here, but the only solution I found is to disconnect and reconnect the USB cable from the printer in stead of restarting the host. This is indeed a lot simpler than restarting the whole host, but still not a real solution. It seems CUPS has lost the printer after running VirtualBox and won't get ik back again.

Has anyone a solution that does not involve a physical connect/reconnect of the USB printer cable?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

You can try Samba and share the printer over the network to the Guest system. I posted some instructions here in a different topic (Windows Guests somewhere) for how to add a network printer. You can try that.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
JClosed
Posts: 12
Joined: 6. Aug 2008, 17:58

Post by JClosed »

Oh - but I allready use samba to connect the printer to other (virtual and non-virtual) systems. It works very well. No problem.

In this particular case however the virtual machine has to kept isolated from the outside world. It is obvious under that circumstances I cannot use a network and samba, so I have to use the direct USB connection.

I was hoping someone would have a easy answer to this problem. I can use a script to start a virtual machine (using the VBoxManage command) and my first thoughts where there could also be some command(s) that mimic a physical disconnect/re-connect of the USB printer. My knowledge of Linux is not that deep however, so here is the reason I was asking for help.

So...... anyone? :D
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

You could try to share the printer on the Host, use Host Interface only (not bridge, so the VM won't go outside your Host) and connect through the network anyway. The network is of course your Host ;).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
JClosed
Posts: 12
Joined: 6. Aug 2008, 17:58

Post by JClosed »

I am sorry - I feel a bit stupid, but how do I do this?

My host is connected to a modem/router and has IP adress 10.0.0.10 on eth0.
Subnet mask: 255.255.255.0
My gateway is: 10.0.0.2
My DNS server is also 10.0.0.2

I understand I have to set up a virtual network card named tap0, so I could do:

tunctl -t tap0 -u myname (where myname is my username)

Then i have to assign an IP adress to tap0. And there is were I am uncertain. I can use the command:

ifconfig tap0 <ipadress> to set the IP adress for tap0. Now here are my questions:

Do I use a IP adress in the same range - like 10.0.0.11? Or do I have to use a different range like 10.0.1.1?

I know I have to set virtual box to:
Attach to: Host Interface
Interface name: tap0

Now I also want to know what settings are used in the XP guest. I googled a bit and I gues the settings must be:

IP adress: 10.0.0.12 (If I have used 10.0.0.11 for tap0 - otherwise 10.0.1.2 if I have used 10.0.1.1 for tap0) Not sure here what to configure....

Netmask: 255.255.255.0
No gateway
No DNS

I tried the above in a few configurations, but could not connect to the SAMBA server on the host. I am a bit lost and - as I said before - I do feel a bit stupid..

Can someone point me in the right direction? Thanks a lot!!
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

I posted it a couple of times, and will do it here again. I use the permanent interface option, so you only have to do this once, the IP thing can be set in your network settings file/manager.

Code: Select all

VBoxAddIF vbox0 jclosed
ifconfig vbox0 192.168.0.1 netmask 255.255.255.0 up
Now make sure that your Samba does not bind it's service to one interface, but all interfaces, else you won't see the share on the Guest.
Set the following IP config on the Guest:

Code: Select all

IP address 192.168.0.2
Netmask    255.255.255.0
Gateway    [emtpy]
DNS        [emtpy]
Now see if you can access the Host on 192.168.0.1. I specifically used a whole different subnet range, as with the default netmask, 10.0.0.x can be accessed by 10.0.1.x.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply