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

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
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!
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
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
You need to remount the file system as readable/writable. <br> <br># mount -uw / <br> <br>When you're finished, make sure you remount it as readonly. <br> <br># mount -ur /
Hi,<br>I reached this point: by changing pkg_add -r LPRng to:<br>pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.4-release/Latest/LPRng.tbz<br>But at the end it says:<br>pkg_add: pkg_add of dependency 'gettext-' failed!<br>Does this mean a problem? or can I ignore it?
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.<br>Somebody help please!
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.
good morning, i&acute;ll try to install but when done download file .tbz i can see in the screen:<br>Last login: Fri Jun 24 08:27:39 2011 from<br>Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994<br> The Regents of the University of California. All rights reserved.<br><br>Welcome to FreeNAS!<br><br>freenas:~# pkg_add -r LPRng<br>Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.3-release/Lates<br>t/LPRng.tbz... Done.<br><br>/: write failed, filesystem is full<br>bin/lpr: Write failed: No space left on device: No space left on device<br>bin/lprm: Write failed: No space left on device: No space left on device<br>bin/lpstat: Write failed: No space left on device: No space left on device<br>lib/liblpr.a: Write failed: No space left on device: No space left on device<br>libexec/filters/lpbanner: Write failed: No space left on device: No space left o<br>n device<br><br>/: write failed, filesystem is full<br>libexec/filters/lpf: Write failed: No space left on device: No space left on dev<br>ice<br>libexec/filters/psbanner: Write failed: No space left on device: No space left o<br>n device<br>sbin/checkpc: Write failed: No space left on device: No space left on device<br>...<br>tar: Error exit delayed from previous errors.<br>pkg_add: leave_playpen: can't chdir back to ''<br>freenas:~#<br><br>i have installed freenas in a datatravel pendrive usb with 8 gb of capacity, but when i execute df, the command shown:<br>freenas:~# df<br>Filesystem 1K-blocks Used Avail Capacity Mounted on<br>/dev/md0 190190 190188 2 100% /<br>devfs 1 1 0 100% /dev<br>procfs 4 4 0 100% /proc<br>/dev/md1 31470 1292 27662 4% /var<br>/dev/ad4p1 473018108 12433064 422743596 3% /mnt/cosas<br>/dev/da0a 71062 66786 4276 94% /cf<br><br>What i can do for install the pakage?<br>Thanks<br>
If it is a memstick has plenty of memory try<br><br>mount -uw /<br><br>My stick was set to read only.<br><br>
Is this ok? just to clear stuff up?<br><br>freenas# mv /mnt/start/ulpt.ko /boot/kernel/ulpt.ko<br>mv: rename /mnt/start/ulpt.ko to /boot/kernel/ulpt.ko: Read-only file system<br>
I'm not sure if this is an error but i'm getting this...<br><br><br>tar: Error exit delayed from previous errors.<br>pkg_add: leave_playpen: can't chdir back to ''<br><br><br>is it ok?
I have the same problem. hp 1020.<br>When l plugged my printer, FreeNAS beeping and typing &quot;using bi-directional mode&quot;. Is it right?
Looks like the package moved, This is how I got around the error.<br><br>pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages/Latest/LPRng.tbz
Hi, is it possible to use this instruction for my FreeNAS 0.7.2 (FreeBSD 7.3) ?
Completed after some very careful reading, and consulting the source thread. <br>A few helpful hints to my fellow explorers:<br>1) Instead of stating requires a &quot;standard&quot; installation, should state up front that it requires a FULL install, an embedded install will not get past 1st base.<br>2) devd.conf must be placed in /usr/local/etc/devd - if the directory doesnt exist, create it.<br>3) once all the pieces are in place, reboot to fully initialize the system.<br>4) helps to manually run the <br>echo 'o5L25fgfab' &gt; /dev/speaker<br>command so you know exactly what to listen for. This is the success trumpet :)<br><br>All in all, a very good instructable. Thanks for the hard work Tau_Zero!!!
Starting LPRng, <br><br>freenas:~# lpd (enter)<br>2010-10-29-03:29:08.044 freenas Read_file_list: cannot stat required or included file '/etc/printcap' - No such file or directory<br><br>to fix<br>freenas:~# mv /usr/local/etc/printcap /etc/printcap<br>freenas:~# lpd (no error this time)<br>
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 &quot;the lpd request did not respond as expected to a test command&quot;. 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 &quot;printer busy or error&quot;
I followed the instructions as given but I don't seem to have the /etc/printcap directory. Help!
on freenas the file is on /usr/local/etc/printcap
Thank you! I've now found it!
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
Apparently there's a bug with instructables. Someone posted a workaround, i forget where.<br/><br/>&quot;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<br/><br/>&quot;file name.file type&quot;<br/><br/>if you put quotes around the name like above it will use the file type you put in. For example:<br/>To save '2 inch box bottom'<br/><br/><ul class="curly"><li>right-click the file</li><li>save as</li><li>in the name field type (including quotes) &quot;2 inch box bottom.stl&quot;</li><br/></ul>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.&quot;<br/>
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.
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.
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.
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.<br>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.<br><br>=== then everything WORKS fine === if anyone also get the &quot;device busy&quot; when giving the lpq command, try unlpt0 instead of ulpt0.<br><br>Thanks for the great instructables, Tau.
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!<br><br>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?
ar....actually there is a typo, for the devd.conf<br> I deleted a ; before the &quot;<br> also, I added 1 more sound when the printer is unplugged. here is the devd I used:<br> <br> ar....actually there is a typo, for the devd.conf<br> I deleted a ; before the &quot;<br> <br> also, I added 1 more sound when the printer is unplugged. here is the devd I used:<br> <br> <strong># start action when USB printer ulpt0 is plugged in<br> # wait 3 second and then start the spooler daemon<br> #<br> attach 100 {<br> device-name &quot;ulpt0&quot;;<br> action &quot;sleep 3; lpd;<br> checkpc -f;<br> chown 0:0 /dev/ulpt0;<br> chmod 666 /dev/ulpt0;<br> chown 0:0 /dev/unlpt0;<br> chmod 666 /dev/unlpt0;<br> echo 'o5L25fgfab' &gt; /dev/speaker&quot;;<br> };<br> # this will cause a beep when you unplug the usb printer1<br> detach 100 {<br> device-name &quot;ulpt0&quot;;<br> action &quot;sleep 1;<br> echo 'o5L10bafgffgfab' &gt; /dev/speaker;<br> sleep 1;<br> echo 'o5L10fgfabbafgf' &gt; /dev/speaker&quot;;<br> };</strong><br> <br> enjoy~<br> <br> <br>
I am introducing the FreeNAS static IP in Putty.exe and I got an error: &quot;Network error: Connection refused.&quot; What am I doing wrong?!
Go into the Web GUI for FreeNAS, Services-&gt;SSH, and make sure it's enabled.
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.
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?
Hello,<br /> <br /> I'm trying to get the attached &quot;ulpt.ko&quot; file... I get a .tmp file!<br /> Can anyone help?<br /> <br /> Thanks.<br />
i have the problem when I'm trying to get the attached &quot;ulpt.ko&quot; file... I get a .tmp file! Can you help me? Tanks
&nbsp;Check further down in the comments.
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?
hello<br /> can anybody&nbsp; help me to setup a 2nd printer.<br /> <br /> I already got one printer working on a full install of freenas v7.1 but i get stuck<br /> to do a 2nd printer. So far as i can see their is no guide for this for a full install.<br /> <br /> I found guides for embedded or live cd's but that does'nt help me much.<br /> So if somebody could help me out,i would appriciated.<br /> <br /> Thanks<br />
hello,<br /> to solve the problem with ftp fetch:<br /> Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/LPRng.up.tbz: No address record<br /> pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/LPRng.up.tbz' by URL<br /> <br /> i have set the domian in freenas webgui: system-&gt;general setup from &quot;local&quot; to &quot;com&quot;<br /> and now everythings fine.<br /> <br /> <br /> <br />
Hi!<br /> <br /> 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!<br /> <br /> Cheers!
<em><span> <p>Thanks for the nice instruction here! (and thanks to sgrizzi as well as the original author!)<br /> <br /> I got a problem that keeps coming back:&nbsp;the file permissions of the /dev/ultp0 keep changing when a printer is plugged out. This we all know that happens..<br /> <br /> But I&nbsp;changed the devd.conf file (resided in /etc/devd.etc and also put it in /usr/local/etc/devd/devd.conf). <br /> <br /> This is how it looks like:<br /> .....<br /> <br /> #</p> </span></em><span> <p>&nbsp;</p> <p><em># This example calls a script when the AC state changes, passing the</em></p> <p><em># notify value as the first argument. If the state is 0x00, it might</em></p> <p><em># call some sysctls to implement economy mode. If 0x01, it might set</em></p> <p><em># the mode to performance.</em></p> <p><em>notify 10 {</em></p> <p><em>match &quot;system&quot; &quot;ACPI&quot;;</em></p> <p><em>match &quot;subsystem&quot; &quot;ACAD&quot;;</em></p> <p><em>action &quot;/etc/acpi_ac $notify&quot;;</em></p> <p><em>};</em></p> <p><em># start action when USB printer ulpt0 is plugged in </em></p> <p><em># wait 3 second and then start the spooler daemon </em></p> <p><em># </em></p> <p><em>attach 100 { </em></p> <p><em>device-name &quot;ulpt0&quot;; </em></p> <p><em>action &quot;sleep 3; lpd; </em></p> <p><em>checkpc -f; </em></p> <p><em>chown 0:0 /dev/ulpt0; </em></p> <p><em>chmod 666 /dev/ulpt0; </em></p> <p><em>echo 'o5L25fgfab' &gt; /dev/speaker;&quot;; </em></p> <p><em>}; </em></p> <p><em>*/ <br /> </em><strong>END&nbsp;OF&nbsp;FILE&nbsp;HERE</strong><br /> <br /> So this should work? But it doesn't?&nbsp;What could be wrong here?</p> </span>
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...<br /> <br /> Any help would be appriciated!<br /> <br /> Thanks
Hi!<br /> <br /> 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.&nbsp;It is a common samsung ML-2010 laserprinter.<br /> <br /> 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.<br /> <br /> Can you help me please! Thanks in advance!<br /> <br /> Greets<br /> <br /> PS.<br /> Output:<br /> freenas:/dev# kldstat<br /> Id Refs Address&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Size&nbsp;&nbsp;&nbsp;&nbsp; Name<br /> &nbsp;1&nbsp;&nbsp;&nbsp; 3 0xffffffff80100000 ab6fb0&nbsp;&nbsp; kernel<br /> &nbsp;2&nbsp;&nbsp;&nbsp; 1 0xffffffff80bb7000 3948&nbsp;&nbsp;&nbsp;&nbsp; ulpt.ko<br /> &nbsp;3&nbsp;&nbsp;&nbsp; 1 0xffffffff9526e000 c745&nbsp;&nbsp;&nbsp;&nbsp; geom_mirror.ko<br /> <br />
why it says to me <br /> Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/LPRng.tbz: No address record<br /> pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/LPRng.tbz' by URL<br /> whats wrong?<br />
&nbsp;Strange. &nbsp;That file exists at that location.<br /> <br /> Post the output to:<br /> echo $PACKAGESITE $PACKAGEROOT<br /> cat /etc/resolv.conf<br /> host ftp.freebsd.org
Same problem here<br /> <br /> can get beyond that point<br /> <br /> any ideas<br />
Same to you:<br /> <br /> Post the output to:<br /> echo $PACKAGESITE $PACKAGEROOT<br /> cat /etc/resolv.conf<br /> host ftp.freebsd.org<br /> <br />
Here's the output of the commands you asked:<br /> <br /> freenas:~# echo $PACKAGESITE $PACKAGEROOT<br /> PACKAGEROOT: Undefined variable.<br /> <br /> freenas:~# cat /etc/resolv.conf<br /> domain XXX (my domain name)<br /> nameserver<br /> nameserver<br /> <br /> freenas:~# host ftp.freebsd.org<br /> Nameserver not responding<br /> ftp.freebsd.org A record not found, try again<br /> <br /> What's wrong with it?<br />
Could anyone tell how to do this in win7 since it seems to don't have the LPR Port option avaliable.<br /> <br /> thks<br />
Had the same question. Found the answer here:<br /> http://technet.microsoft.com/en-us/library/cc732063.aspx<br />

About This Instructable


43 favorites


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