LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Virtual Box + Printer Help!!!! (https://www.linuxquestions.org/questions/slackware-14/virtual-box-printer-help-623744/)

BULPulse 03-18-2008 07:19 PM

Quote:

Originally Posted by T3slider (Post 3093256)
It's a Lexmark Z23 (it has just about the crappiest Linux drivers in the world, which would only print one page at a time [ie I'd have to restart the print job for each page] in black and white only). http://openprinting.org/show_printer...um=Lexmark-Z23 lists it as a paperweight. :)

The procedure should work for any printer though (ie it will allow you to install the printer just as you would in native Windows). I have another (network) printer, but it's more of a hassle to print with (it's nowhere near my computer and I have to go get the prints), but now if I need to print something out I can start up VirtualBox (if not already started) and print through my printer, which is located right next to my PC. Very convenient. And, since I often use MS Word under VirtualBox (and sometimes under WINE, depending on the complexity of the document), VirtualBox would already be open and I could just click the "Print" button. Very nice.

That is pretty good :D but I tried it and it is not working, I am tring few things now but I don't know if it will be able to do it. BTW how did you learn everything you know about Linux??

T3slider 03-18-2008 11:22 PM

I'll attempt to talk you through it if you give me some info. Did you get the proper USB settings for you printer? (ie vendor ID etc.). Post them here so I can verify that they are correct. Make sure you added the codes to the "Settings>USB" section for the proper guest OS (click the "Add Empty" icon on the right if there isn't already a default entry -- the entry was already there for me, and I just changed the values [they may have even already been correct, but I don't remember]). Click "OK". Add the following line to /etc/fstab (or confirm it if you already did it), as posted above:
Code:

none            /proc/bus/usb    usbfs      devgid=106,devmode=664 0 0
Mine is added right at the very bottom of my fstab. Again, change the 106 in "devgid=106" to a group that contains your user. If you created a new group, try restarting your computer to make sure everything is added properly (there are ways of doing it without restarting, but I don't know them offhand. It's probably not even necessary, but it's a good idea to make sure anyway). VirtualBox apparently depends on the usbfs to interface with the USB devices; usbfs isn't set up by default in Slackware (or many other distros). For this, you HAVE to restart as far as I know (fstab sets up mounting options after a restart). There is supposedly a way to get this to work by modifying the permissions on /proc/bus/usb/00#, but it didn't work for me (although I didn't try very hard since it would only be a temporary solution anyway). When I modified the permissions only, without the usbfs, Windows DID detect my printer but when I right-clicked on the USB icon in the statusbar of the VirtualBox window, my printer was still grayed out. Despite Windows recognizing my printer, the driver installation did not detect the printer, and it didn't work. However, after adding the line to fstab, my printer was NOT grayed out and the installation of the drivers went off without a hitch.

If you still have trouble with it, I'd be more than happy to help as long as you provide enough info. Your printer model is different than mine, so it may require some nifty tinkering, but hopefully not. It should be noted that I still have the (crappy) Lexmark drivers installed in Linux (even though they barely work and I don't print from that printer within Linux), so I don't know if that is providing a gateway for Windows to access it or whether the drivers are not required in the first place. I would do some tests but I don't really have the time (plus it's too much effort). However, it suggests that if you can't get it working no matter what through VirtualBox that you may be able to get it working even if you can find half-working Linux drivers. I really don't think it's necessary though (I think it should work without the Linux drivers) because I have many more options in Windows through VirtualBox than in Linux using their poorly-written drivers.

Quote:

Originally Posted by BULPulse
BTW how did you learn everything you know about Linux??

If I appear knowledgeable about Linux in any way then I have successfully fooled you. ;) I just have a knack for anything electronic (although I am studying genetics, I could easily have gone into a career in computer science or programming [despite my limited knowledge of programming, I have an aptitude for it -- although I don't program at all now, I used to enjoy it. My only regret is never really learning C]). I have a friend who consistently asks me why I chose genetics and suggests that I should have AT LEAST majored in computer science. But I didn't. :)

I owe everything I know about Linux to a genuine interest in it and computers in general. I've always loved computers but hated Windows, and felt like I capped out in what I could do in Windows. Then I tried Linux and it opened up a world of new (and basically endless) stuff to learn. I'm an oddity in the Linux world I think -- I read a fair amount before I even burned the discs. I read all of the Beginner's course (and some of the Intermediate course) from http://www.linux.org/lessons/ before installing, and then went through all of the tutorials (omitting a few things I wasn't interested in in the intermediate and advanced courses, like setting up a mailserver) after installing Slackware 11.0 on a junk PC I had in my basement. Since the PC was not being used and I had another PC that I depended on, I could feel free to completely screw things up with no worries (although I actually never managed to screw anything up, strangely). After those courses, which are admittedly dated (some of the Apache stuff is largely irrelevant with Slackware 12.0, since it no longer uses the 1.3.x branch, but was relevant when I started with Slackware 11.0), I just basically read the posts in these forums. I would consider myself a very good internet searcher (I can almost always find what I'm looking for). So, if I ever have trouble with anything, I can generally find an answer without asking for help. If you look back through my posts (you don't have to, I'm just making a point) I ask very few questions and instead just answer what I know (although I have asked the occasional question, as shown in this thread). My original answers were based only on what I knew, which was little. But reading these forums allowed me to learn more and answer more (plus, while finding solutions to problems I have, I learn new stuff). I've never managed to bork any system up, although I probably would have learned more if I had.

If you're looking for something to learn [if you haven't already learned it], try compiling your own kernel (and don't even start with the generic kernel -- try it on your own. If you are really unsure of what the option should be, check what it is in the existing kernel configuration and use that). I still don't know what half (well, more than half) of the options mean -- but I've only managed to screw up a kernel once. Make sure to have a spare working kernel that you can boot from though...;) Have fun, break stuff (if you can afford to) and read.[/life story]

BULPulse 03-19-2008 03:12 PM

Quote:

Originally Posted by T3slider (Post 3093415)
I'll attempt to talk you through it if you give me some info. Did you get the proper USB settings for you printer? (ie vendor ID etc.). Post them here so I can verify that they are correct. Make sure you added the codes to the "Settings>USB" section for the proper guest OS (click the "Add Empty" icon on the right if there isn't already a default entry -- the entry was already there for me, and I just changed the values [they may have even already been correct, but I don't remember]). Click "OK". Add the following line to /etc/fstab (or confirm it if you already did it), as posted above:
Code:

none            /proc/bus/usb    usbfs      devgid=106,devmode=664 0 0
Mine is added right at the very bottom of my fstab. Again, change the 106 in "devgid=106" to a group that contains your user. If you created a new group, try restarting your computer to make sure everything is added properly (there are ways of doing it without restarting, but I don't know them offhand. It's probably not even necessary, but it's a good idea to make sure anyway). VirtualBox apparently depends on the usbfs to interface with the USB devices; usbfs isn't set up by default in Slackware (or many other distros). For this, you HAVE to restart as far as I know (fstab sets up mounting options after a restart). There is supposedly a way to get this to work by modifying the permissions on /proc/bus/usb/00#, but it didn't work for me (although I didn't try very hard since it would only be a temporary solution anyway). When I modified the permissions only, without the usbfs, Windows DID detect my printer but when I right-clicked on the USB icon in the statusbar of the VirtualBox window, my printer was still grayed out. Despite Windows recognizing my printer, the driver installation did not detect the printer, and it didn't work. However, after adding the line to fstab, my printer was NOT grayed out and the installation of the drivers went off without a hitch.

If you still have trouble with it, I'd be more than happy to help as long as you provide enough info. Your printer model is different than mine, so it may require some nifty tinkering, but hopefully not. It should be noted that I still have the (crappy) Lexmark drivers installed in Linux (even though they barely work and I don't print from that printer within Linux), so I don't know if that is providing a gateway for Windows to access it or whether the drivers are not required in the first place. I would do some tests but I don't really have the time (plus it's too much effort). However, it suggests that if you can't get it working no matter what through VirtualBox that you may be able to get it working even if you can find half-working Linux drivers. I really don't think it's necessary though (I think it should work without the Linux drivers) because I have many more options in Windows through VirtualBox than in Linux using their poorly-written drivers.


If I appear knowledgeable about Linux in any way then I have successfully fooled you. ;) I just have a knack for anything electronic (although I am studying genetics, I could easily have gone into a career in computer science or programming [despite my limited knowledge of programming, I have an aptitude for it -- although I don't program at all now, I used to enjoy it. My only regret is never really learning C]). I have a friend who consistently asks me why I chose genetics and suggests that I should have AT LEAST majored in computer science. But I didn't. :)

I owe everything I know about Linux to a genuine interest in it and computers in general. I've always loved computers but hated Windows, and felt like I capped out in what I could do in Windows. Then I tried Linux and it opened up a world of new (and basically endless) stuff to learn. I'm an oddity in the Linux world I think -- I read a fair amount before I even burned the discs. I read all of the Beginner's course (and some of the Intermediate course) from http://www.linux.org/lessons/ before installing, and then went through all of the tutorials (omitting a few things I wasn't interested in in the intermediate and advanced courses, like setting up a mailserver) after installing Slackware 11.0 on a junk PC I had in my basement. Since the PC was not being used and I had another PC that I depended on, I could feel free to completely screw things up with no worries (although I actually never managed to screw anything up, strangely). After those courses, which are admittedly dated (some of the Apache stuff is largely irrelevant with Slackware 12.0, since it no longer uses the 1.3.x branch, but was relevant when I started with Slackware 11.0), I just basically read the posts in these forums. I would consider myself a very good internet searcher (I can almost always find what I'm looking for). So, if I ever have trouble with anything, I can generally find an answer without asking for help. If you look back through my posts (you don't have to, I'm just making a point) I ask very few questions and instead just answer what I know (although I have asked the occasional question, as shown in this thread). My original answers were based only on what I knew, which was little. But reading these forums allowed me to learn more and answer more (plus, while finding solutions to problems I have, I learn new stuff). I've never managed to bork any system up, although I probably would have learned more if I had.

If you're looking for something to learn [if you haven't already learned it], try compiling your own kernel (and don't even start with the generic kernel -- try it on your own. If you are really unsure of what the option should be, check what it is in the existing kernel configuration and use that). I still don't know what half (well, more than half) of the options mean -- but I've only managed to screw up a kernel once. Make sure to have a spare working kernel that you can boot from though...;) Have fun, break stuff (if you can afford to) and read.[/life story]

Thanks for all the information and the help offering. My problem is not with the printer but that after i add the line you said and reboot when i switch on VirtualBox my keyboard doesn't work and my mouse works but i can't see the pointer, when i tried to install driver for the mouse it just failed for some reason :( otherwise it finds the printer

T3slider 03-19-2008 03:47 PM

Hmm...that is VERY strange. I thought the mouse and keyboard was presented falsely to the guest OS using fake drivers (so ANY keyboard and mouse that works in Slackware should work in VirtualBox). I may be wrong though. I'll try and do some searching. Very strange problem.

The only suggestions I have off the top of my head are to play with the Host key settings (before starting the guest OS, go to File>Preferences>Input). Try changing the Host key to something else (I have mine set to the right Ctrl button -- try that and some other keys). Try setting the "Auto capture keyboard" setting on, and then try with it off. As for the mouse, when you start the guest OS, make sure you are NOT in fullscreen mode (press the host key + F to switch to and from fullscreen) and try turning on and off mouse integration. I think your problem might be that you're not pressing the Host key and just trying to type (or maybe not). Try moving the mouse into the window and pressing the Host key. That should turn on your keyboard and mouse for the session. I turned on Mouse Integration (Machine>Enable Mouse Integration or some such thing) and my mouse flows nicely between the guest OS and Linux without needing to press the host key.

I should note that I installed the Guest Additions in VirtualBox (Devices>Install Guest Additions), which may have an effect. Also, you must be using the closed-source version in order for your printer to work (it includes USB access), so if you built it from source then USB won't work (but your mouse and keyboard should).

fcaraballo 03-19-2008 06:39 PM

Remove the usbfs line in fstab and instead add the following to your /etc/rc.d/rc.local file above your other vbox entries (change devgid to a group your user belongs to):
Code:

# Remount usbfs so VBox has access to usb devices:
/sbin/mount -v usbfs /proc/bus/usb -t usbfs -o devgid=10,devmode=0664,remount

There is only one draw back to using usb devices in VirtualBox at the moment. You will be able to capture the ones that show as busy, but once you close VirtualBox you will need to reconnect the usb cable (unplug then replug) so that Slackware can gain access to them again.

MagicMan

T3slider 03-19-2008 10:20 PM

Quote:

Originally Posted by MagicMan
Remove the usbfs line in fstab

What is better about that, out of curiosity? Don't they accomplish the same thing? Are you suggesting that the fstab line screwed up the mouse/keyboard in VirtualBox? (I'm not doubting you, just curious, as I have the fstab line with no side-effects, but am not using a USB mouse or keyboard). Both solutions seem to do the exact same thing to me, so I don't understand the difference...

fcaraballo 03-20-2008 12:52 PM

Quote:

Originally Posted by T3slider (Post 3094537)
Are you suggesting that the fstab line screwed up the mouse/keyboard in VirtualBox?

It's possible. I had similar issues with some USB devices not working like they should after using the fstab entry (the biggest being a printer that wouldn't print right and failed to eject the paper, and not just in VBox). The above entry in rc.local fixed the issues I was having, except the busy capture problem.

Another possibility is that BULPulse might be trying to capture the mouse and keyboard with VBox, which would indeed cause problems. It is not necessary to capture the mouse or keyboard, they should work normally without being captured.

MagicMan

BULPulse 03-20-2008 03:32 PM

Quote:

Originally Posted by MagicMan (Post 3094343)
Remove the usbfs line in fstab and instead add the following to your /etc/rc.d/rc.local file above your other vbox entries (change devgid to a group your user belongs to):
Code:

# Remount usbfs so VBox has access to usb devices:
/sbin/mount -v usbfs /proc/bus/usb -t usbfs -o devgid=10,devmode=0664,remount

There is only one draw back to using usb devices in VirtualBox at the moment. You will be able to capture the ones that show as busy, but once you close VirtualBox you will need to reconnect the usb cable (unplug then replug) so that Slackware can gain access to them again.

MagicMan

That fixed it all :D Thanks alot

EDIT: No it hasn't sorry for the wrong post :(

T3slider 03-20-2008 03:44 PM

BULPulse, is your printer working now (in addition to your mouse and keyboard)?

BULPulse 03-20-2008 04:50 PM

Well actually no it does the same thing as when i tried your method :( when i posted my previous post I should have tested it more but when i saw that VirtualBox is running and i can move my mouse i assumed it worked later to find out that the mouse was on the black area which is why it worked. Maybe the problem comes from me :confused: I don't know. I will now try and explain as good as I can.

First when I added the line in fstab VB found all usb devices but I couldn't use the keyboard at all and i couldn't see the mouse [lets call this method 1] Then I tried the other suggestion so I removed the line from fstab and added the other line in /etc/re.d/rc.local using Text Editor and changed the devgid to the id which workes for me. Then I restarted my PC and tried it again and I thought it worked because I could've seen the mouse when VB is running so i posted but when i tried to actually use VB nothing happened so in conclusion none of the methods worked and made no difference to the outcome. BTW I have tried all the settings in VB and I have the add on for using the mouse in both Linux and VB so I have no idea what is the problem. Is there any way to find why this is not working and how to fix it ????????? PLEASE PLEASE PLEASE help

Sorry for all the troubles and confusion made by me and I apologize for my English

T3slider 03-20-2008 09:31 PM

If you remove the line from rc.local AND fstab, do your keyboard and mouse work? If not then it's a problem with your VirtualBox installation. How did you install it? Using the official binary, or some SlackBuild script, or using a third-party package (eg. from slacky.eu or linuxpackages.net or something)? What kernel are you using? Are you using a custom compiled one or one that came with Slackware 12.0? If it's one that came with Slackware 12.0 (or the newer official one patched for the local exploit), is it the generic, huge, generic-smp or huge-smp kernel? Have you done anything else unusual to your system?

I can't think of anything obvious unless there is something odd with your VirtualBox installation or your system setup. Please answer all of the above questions and I'll try to get back to you. It may be as simple as uninstalling VirtualBox and reinstalling it using the official binary (or maybe a newer version) or something like that. Good luck and sorry I couldn't be more helpful.

BULPulse 03-21-2008 05:10 AM

Quote:

Originally Posted by T3slider (Post 3095539)
If you remove the line from rc.local AND fstab, do your keyboard and mouse work? If not then it's a problem with your VirtualBox installation. How did you install it? Using the official binary, or some SlackBuild script, or using a third-party package (eg. from slacky.eu or linuxpackages.net or something)? What kernel are you using? Are you using a custom compiled one or one that came with Slackware 12.0? If it's one that came with Slackware 12.0 (or the newer official one patched for the local exploit), is it the generic, huge, generic-smp or huge-smp kernel? Have you done anything else unusual to your system?

I can't think of anything obvious unless there is something odd with your VirtualBox installation or your system setup. Please answer all of the above questions and I'll try to get back to you. It may be as simple as uninstalling VirtualBox and reinstalling it using the official binary (or maybe a newer version) or something like that. Good luck and sorry I couldn't be more helpful.

Ok, yes when I remove the lines from rc.local and fstab i can use my keyboard and mouse without any problems. I got VB from their website and installed from source. I am using the original from slackware 12 and i think it is the 2.6.21.5-smp
I haven't done anything unusual to my slackware

T3slider 03-21-2008 04:54 PM

Is it the huge or generic kernel? To find out, try the following:
Code:

$ zcat /proc/config.gz > ~/mykernel
$ diff ~/mykernel /boot/config-generic-smp-2.6.21.5-smp
$ diff ~/mykernel /boot/config-huge-smp-2.6.21.5-smp

Whichever one gives no difference is the one you're using. You said you installed from source. That means you are using the OSE (Open Source Edition), which DOES NOT support USB. You will NEVER get everything working (your USB printer included) if you are using only the OSE, according to their site here: http://www.virtualbox.org/wiki/Editions

In order to get USB (and your keyboard and mouse working at the same time) you HAVE to install the closed-source edition (an installer is provided in binary format -- to install it, you have to type `sh VirtualBox_1.5.6-1_Linux_x86.run` [replacing VirtualBox_1.5.6-1_Linux_x86.run with your version of the installer]). It sucks that this is the case (ie you can no longer install/uninstall with ease using pkgtool), but it's the only way.

As I see it, you have two options. You can forget the USB printer and continue using the open-source edition, or you can accept the fact that you have to use the closed-source version. Neither solution is ideal, but it's your decision in the end.

BULPulse 03-21-2008 08:23 PM

Quote:

Originally Posted by T3slider (Post 3096375)
Is it the huge or generic kernel? To find out, try the following:
Code:

$ zcat /proc/config.gz > ~/mykernel
$ diff ~/mykernel /boot/config-generic-smp-2.6.21.5-smp
$ diff ~/mykernel /boot/config-huge-smp-2.6.21.5-smp

Whichever one gives no difference is the one you're using. You said you installed from source. That means you are using the OSE (Open Source Edition), which DOES NOT support USB. You will NEVER get everything working (your USB printer included) if you are using only the OSE, according to their site here: http://www.virtualbox.org/wiki/Editions

In order to get USB (and your keyboard and mouse working at the same time) you HAVE to install the closed-source edition (an installer is provided in binary format -- to install it, you have to type `sh VirtualBox_1.5.6-1_Linux_x86.run` [replacing VirtualBox_1.5.6-1_Linux_x86.run with your version of the installer]). It sucks that this is the case (ie you can no longer install/uninstall with ease using pkgtool), but it's the only way.

As I see it, you have two options. You can forget the USB printer and continue using the open-source edition, or you can accept the fact that you have to use the closed-source version. Neither solution is ideal, but it's your decision in the end.

Oh well as my printer is AIO and i needed i will just have to use closed-source edition and as for my kernel it is the huge [which i think is not the one i should be using???] Which kernel are you using?? Thank you very much :D

T3slider 03-21-2008 09:40 PM

You probably should be using the generic-smp kernel, as the huge-smp kernel is really meant just for the installation. You can use the huge-smp kernel with no ill effects, but it requires a lot of blacklisting of modules to avoid errors and tricky behaviour (which may be difficult to track down). You should think about switching to the generic-smp kernel (which requires an initrd!!) at some point (soon would be better). I would definitely suggest leaving an entry in /etc/lilo.conf for the huge-smp kernel though -- because of the requirement for an initrd, if you screw anything up (or if something gets screwed up with future kernels that you may decide to compile or upgrade etc.) the huge-smp will ALWAYS boot properly (it's very handy). To switch to the generic kernel, add an entry in /etc/lilo.conf that will boot that. The lilo entries for the generic-smp and huge-smp kernels can be done as follows:
Code:

image = /boot/vmlinuz-generic-smp-2.6.21.5-smp
  initrd = /boot/initrd.gz
  root = /dev/sda1
  label = Generic Kernel
  read-only

image = /boot/vmlinuz-huge-smp-2.6.21.5-smp
  root = /dev/sda1
  label = Huge Kernel
  read-only

NOTE: change /dev/sda1 in each of the above entries to wherever your hard drive is (use the existing huge-smp entry as an example). Note that in a default setup, /boot/vmlinuz is a symbolic link to /boot/vmlinuz-huge-smp-2.6.21.5-smp, so the lilo entry points to that instead of what I wrote above. You could always just symlink /boot/vmlinuz to point to the generic-smp kernel instead and avoid adding an entry, but then you don't have the backup huge kernel, which is very handy in an emergency.

After you edit /etc/lilo.conf (and BEFORE you run lilo), you must create an initrd (initial ramdisk). Read '/boot/README.initrd' (which is a symlink to /usr/doc/mkinitrd-1.1.2/README.initrd) and it'll tell you how to make an initrd (since I use reiserfs, I simply typed `mkinitrd -c -k 2.6.21.5-smp -m reiserfs` as root). That should create a /boot/initrd-tree directory and a /boot/initrd.gz file. You should also symlink System.map to point to System.map-generic-smp-2.6.21.5-smp instead of System.map-huge-smp-2.6.21.5-smp, but it's not essential (I've had mismatched System.map symlinks before because I forgot to change the symlink and had no problems whatsoever -- however, for correctness, it should be done).

After all that's done, run `/sbin/lilo` as root to update your MBR. Then you can happily reboot into the generic kernel. If anything goes wrong, you can simply boot using the huge kernel (that you hopefully created a lilo entry for) and your system will be back up and running with no ill effects, allowing you to remedy the error you may have made using the generic kernel.

Good luck.


All times are GMT -5. The time now is 02:27 AM.