Simple print server - How to

Status
Not open for further replies.

maxbet

Dabbler
Joined
Oct 4, 2014
Messages
12
Long time lurker (FreeNAS 8.01 ....) but first time poster.
I needed to add print server function to my FreeNAS and share my HP Deskjet 2020HC on the home network.
After a 2 days struggle with CUPS, jails and the related permission issues, I finally gave up. The reason being (correct me if I am wrong) these issues could be overcome only by altering the basic setup of FreeNAS and I did not want to do that.
I found a solution in using a small print server software designed for diskless applications and recently ported to FreeBSD : p910nd.
Installation was painless, the printer started working immediately and there were no permission issues whatsoever. Now all my workstations (Linux Mint and Win7) are printing on the Deskjet.

Here is a brief guide on how I did it :
  • Enable SSH access in FreeNAS
  • Create a portsjail on FreeNAS
  • Give the portsjail a static IP address, disable VIMAGE
  • Open FreeNAS shell
  • Type :
jls​
  • Note the number of the jail and then type :
jexec [number] sh​
  • Install nano editor (or others, as you prefer) :
pkg install nano​
  • Install p910nd :
pkg install p910nd​
  • Plug the printer in the USB port and check dmesg :
dmesg
note the USB device number associated to the printer (eg. /dev/ulpt0)​

  • Edit the file /etc/rc.conf adding the following lines :
p910nd_enable="YES"
p910nd_flags="-i 192.168.3.13 -f /dev/ulpt0 -b 0"
where the flags have the following meaning :​

-i <listening address> (eg. Jail IPv4 address)
-f <device name> (eg. /dev/ulpt0)
-b <0/1> (Bidirectional printing on 1 / off 0)​
  • Restart the jail using the web interface
  • Configure clients (please refer to this link )
Few comments :
  • Raw printing : that means all clients should have printer drivers installed.
  • Bidirectional printing has to be investigated.
  • Installation completely contained within jail.
  • Mac OsX need further investigation.
I hope this may help.....

Max
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
As an anecdote, I set up CUPS and CUPSPDF in a jail without any issue (that I can remember).

I guess I'll add the caveat that I haven't actually printed anything to the connected printer in a long time as it was out of ink and I rarely actually need to print anything. I should verify that it does actually still work. PDF printing, including AirPrint, works well.
 

maxbet

Dabbler
Joined
Oct 4, 2014
Messages
12
@fracai,
for the sake of learning, it would be helpful to know how you did it.
I followed the instructions in FreeBSD but they did not cover the Jail permission issue; I found the following document https://sites.google.com/site/tux821/myfreebsdnotes and this is where I decided to stop as I did not want to alter my FreeNAS setup (Host system in the linked document).

Cheers
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Well, I did note that those instructions for FreeBSD 6.2, while FreeNAS is currently based on 9.2.

I'll see if I can find the instructions that I used, but I'm pretty sure it was just to install the cups packages and then configure cups and AirPrint using the output from some shell script. I'll see if I can find my notes.
 

maxbet

Dabbler
Joined
Oct 4, 2014
Messages
12
Just did a fresh install of 9.3 so I took the occasion to update the above information/guide (one item missing and some changed).

Here we go :
  • Create a jail on FreeNAS (jail type STANDARD)
  • Configure the jail as follows :
    disable VIMAGE
    disable NAT
    Add the following sysctl : allow.raw_sockets=true
    enable autostart​
  • assign a static IP address
  • Access the jail shell using FreeNAS interface (select the jail and use the button at the bottom of the screen)
  • Once in the jail shell install p910nd :
pkg install p910nd​
  • Plug the printer in the USB port and check dmesg :
dmesg
note the USb device number associated to the printer (eg. /dev/ulpt0)​
  • Edit the file /etc/rc.conf adding the following lines (I used ee already included in FreeNAS) :
p910nd_enable="YES"
p910nd_flags="-i 192.168.3.13 -f /dev/ulpt0 -b 0"​

where the flags have the following meaning :

-i <listening address> (eg. Jail IPv4 address)
-f <device name> (eg. /dev/ulpt0)
-b <0/1> (Bidirectional printing : on 1 / off 0)​
  • Exit the jail shell
  • Restart the jail using web interface
Max
 

kristen

Dabbler
Joined
May 23, 2016
Messages
36
Hello,

I have problem in 9.10
May 31 14:00:25 vorguprinter p9100d[61471]: accept: Software caused connection abort

How i fix it.
If i restart jail it printing once and if i want print again i must restart plugin or coming same error.
 

maxbet

Dabbler
Joined
Oct 4, 2014
Messages
12
I upgraded to 9.10 10 days ago and I am experiencing no problem with p910nd.
I decided to go for a clean install, so to get rid completely of the old jails and took the occasion to replace some HDs and redo the pool.
What i did was to create the jail and make sure that all packages were updated before installing p910nd.
Make sure that you have bidirectional printing disabled, it seems it does not work at all.

Max
 

Thousandbuckle

Contributor
Joined
Jul 9, 2014
Messages
136
Hi maxbet, great instructions and trying to setup a printer server following your advice. I have one question, when I do the dmesg command I get this output:

ugen0.5: <Hewlett-Packard> at usbus0
ulpt0: <HP Print> on usbus0
ulpt0: using bi-directional mode

What would I put in the example code you posted "p910nd_flags="-i 192.168.3.13 -f /dev/ulpt0 -b 0"? Would mine be /dev/usbus0 or would it just be /usbus0?
 

Thousandbuckle

Contributor
Joined
Jul 9, 2014
Messages
136
This is what my dmesg and current rc.conf file looks like. Can anyone tell me if my rc.conf is correct based on my dmesg output?

ugen0.5: <Hewlett-Packard> at usbus0
ulpt0: <HP Print> on usbus0
ulpt0: using bi-directional mode


p910nd_enable="YES"
p910nd_flags="-i 192.168.1.19 -f dev/usbus0 -b 0
portmap_enable="NO"
sshd_enable="NO"
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
hostname="print_server"
devfs_enable="YES"
devfs_system_ruleset="devfsrules_common"
 

maxbet

Dabbler
Joined
Oct 4, 2014
Messages
12
Thousandbuckle,
the name of your device is ulpt0, therefore your rc.conf file should be :

p910nd_flags="-i 192.168.1.19 -f /dev/uslpt0 -b 0


please notice the trailing forward slash before dev.

Max
 

Robert Smith

Patron
Joined
May 4, 2014
Messages
270
If I remember right, HP printers have a nasty habit of presenting themselves as a CD-ROM drive. They call this feature "HP Smart Install," and it needs to be disabled, as it confuses the heck out of CUPS.

Must be confusing to p910 as well.
 
Last edited:

Thousandbuckle

Contributor
Joined
Jul 9, 2014
Messages
136
Hi maxbet, I updated my settings based on your feedback but is still not working for me so I am not sure what to do now.

I wanted to ask what the difference in the device name of ulpt0 which is what the dmesg shows vs uslpt0 which you put in the reply for my config. You seemed to add the letter "s" to the device name. I tried both in the config file but neither one seemed to make a difference.

Does anyone have any other suggestions or even a different approach to make this work?
 

maxbet

Dabbler
Joined
Oct 4, 2014
Messages
12
Hi maxbet, I updated my settings based on your feedback but is still not working for me so I am not sure what to do now.

I wanted to ask what the difference in the device name of ulpt0 which is what the dmesg shows vs uslpt0 which you put in the reply for my config. You seemed to add the letter "s" to the device name. I tried both in the config file but neither one seemed to make a difference.

Does anyone have any other suggestions or even a different approach to make this work?

I should not reply at 5AM ......
Thousandbucle, it is a mistake. The correct device name is the one from dmesg : ulpt0

The correct line for rc.conf is :
p910nd_flags="-i 192.168.1.19 -f /dev/ulpt0 -b 0

I use this setup with a simple USB printer (HP Deskjet 2020hc) and I do not have any problem of sort. I would not rule out what suggested by Robert Smith if your printer is more "complex" than mine.

Max
 

AfroUSA

Dabbler
Joined
Mar 27, 2017
Messages
28
Thanks for guidance. All working fine on FreeNAS 11, MacOX Mojave and Brother HL-1110.
 
Status
Not open for further replies.
Top