Introduction: FreeNAS As a Print Server

Picture of FreeNAS As a Print Server

FreeNAS is an excellent network storage solution simple enough for anyone to install. The system and space requirements are ridiculously small for this stripped-down version of FreeBSD. It's got all manner of features accessible through it's clean web GUI, more than most will ever need. It even lets you stream media to game consoles!

Despite it's impressive built in abilities, there was one thing that I wanted it to do besides act as a great NAS, and that was to be a print server so I could share my HP Deskjet 6540 USB printer among my Windows and Mac OSX boxes. Easier said than done. After hours of playing around with CUPS and a few broken installs later, I saw the light.

On the FreeNAS forums, user sgrizzi created a thread on how to make it work with LPR, using the LPRng package, for a LiveCD based setup. It was EXTREMELY helpful, and he/she should get most of the credit, but the thread really needs to be condensed and clarified to be a useful guide. That is exactly what this Instructable is for, as well as modifying it for a standard full install of FreeNAS.

This guide assumes you already have a current standard install of FreeNAS set up and working.

Step 1: Preparation

Picture of Preparation

First, let's get together a few things and take a look at the setup.

The Network
Your setup may be different, but mine is as follows.
- Linksys WRT54GL router running Tomato firmware v1.23
- FreeNAS box - v0.69, old Sony Vaio, 2 hard drives, static IP:
- PC - Windows XP SP3
- Macbook Pro - OSX 10.5.6
- HP Deskjet 6540 - USB connected printer, attached to FreeNAS

You will need to assign your FreeNAS box a static internal IP from within your router. There's plenty of guides online for that, all straight-forward, so do a quick Googling.

Stuff You'll Need
- Windows install disk if you're using Windows (necessary files may be availible elsewhere, but this is the easiest)
- Printer Drivers for your particular make/model
- The file "ulpt.ko" taken from a full FreeBSD install. File attached to this instructable.
- SSH client - For Windows, go with PuTTy. For Linux, Unix, Mac, etc you can just use the terminal/command line

Step 2: Connect Via SSH

Picture of Connect Via SSH

Connect to your FreeNAS box via SSH. Normally it's bad practice to log in as root, but if you're really careful, things should go smoothly.

PuTTy is pretty self explanatory here for connecting. For the command line people, type:

ssh -l username static_ip_of_freenas

The static ip will be something like
It will ask for a password, but when you type, nothing shows up. Don't worry, this is normal (hides password for security purposes); just type it and hit enter.

You should now have yourself a little greeting and a new command prompt (loggin in as root is freenas:~# and as a user is >)

Step 3: Put Ulpt.ko in the Right Spot

Use your preferred method (ftp, smb, etc.) to put the ulpt.ko file somewhere onto the FreeNAS box, and remember the full path (I'll call it UPath), which will probably be something like /mnt/drivename/ulpt.ko

Go back to the terminal with the SSH connection and command prompt, we're going to move the file to the proper place. Type:

mv Upath /boot/kernel/ulpt.ko

That ought to do it.

Step 4: Install LPRng

We will be using a package called LPRng. To install it, type:

pkg_add -r LPRng

Let that chug away for a bit while it downloads and installs the necessary bits.

Step 5: Configure Things to Load on Boot

Picture of Configure Things to Load on Boot

Load ulpt.ko Module
First we want to make sure that ulpt.ko loads on boot so as soon as we connect a printer it'll recognize it properly. Type:

nano /boot/defaults/loader.conf

Scroll down with either the arrow keys or ctrl+V until you reach a section titled "USB Modules"
Change the line
"ulpt_load="NO" # Printer"
"ulpt_load="YES" # Printer"

Hit ctrl+X. Then type "y", and hit enter when it asks you to save.

Start LPRng

Navigate to the FreeNAS web interface in a browser. Then go to System-->Advanced-->rc.conf
Use the "+" button to add two new entries:

Name: lpd_enable
Value: NO

Name: lprng_enable
Value: YES

Step 6: LPRng Configuration: 1 of 3 - Printcap

There are three main files that contribute to LPRng working properly.
- /etc/printcap
- /usr/local/etc/lpd.perms
- /usr/local/etc/lpd.conf

Printcap (location: /etc/printcap) can be very complex or very simple. We'll go with very simple, but you can refer to the LPRng site and google for some different setups depending on your needs.

It'll be much easier to illustrate this by example:

# @(#)printcap HP Deskjet 6540

First line doesn't matter much. Just put your printer make/model in there for reference
- "lp|deskjet" - this is what you're printer will be known as. "lp" is the primary name, "deskjet" is an alias.
- "sd=" This is the path to the print spooler. We're going to make this directory in a second.
- "sh" This stands for "supress header". If you've ever printed in a computer lab, you'll have seen these. It's a page that prints before a job that identifies who the job is for. For most people at home, it's unnecessary. In a work environment with lots of people and printing, it's something you should look into.
- "lp=" this is the location of the printer. If ulpt.ko loads properly, then when you connect a printer, it should register as /dev/ulpt0.

Remember the spooler path from sd? Let's make it. Type:

"mkdir -p -m 700 /var/spool/lpd/bare"
"chown 1:1 /var/spool/lpd/bare"

This creates the proper directory with the necessary ownership and permissions.

Step 7: LPRng Configuration: 2 of 3 - Lpd.perms

lpd.perms (location: /usr/local/etc/lpd.perms) is a bit long. The default configuration should be fine. Scroll through and double check that these lines are uncommented (don't begin with a "#") by typing:

nano /usr/local/etc/lpd.perms

The lines that we want uncommented are:

ACCEPT SERVICE=C LPC=lpd,status,printcap

Make any changes and then hit ctrl+X

Step 8: LPRng Configuration: 3 of 3 - Lpd.conf

lpd.conf (location: /usr/local/etc/lpd.perms) should also be fine as the default. Things to double check for:

# Purpose: always print banner, ignore lpr -h option
# default ab@ (FLAG off)
# Purpose: query accounting server when connected
# default achk@ (FLAG off)
# Purpose: accounting at end (see also af, la, ar, as)
# default ae=jobend $H $n $P $k $b $t (STRING)
# Purpose: name of accounting file (see also la, ar)
# default af=acct (STRING)
# Purpose: use long job number (0 - 999999) when a job is submitted
# default longnumber@ (FLAG off)

Step 9: Start Things and Set Permissions When Printer Connects

We're going to want to start up the proper LPRng processes when a printer is connected. Type:

"nano /usr/local/etc/devd/devd.conf"

Add to the file:

# start action when USB printer ulpt0 is plugged in
# wait 3 second and then start the spooler daemon
attach 100 {
device-name "ulpt0";
action "sleep 3; lpd;
checkpc -f;
chown 0:0 /dev/ulpt0;
chmod 666 /dev/ulpt0;
echo 'o5L25fgfab' > /dev/speaker;";

This watches for the printer to be plugged in, waits a few seconds, and starts the LPD process. Once that's going it fixes any missing files or permissions with checkpc -f. It then sets proper ownership and permissions on the device and plays a little sound.

Step 10: Connecting a Windows PC

Picture of Connecting a Windows PC

1) Go to Network Connections. Click the Advanced tab at the top, then "Optional Networking Components".
Enable both Management and Monitoring Tools and Other Network File and Print services. It will ask you to insert the Windows cd, which you should have around. This will allow us to connect via LPR

2) Go to the Control Panel and then to Printers. Run the Add a New Printer wizard.

3) Local Printer (do not automatically detect). Next.

4) Create New Port -> LPR Port. Next

5) Enter the IP address of the FreeNAS box. This is why we want it to be static. Enter the name of the print queue (if you copied my printcap, it's "lp" without quotes)

6) Install drivers and click through the rest of the wizard. Do not print test page.

7) Right click on the printer and open up properties.

8) Port Tab. Uncheck "bidirectional support"

9) Advanced Tab.
start printing after the last page is spooled. Check
Print directly& Uncheck
Hold mismatched& Uncheck
Print spooled& Check
Enable advanced& Check

10) Now go back to the main tab and try printing a test page.

Step 11: Connecting With Mac OSX

Picture of Connecting With Mac OSX

1) Open up System Preferences -> Print and Fax

2) Click the "+" to add a printer

3) Go to the "IP" tab
Protocol: LPD
Address: The IP of FreeNAS
Queue: Name of print queue (if you copied my printcap, it's "lp" without quotes)
Name and Location are up to you
Print Using: Pick correct drivers*

*Some printers, like my HP Deskjet 6540 wouldn't let me use the usb drivers with the LPD. I had to instead pick one as close as possible (turned out to be 5550) and go with that. If the two models are similar, it should work without a problem.


noahw (author)2009-03-13

Hey, this is a great instructable and is very informative. Just one thing is missing... pictures! It really helps a lot when trying to follow directions so you should consider taking some photographs. Once you do that and leave me a message when you have so that we can publish your work. Thanks! Thanks for the cool instructable and we hope to publish this soon!

Reytera (author)2013-12-05

the way is nolonger to support freenas 8X, i have try it, root ID cannot write nano because permission denid, but it also can use in nas4free

PumaPerez (author)2013-03-30

hi. would you be so kind and make tutorial for version 8.3 please? i dont have rc.conf in interface in this version. thank you

onosendi (author)2013-03-24

You need to remount the file system as readable/writable.

# mount -uw /

When you're finished, make sure you remount it as readonly.

# mount -ur /

eckiw-1 (author)2012-01-08

I reached this point: by changing pkg_add -r LPRng to:
pkg_add -r
But at the end it says:
pkg_add: pkg_add of dependency 'gettext-' failed!
Does this mean a problem? or can I ignore it?

weecho77 (author)eckiw-12012-03-06

did you ever find out the workaround to this problem? i'm stuck at the same point, if i go ahead like it's no problem i can't do the next step... i thought maybe because i'm running an AMD Sempron i should get the amd64 port rather than i386 but it didn't make any difference.
Somebody help please!

Murphys_Lawyer (author)2011-10-05

No, he is correct. Even as root, /boot/kernel will not allow any new files to be added to it.

I should have included that I am trying this instructable on FreeNAS v.8.0.1. I have tried several ways to get the ulpt.ko file into the /boot/kernel directory, and it will NOT let me write to it or change the permissions on the directory.

ghost128k (author)2011-06-24

good morning, i´ll try to install but when done download file .tbz i can see in the screen:
Last login: Fri Jun 24 08:27:39 2011 from
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.

Welcome to FreeNAS!

freenas:~# pkg_add -r LPRng
t/LPRng.tbz... Done.

/: write failed, filesystem is full
bin/lpr: Write failed: No space left on device: No space left on device
bin/lprm: Write failed: No space left on device: No space left on device
bin/lpstat: Write failed: No space left on device: No space left on device
lib/liblpr.a: Write failed: No space left on device: No space left on device
libexec/filters/lpbanner: Write failed: No space left on device: No space left o
n device

/: write failed, filesystem is full
libexec/filters/lpf: Write failed: No space left on device: No space left on dev
libexec/filters/psbanner: Write failed: No space left on device: No space left o
n device
sbin/checkpc: Write failed: No space left on device: No space left on device
tar: Error exit delayed from previous errors.
pkg_add: leave_playpen: can't chdir back to ''

i have installed freenas in a datatravel pendrive usb with 8 gb of capacity, but when i execute df, the command shown:
freenas:~# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/md0 190190 190188 2 100% /
devfs 1 1 0 100% /dev
procfs 4 4 0 100% /proc
/dev/md1 31470 1292 27662 4% /var
/dev/ad4p1 473018108 12433064 422743596 3% /mnt/cosas
/dev/da0a 71062 66786 4276 94% /cf

What i can do for install the pakage?

jimchest (author)ghost128k2011-09-16

If it is a memstick has plenty of memory try

mount -uw /

My stick was set to read only.

alique (author)2011-06-12

Is this ok? just to clear stuff up?

freenas# mv /mnt/start/ulpt.ko /boot/kernel/ulpt.ko
mv: rename /mnt/start/ulpt.ko to /boot/kernel/ulpt.ko: Read-only file system

alique (author)2011-06-12

I'm not sure if this is an error but i'm getting this...

tar: Error exit delayed from previous errors.
pkg_add: leave_playpen: can't chdir back to ''

is it ok?

4iter (author)2011-05-03

I have the same problem. hp 1020.
When l plugged my printer, FreeNAS beeping and typing "using bi-directional mode". Is it right?

rstrawsb (author)2011-01-16

Looks like the package moved, This is how I got around the error.

pkg_add -r

henke71 (author)2010-12-30

Hi, is it possible to use this instruction for my FreeNAS 0.7.2 (FreeBSD 7.3) ?

yoseftux (author)2010-12-17

Completed after some very careful reading, and consulting the source thread.
A few helpful hints to my fellow explorers:
1) Instead of stating requires a "standard" installation, should state up front that it requires a FULL install, an embedded install will not get past 1st base.
2) devd.conf must be placed in /usr/local/etc/devd - if the directory doesnt exist, create it.
3) once all the pieces are in place, reboot to fully initialize the system.
4) helps to manually run the
echo 'o5L25fgfab' > /dev/speaker
command so you know exactly what to listen for. This is the success trumpet :)

All in all, a very good instructable. Thanks for the hard work Tau_Zero!!!

andrewgking (author)2010-10-28

Starting LPRng,

freenas:~# lpd (enter)
2010-10-29-03:29:08.044 freenas Read_file_list: cannot stat required or included file '/etc/printcap' - No such file or directory

to fix
freenas:~# mv /usr/local/etc/printcap /etc/printcap
freenas:~# lpd (no error this time)

Thommo1971 (author)2010-10-16

I can't get it to print anything. As soon as I enter the IP address and name of the print queue, it comes up with a message box telling me that "the lpd request did not respond as expected to a test command". It lets me continue the set up but I cannot print. I shows in the printer properties as a document sent for print but reports "printer busy or error"

Thommo1971 (author)2010-10-07

I followed the instructions as given but I don't seem to have the /etc/printcap directory. Help!

jccl2 (author)Thommo19712010-10-15

on freenas the file is on /usr/local/etc/printcap

Thommo1971 (author)jccl22010-10-16

Thank you! I've now found it!

kenkenlau (author)2009-06-24

Great Job. but I have a minor problem. The ulpt.ko file attached is a *.tmp file after download. Do I need to rename it or extract it? sorry that I m unix newbie. Please let me know the command line. I tried tar -xf but seems no luck. Thanks

Tau_Zero (author)kenkenlau2009-06-24
Apparently there's a bug with instructables. Someone posted a workaround, i forget where.

"I think it's an instructables bug :( The same thing happens when I try to download files from here sometimes. The fix is to save the file as

"file name.file type"

if you put quotes around the name like above it will use the file type you put in. For example:
To save '2 inch box bottom'

  • right-click the file
  • save as
  • in the name field type (including quotes) "2 inch box bottom.stl"

This method also works just renaming files. Use the quotes and the file type extention when you rename a file an it should change the file type as well as the name."
kenkenlau (author)Tau_Zero2009-06-24

Thanks. I renamed it. I managed to edit the files needed. Plug in my HP 3050 there is a beep. seems the lpd is running. But print from XP machines still have no response. I may need to google around and see what is the problem. LPRng installed successfully. printcap under /etc created. and the other 2 files is as described. devd folder created. devd.conf created. any command line can let me check the lpt0, lpd, is loaded and running properly? Thanks.

kenkenlau (author)kenkenlau2009-06-24

in the /dev directory, I can see the ulpt0 in the FreeNAS GUI -> status -> process, I can see lpd, devd. do they indicate I am going the right way? ar.....sorry for my first time to unix system....headache..... Thanks.

Tau_Zero (author)kenkenlau2009-06-28

Don't worry about being new. I'm loosely familiar with the system (I'm usually on an XP machine or my Mac, which is Unix based, but hardly the same experience). The beep and ulpt0 showing up is a good sign. It means that at the very least, your printer is being seen by the FreeNAS box. The lpd running is a good sign. Through the FreeNAS GUI -> Advanced -> command, try these commands: lpc lpd (gives you the PID of lpd or signals an error if lpd is not loaded) lpq (should return the status of the empty spool queue) lpc status (should show the queue and the spooler status) ls -l /dev/ulpt0 (should show ulpt0 setup for read-write for user, group, root) Let me know whether the first three run fine, or whether they say there's an error of some sort. Also let me know what permissions it says ulpt0 has. If everything is in order there, then we can go troubleshoot the other computer's setup for connecting.

kenkenlau (author)Tau_Zero2010-09-07

Tau, gald to see you are still helping people on the FreeNAS printer server. I have my old NAS down after 1 year of use, and try to setup a new one (0.7.1). Get back here for some information.
In my case, the ulpt0 does not work. I read many posts in the FreeNAS forum and then change to unlpt0 in printcap. also the devd.conf.

=== then everything WORKS fine === if anyone also get the "device busy" when giving the lpq command, try unlpt0 instead of ulpt0.

Thanks for the great instructables, Tau.

Tau_Zero (author)kenkenlau2010-09-07

It's been my pleasure helping folks out. Getting a printserver out of an existing FreeNAS box is a fantastic addition to any home network that it'd be a crime not to!

Thank you very much for your research. I wish I was more familiar with the system so I'd know why that change works exactly, but I'm very glad to hear you found a resolution. Did you need to do anything except change ulpt0 to unlpt0 in steps 6 and 9?

kenkenlau (author)Tau_Zero2010-09-07

ar....actually there is a typo, for the devd.conf
I deleted a ; before the "
also, I added 1 more sound when the printer is unplugged. here is the devd I used:

ar....actually there is a typo, for the devd.conf
I deleted a ; before the "

also, I added 1 more sound when the printer is unplugged. here is the devd I used:

# start action when USB printer ulpt0 is plugged in
# wait 3 second and then start the spooler daemon
attach 100 {
device-name "ulpt0";
action "sleep 3; lpd;
checkpc -f;
chown 0:0 /dev/ulpt0;
chmod 666 /dev/ulpt0;
chown 0:0 /dev/unlpt0;
chmod 666 /dev/unlpt0;
echo 'o5L25fgfab' > /dev/speaker";
# this will cause a beep when you unplug the usb printer1
detach 100 {
device-name "ulpt0";
action "sleep 1;
echo 'o5L10bafgffgfab' > /dev/speaker;
sleep 1;
echo 'o5L10fgfabbafgf' > /dev/speaker";


xantes (author)2010-08-13

I am introducing the FreeNAS static IP in Putty.exe and I got an error: "Network error: Connection refused." What am I doing wrong?!

Tau_Zero (author)xantes2010-08-13

Go into the Web GUI for FreeNAS, Services->SSH, and make sure it's enabled.

xantes (author)2010-08-12

Sorry but this is not a tutorial for anyone. It does requires more than medium knowledge about Unix, Linux and so on. Especially since is a very long tutorial not only very complex.

Tau_Zero (author)xantes2010-08-12

I'm sorry you feel that way, but 11 steps is not very long at all, and if you've got a standard full install of FreeNAS, you can do it if you know how to read and type. What part do you think requires some special knowledge of *nix systems?

ychauvel (author)2009-12-05


I'm trying to get the attached "ulpt.ko" file... I get a .tmp file!
Can anyone help?


aaam1967 (author)ychauvel2010-07-17

i have the problem when I'm trying to get the attached "ulpt.ko" file... I get a .tmp file! Can you help me? Tanks

Tau_Zero (author)ychauvel2009-12-05

 Check further down in the comments.

mebkopcznski (author)2010-06-25

Even puting the commands in this file /etc/devd.conf (because version 7.1 doesn't have the one informed in instructions), i don't get printer working after reboot. I'm looking for a place where I can put this command. Any ideia?

mic98 (author)2010-05-19

can anybody  help me to setup a 2nd printer.

I already got one printer working on a full install of freenas v7.1 but i get stuck
to do a 2nd printer. So far as i can see their is no guide for this for a full install.

I found guides for embedded or live cd's but that does'nt help me much.
So if somebody could help me out,i would appriciated.


izakw. (author)2010-05-09

to solve the problem with ftp fetch:
Error: FTP Unable to get No address record
pkg_add: unable to fetch '' by URL

i have set the domian in freenas webgui: system->general setup from "local" to "com"
and now everythings fine.

bboudewijns (author)2010-04-13


I just restarted the whole thing and i dont know why, but everything is working just fine now! Thanks again for the nice instructable, all my other comments can be deleted!


peephuhpeep (author)2010-02-22

Thanks for the nice instruction here! (and thanks to sgrizzi as well as the original author!)

I got a problem that keeps coming back: the file permissions of the /dev/ultp0 keep changing when a printer is plugged out. This we all know that happens..

But I changed the devd.conf file (resided in /etc/devd.etc and also put it in /usr/local/etc/devd/devd.conf).

This is how it looks like:



# This example calls a script when the AC state changes, passing the

# notify value as the first argument. If the state is 0x00, it might

# call some sysctls to implement economy mode. If 0x01, it might set

# the mode to performance.

notify 10 {

match "system" "ACPI";

match "subsystem" "ACAD";

action "/etc/acpi_ac $notify";


# start action when USB printer ulpt0 is plugged in

# wait 3 second and then start the spooler daemon


attach 100 {

device-name "ulpt0";

action "sleep 3; lpd;

checkpc -f;

chown 0:0 /dev/ulpt0;

chmod 666 /dev/ulpt0;

echo 'o5L25fgfab' > /dev/speaker;";



So this should work? But it doesn't? What could be wrong here?

bboudewijns (author)peephuhpeep2010-04-13

I have exactly the same problem. If i chmod and chown manually the printer is working fine, but the devd.conf is not loaded at boot indeed. I dont get it. Dont here the sound as wel...

Any help would be appriciated!


bboudewijns (author)2010-04-12


First of all, thanks very much for this nice guide! But i'm stuck..I did everything you told me step by step but my printer is recognized as a ugen0, ugen0.2 and ugen0.3 instead of the ulpt. It is a common samsung ML-2010 laserprinter.

My ulpt is up and running according to freebsd. Already tried rebooting first and then connecting te printer as well, no change what so ever.

Can you help me please! Thanks in advance!


freenas:/dev# kldstat
Id Refs Address            Size     Name
 1    3 0xffffffff80100000 ab6fb0   kernel
 2    1 0xffffffff80bb7000 3948     ulpt.ko
 3    1 0xffffffff9526e000 c745     geom_mirror.ko

lietotajs (author)2010-01-29

why it says to me
Error: FTP Unable to get No address record
pkg_add: unable to fetch '' by URL
whats wrong?

Tau_Zero (author)lietotajs2010-01-29

 Strange.  That file exists at that location.

Post the output to:
cat /etc/resolv.conf

acereced (author)Tau_Zero2010-01-29

Same problem here

can get beyond that point

any ideas

Tau_Zero (author)acereced2010-01-30

Same to you:

Post the output to:
cat /etc/resolv.conf

garacs (author)Tau_Zero2010-04-06

Here's the output of the commands you asked:

PACKAGEROOT: Undefined variable.

freenas:~# cat /etc/resolv.conf
domain XXX (my domain name)

freenas:~# host
Nameserver not responding A record not found, try again

What's wrong with it?

pktp (author)2010-02-24

Could anyone tell how to do this in win7 since it seems to don't have the LPR Port option avaliable.


dsrome (author)pktp2010-03-31

Had the same question. Found the answer here:

About This Instructable




Bio: Twitter: @Tau_Zero
More by Tau_Zero:FreeNAS as a Print Server
Add instructable to: