Simple printing service for unRAID/BubbaRAID


Recommended Posts

Fellow RAIDers,

 

One thing that was important for me when starting this unRAID project was to have print server (of some sort) support. My Buffalo Terastation actually did a nice job of this, making it a SMB shared printer, etc.

 

I started playing with unRAID, then BubbaRAID, and realized that I needed some special things. I wanted the H/W sensors on my mobo (Asus A7N8E - Deluxe) to work so that I could monitor temps and get fancontrol working. I built a full Slackware distro in VMWare and proceeded to start constructing my own environment. There are many links and many great posts, this one was quite helpful:

 

http://lime-technology.com/wiki/index.php?title=Building_a_custom_kernel

 

Once I got that working, I built a custom kernel with the modules required for my mobo. The modules are loading and fancontrol is configured and starts automatically on boot.

 

Well, back to the printing story. I have a Samsung ML-1610 laser printer with only USB ports. I searched high and low for various methods of printing. I was avoiding CUPS and SMB printing for a variety of reasons. It is big, hard to configure and probably would have required all sorts of other packages not native to unRAID. I kept figuring, there has to be a fairly low-overhead way of getting info from a host (i.e. some Windows machine) to a USB port on the server.

 

So, eventually I stumbled upon http://p910nd.sourceforge.net/

 

The default kernel we are using does not have usb-printer driver support built in, so I turned that on, loaded my new kernel and it recognized a printer hanging off of the USB port. I brought in the p910nd code, compiled and ran it with no problems. I went to the printer config on my windows machine and setup the printer to talk to <my_server_ip> port 9100 as RAW. Printing works fine! My host will spool the files just fine. Meanwhile this will also work with CUPS and LPRng, so my Linux hosts, Mac OSX machine and Windows computers will all work just dandy!

 

Hopefully someone else will find this useful.

 

Cheers,

Paul

Link to comment
  • 2 weeks later...
  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 months later...

I set this up on my box over the weekend. Very nice, lightweight printer sharing. I also set up BubbaRAID to do my torrenting, so now I only need one box on all the time.

 

I didn't bother building a whole kernel and rootfs image. I used the BubbaRAID kernel .config, ran a menuconfig to enable usblp.ko, did a 'make modules', then manually copied usblp.ko over to the flash. Built p910nd from source and also copied it over. Then I added lines near the end of rc.bubba:

insmod /boot/eeking/usblp.ko

/boot/eeking/p910nd -f /dev/usblp0 -b

 

Have you had any trouble with multiple computers trying to print simultaneously? I don't expect it to ever happen in our household, it's not as though we print that often. But since p910nd is only forwarding data to the printer and not managing a queue or spool, it seems that if multiple machines send data at the same time you could have a collision.

Link to comment
  • 1 year later...
  • 1 month later...

Nice, I got this working too. Thanks for letting us in on the p910nd software! I'll attach my compiled copy. You don't have to recompile the kernel any more to enable USB printer support,  since newer unRAID versions seem to already have this enabled.

 

-----

 

Edit added 9/4/2015--Support for unRAID 6.x

 

I've recompiled and attached a p910nd version that works for unRAID 6.x. unzip the file and chmod +x p910nd. The commandline stays the same, p910nd -f /dev/usb/lp0 -b.

 

-----

 

 

To get it working, do the following.

 

1. Put the attached p910nd file somewhere in your flash drive's /boot folder.

2. Add two lines to /boot/config/go so it runs automatically when you boot: 1: mkdir /var/lock/subsys 2: /boot/</yourpath>/p910nd -f /dev/usblp0 -b

3. Attach your printer and reboot or manually run p910nd. Check /var/log/syslog and make sure the kernel saw your printer and that p910nd isn't showing any errors. I had to manually create the /var/lock/subsys/ folder before it would load error-free.

4. Go to www.samsung.com and download the driver for the printer. If you're using Windows, you must download the actual GDI driver, not the universal driver.

5. Install the printer driver. In Windows you'll end up with an ML-1710 printer in your Printers folder that's connected to LPT1, which won't work.

6. Click Properties on the ML-1710 printer and go to the Ports tab. Click the Add Port button.

7. Select Standard TCP/IP port and click the New Port button.

8. In the Add Port wizard, put in your unraid name or IP address. Give the port a name. Click next. The wizard will freeze for a bit.

9. On the Additional Port Information Required page, click Custom and then the Settings button. Make sure the info is correct. The port should be 9100 and the protocol should be raw. Click OK.

10. Click Next and Finish to finish the wizard. Close the Printer Ports dialog.

11. Your new port should be selected in the Printer's port list. Click the Apply button, go to the General tab and print a test page!

 

I imagine this process would work for any printer that has a driver with raw printing and custom port support. Good luck.

p910nd.zip

p910nd-unRAID61.zip

Link to comment

Will it work with multiple printers at the same time?

 

It should. You can run an instance for each printer and each instance has its own port. The first is port 9100, the second port 9101, etc. Since the print drivers will be pointing to different ports there shouldn't be any conflicts.

Link to comment

And how to determine witch usb post is used by each printer? Isn't usblp0 assigned to the first powered printer, the usblp1 to the second, etc ?

 

That's a good question. I hope the kernel would consistently assign USB posts based on the motherboard's USB port order rather than power-on order, but I don't know for sure. Messages appear in the syslog as devices connect so you could see how that's being handled. From what I can tell, p910nd doesn't have any clue what it's connected to, other than the USB post.

Link to comment
  • 1 month later...
  • 4 weeks later...
  • 1 month later...

I'm on Unraid 4.5.6 I intstalled this via Unmenu and set usblp0 as the Printer Port in Unmenu.  I did not need to create any symlinks.  Then I plugged in my circa 2004 HP Deskjet 5150.  Then I created the directory that Dase had mentioned.  It would not work until I did.

mkdir /var/lock/subsys

 

To setup the printer in on my Mac running 10.6 I did the following:

Opened System Preferences, clicked Print and Fax, and then the + button at the bottom of the printer list.  I then selected the IP tab, chose "HP Jetdirect - Socket" for protocol (I think you would do this regardless of the brand of your printer).  Then for address I put the IP of my Unraid box followed by the port like so: 192.168.1.101:9001.  Then I chose "Select Printer Software" from the Print Using: dropdown.  I left the other fields blank.  A boxed up, and I chose a driver closest to my printer, HP Deskjet 5400.  Lo and behold, now I am printing wirelessly to Unraid.

 

Also set this up on my wife's Windows 7 laptop following Dase's instructions.  Worked without a hitch.

 

If you are having trouble then check the syslog.  If you see this:

Oct 13 11:17:13 Tower p9100d[8361]: /var/lock/subsys/p9100d: No such file or directory 

Then you need to create the /var/lock/subsys directory.

 

If you see anything that looks like the lines below then your client computer is sending the print job to Unraid.

Oct 13 11:20:59 Tower p9100d[8675]: Connection from 192.168.1.139 port 50736 accepted 
Oct 13 11:21:06 Tower p9100d[8675]: Finished job: 0 bytes received, 0 bytes sent 
Oct 13 11:21:06 Tower p9100d[8675]: Connection from 192.168.1.139 port 50749 accepted 
Oct 13 11:22:05 Tower p9100d[8675]: Finished job: 10708 bytes received, 0 bytes sent 

Link to comment
  • 1 month later...

OK, this looked good so I thought I would setup a print server. Only I am having trouble with it. I think I am following the instructions properly.

I added

 

mkdir /var/lock/subsys

/boot/packages/p910nd-0.93/p910nd -f /dev/usblp0 -b

 

to my /boot/config/go file but in my syslog I am getting this error line

 

Dec 13 13:42:14 Tower p9100d[1468]: /var/lock/subsys/p9100d: No such file or directory

 

even though I have also added the directory manually and when I check there actually is a /var/lock/subsys/p9100d file on the boot flash.

 

Where do I go from here? The printer is a Canon Lasershot LBP-1120. I have attached a syslog but for some reason the formatting is all messed up. The first time I got the syslog through unmenu it was all good and each datestamp started on a new line. Since then it just puts a period at the end of each line instead of a carriage return. Any advice on this would also be greatley appreciated.

Also, how can I check that the printer is recognised and is in fact attached at usblp0?

Thanks in advance for any help.

syslog-2010-12-131.txt

Link to comment

OK, this looked good so I thought I would setup a print server. Only I am having trouble with it. I think I am following the instructions properly.

I added

 

mkdir /var/lock/subsys

/boot/packages/p910nd-0.93/p910nd -f /dev/usblp0 -b

 

to my /boot/config/go file but in my syslog I am getting this error line

 

Dec 13 13:42:14 Tower p9100d[1468]: /var/lock/subsys/p9100d: No such file or directory

 

even though I have also added the directory manually and when I check there actually is a /var/lock/subsys/p9100d file on the boot flash.

 

Where do I go from here? The printer is a Canon Lasershot LBP-1120. I have attached a syslog but for some reason the formatting is all messed up. The first time I got the syslog through unmenu it was all good and each datestamp started on a new line. Since then it just puts a period at the end of each line instead of a carriage return. Any advice on this would also be greatley appreciated.

Also, how can I check that the printer is recognised and is in fact attached at usblp0?

Thanks in advance for any help.

 

The formatting of the syslog is just fine.

 

Did you use the package-manager to install the printer driver? or  did you download and install it yourself?

 

Please post the output of these commands:

strings /boot/packages/p910nd-0.93/p910nd | grep subsys

ls -ld /var/log/subsys

ls -ld /var/lock/subsys

ls -l /var/lock/subsys

ls -l /dev/usblp*

 

Joe L.

Link to comment

OK, firstly I think I need to do a tutorial in forum posting so I can insert replies inside a relevant quote. But I digress.

Yeh, the formatting was OK when I downloaded the syslog I had uploaded but when I downloaded it from unmenu it was all messed up. No worries, that's only a minor issue.

I used unmenu to install it but it didn't add anything to the /boot/config/go file so I added them manually, following Dase's instructions.

 

strings /boot/packages/p910nd-0.93/p910nd |grep subsys

/var/lock/subsys/p910%cd

 

ls -ld /var/log/subsys

drwxr-xr-x 2 root root 0 Dec 13 21:38 /var/log/subsys/

 

ls -ld /var/lock/subsys

drwxr-xr-x 2 root root 0 dec 13 21:38 /var/lock/subsys/

 

ls -l /var/lock/subsys

total 0

-rw-r--r-- 1 root root 0 Dec 13 21:38 p9100d

 

ls -l /dev/usblp*

lrwxrwxrwx 1 root root 7 Dec 13 21:57 /dev/usblp0 -> usb/lp0

 

Don't mind the time difference, I forgot to turn the printer on :P

 

Ps. is there any way to copy/paste from a telnet session?

Pps. In case you haven't worked it out, I'm fairly new to all this stuff. lmao.

Link to comment

OK, firstly I think I need to do a tutorial in forum posting so I can insert replies inside a relevant quote.

Cool, got that bit sorted.

 

Ps. is there any way to copy/paste from a telnet session?

Worked this out too. I'll get there eventually. ;)

OK...

 

Last few questions... 

What version of unMENU are you running? 

Does the package manager have input fields for your printer device and mode?

 

Based on the "ls" it appears as if you will need to use

usblp0

as your print device.

 

I see I made an error in the unMENU package in that I was creating /var/log/subsys instead of /var/lock/subsys.  (In my defense, the compile time directive in the package makefile shows /var/log/subsys but it is commented out)  I'll have a new version in place fixing that shortly.

 

What do you see when you type:

ps -ef | grep p910

 

Joe L.

Link to comment

Last few questions... 

What version of unMENU are you running? 

unmenu.awk: Version 1.3 Revision: 171  Joe L.... with modifications as suggested by bjp999 and many others

 

Does the package manager have input fields for your printer device and mode?

Yes.

Printer Port: usblp0

Bi-Directional Mode: Yes

Install optional "rc" script: No

 

I left out the "rc" script because I wanted to keep it simple. Once everything is working I might change this if I see a need to.

 

Based on the "ls" it appears as if you will need to use

usblp0

as your print device.

Yep, I thought that's what that was showing. At least I got one thing right.

 

I see I made an error in the unMENU package in that I was creating /var/log/subsys instead of /var/lock/subsys.  (In my defense, the compile time directive in the package makefile shows /var/log/subsys but it is commented out)  I'll have a new version in place fixing that shortly.

 

What do you see when you type:

ps -ef | grep p910

 

root      2019    1  0 Dec13 ?        00:00:00 /boot/packages/p910nd-0.93/p9100

d -f /dev/usblp0 -b

root      2735  2723  0 10:34 pts/1    00:00:00 grep p910

 

I managed to get it to print a test page but then it froze up. Maybe it is a windows issue I am having. I'll try it from another PC as well.

 

OK, tried it on another computer. Notepad and word documents seem to print OK, even though I get an error message saying "The document failed to print" then the page prints.......Weird......

The printer still seems to lockup every now and then though, usually seems to be when trying to print web pages. Either turning the printer off then on again or rebooting unraid seems to free it up again, but isn't really a solution I'm happy with. I think I'll have to look more into the port 9100 network protocol (JetDirect) as I think that may be where the fault lies.

 

Ps. I only just put 2 and 2 together and realised you are the man to thank for unmenu. Well done, very nice piece of work. Makes things much easier for noobs.

Link to comment

When I was initially creating the p910nd package I had it fail to print.

 

Check your settings in Windows and try using a "dumber" print driver.  I am on a Mac and have the printer set up through CUPS.  I am not sure if there is a CUPS for windows, but it might be something to check out.  I have the connection to the printer specified as: "socket://192.168.2.104:9100" (without quotes).

Link to comment
  • 3 months later...

Hi all,

 

I am trying to get this to work but when I try to print something I get the following error.

 

Apr 5 07:54:46 Tower p9100d[1789]: /dev/usb0: No such file or directory

Apr 5 07:54:46 Tower p9100d[1789]: /dev/usb0: No such file or directory, will try opening later

Apr 5 07:54:56 Tower p9100d[1789]: /dev/usb0: No such file or directory

Apr 5 07:54:56 Tower p9100d[1789]: /dev/usb0: No such file or directory, will try opening later

Apr 5 07:55:06 Tower p9100d[1789]: /dev/usb0: No such file or directory

Apr 5 07:55:06 Tower p9100d[1789]: /dev/usb0: No such file or directory, will try opening later

 

This error just keeps repeating and I need to reboot the server to get it to stop.

 

Here is the output from the commands posted earlier.

 

root@Tower:~# strings /boot/packages/p910nd-0.93/p910nd | grep subsys

/var/lock/subsys/p910%cd

 

root@Tower:~# ls -ld /var/log/subsys

drwxr-xr-x 2 root root 0 Apr  5 07:33 /var/log/subsys/

 

root@Tower:~# ls -ld /var/lock/subsys

drwxr-xr-x 2 root root 0 Apr  5 07:33 /var/lock/subsys/

 

root@Tower:~# ls -l /var/lock/subsys

total 0

-rw-r--r-- 1 root root 0 Apr  5 07:33 p9100d

 

root@Tower:~# ls -l /dev/usblp*

lrwxrwxrwx 1 root root 7 Apr  5 07:32 /dev/usblp0 -> usb/lp0

 

root@Tower:~# ps -ef | grep p910

root      1789    1  0 07:33 ?        00:00:00 /usr/sbin/p9100d -f /dev/usb0 -b

root      1806 16042  0 08:10 pts/0    00:00:00 grep p910

 

It was installed using the latest version of Unmenu.  Trying to print from a windows machine.

 

Thank you for any help.

Cliff

Link to comment
  • 4 weeks later...

root@Tower:/var/lock/subsys# strings /boot/packages/p910nd-0.93/p910nd | grep subsys

/var/lock/subsys/p910%cd

root@Tower:/var/lock/subsys# ls -ld /var/log/subsys

drwxr-xr-x 2 root root 0 Apr 24 21:20 /var/log/subsys/

root@Tower:/var/lock/subsys# ls -ld /var/lock/subsys

drwxr-xr-x 2 root root 0 Apr 22 22:59 /var/lock/subsys/

root@Tower:/var/lock/subsys# ls -l /var/lock/subsys

total 0

-rw-r--r-- 1 root root 0 Apr 22 22:59 p9100d

root@Tower:/var/lock/subsys# ls -l /dev/usblp*

lrwxrwxrwx 1 root root 7 May  2 17:02 /dev/usblp0 -> usb/lp0

 

root@Tower:/var/lock/subsys# ps -ef | grep p910

root      8272    1  0 17:10 ?        00:00:00 /boot/printer/p9100d -f /dev/usblp0 -b

root      8846    1  0 Apr24 ?        00:00:00 /usr/sbin/p9100d -f /dev/usblp0 -b

root    13426  2591  0 17:24 pts/0    00:00:00 grep p910

root    32089    1  0 Apr25 ?        00:00:00 /usr/sbin/p9100d -f /dev/usblp0 -b

root    32192    1  0 Apr25 ?        00:00:00 /usr/sbin/p9100d -f /dev/usblp0 -b

root@Tower:/var/lock/subsys#

 

 

Syslog:

 

May  2 17:02:39 Tower kernel: usb 1-9: new high speed USB device using ehci_hcd and address 4 (Drive related)

May  2 17:02:39 Tower kernel: usb 1-9: configuration #1 chosen from 1 choice (Drive related)

May  2 17:02:39 Tower kernel: usblp0: USB Bidirectional printer dev 4 if 1 alt 0 proto 2 vid 0x043D pid 0x010D (Drive related)

May  2 17:02:39 Tower kernel: scsi8 : SCSI emulation for USB Mass Storage devices (Drive related)

May  2 17:02:39 Tower kernel: usb-storage: device found at 4 (Drive related)

May  2 17:02:39 Tower kernel: usb-storage: waiting for device to settle before scanning (Drive related)

May  2 17:02:39 Tower kernel: generic-usb 0003:043D:010D.0002: hiddev96,hidraw0: USB HID v1.00 Device [Lexmark  3500-4500 Series] on usb-0000:00:02.1-9/input3 (Drive related)

May  2 17:02:44 Tower kernel: scsi 8:0:0:0: Direct-Access     Lexmark  USB Mass Storage  200 PQ: 0 ANSI: 0 (Drive related)

May  2 17:02:44 Tower kernel: usb-storage: device scan complete (Drive related)

May  2 17:02:44 Tower kernel: sd 8:0:0:0: [sde] Attached SCSI removable disk (Drive related)

 

I first installed this by manually downloading the file and adding the lines to the go script. It worked perfect the first night. I tried to print something a week later and now its not working. I then tried to reinstall using unmenu  Version 1.4 Revision: 220. I have the printer installed on the computer with RAW port 9100. From the information I posted can anyone see why this is not working anymore?

 

Thanks

 

Link to comment

root@Tower:/var/lock/subsys# strings /boot/packages/p910nd-0.93/p910nd | grep subsys

/var/lock/subsys/p910%cd

root@Tower:/var/lock/subsys# ls -ld /var/log/subsys

drwxr-xr-x 2 root root 0 Apr 24 21:20 /var/log/subsys/

root@Tower:/var/lock/subsys# ls -ld /var/lock/subsys

drwxr-xr-x 2 root root 0 Apr 22 22:59 /var/lock/subsys/

root@Tower:/var/lock/subsys# ls -l /var/lock/subsys

total 0

-rw-r--r-- 1 root root 0 Apr 22 22:59 p9100d

root@Tower:/var/lock/subsys# ls -l /dev/usblp*

lrwxrwxrwx 1 root root 7 May  2 17:02 /dev/usblp0 -> usb/lp0

 

root@Tower:/var/lock/subsys# ps -ef | grep p910

root      8272     1  0 17:10 ?        00:00:00 /boot/printer/p9100d -f /dev/usblp0 -b

root      8846     1  0 Apr24 ?        00:00:00 /usr/sbin/p9100d -f /dev/usblp0 -b

root     13426  2591  0 17:24 pts/0    00:00:00 grep p910

root     32089     1  0 Apr25 ?        00:00:00 /usr/sbin/p9100d -f /dev/usblp0 -b

root     32192     1  0 Apr25 ?        00:00:00 /usr/sbin/p9100d -f /dev/usblp0 -b

root@Tower:/var/lock/subsys#

 

 

Syslog:

 

May  2 17:02:39 Tower kernel: usb 1-9: new high speed USB device using ehci_hcd and address 4 (Drive related)

May  2 17:02:39 Tower kernel: usb 1-9: configuration #1 chosen from 1 choice (Drive related)

May  2 17:02:39 Tower kernel: usblp0: USB Bidirectional printer dev 4 if 1 alt 0 proto 2 vid 0x043D pid 0x010D (Drive related)

May  2 17:02:39 Tower kernel: scsi8 : SCSI emulation for USB Mass Storage devices (Drive related)

May  2 17:02:39 Tower kernel: usb-storage: device found at 4 (Drive related)

May  2 17:02:39 Tower kernel: usb-storage: waiting for device to settle before scanning (Drive related)

May  2 17:02:39 Tower kernel: generic-usb 0003:043D:010D.0002: hiddev96,hidraw0: USB HID v1.00 Device [Lexmark  3500-4500 Series] on usb-0000:00:02.1-9/input3 (Drive related)

May  2 17:02:44 Tower kernel: scsi 8:0:0:0: Direct-Access     Lexmark  USB Mass Storage  200 PQ: 0 ANSI: 0 (Drive related)

May  2 17:02:44 Tower kernel: usb-storage: device scan complete (Drive related)

May  2 17:02:44 Tower kernel: sd 8:0:0:0: [sde] Attached SCSI removable disk (Drive related)

 

I first installed this by manually downloading the file and adding the lines to the go script. It worked perfect the first night. I tried to print something a week later and now its not working. I then tried to reinstall using unmenu  Version 1.4 Revision: 220. I have the printer installed on the computer with RAW port 9100. From the information I posted can anyone see why this is not working anymore?

 

Thanks

 

It appears you have two processes listening to the same port.  That might be the issue.

 

Joe L.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.