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.
Remove these ads by
Signing UpStep 1Preparation
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: 192.168.1.50
- 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
ulpt.ko11 KB| « Previous Step | Download PDFView All Steps | Next Step » |










































I reached this point: by changing pkg_add -r LPRng to:
pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.4-release/Latest/LPRng.tbz
But at the end it says:
pkg_add: pkg_add of dependency 'gettext-0.18.1.1' failed!
Does this mean a problem? or can I ignore it?
Somebody help please!
Last login: Fri Jun 24 08:27:39 2011 from 80.26.36.12
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
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.3-release/Lates
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
ice
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 ''
freenas:~#
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?
Thanks
mount -uw /
My stick was set to read only.
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
tar: Error exit delayed from previous errors.
pkg_add: leave_playpen: can't chdir back to ''
is it ok?
When l plugged my printer, FreeNAS beeping and typing "using bi-directional mode". Is it right?
pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages/Latest/LPRng.tbz
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!!!
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)
"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."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.
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?
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";
};
enjoy~
I'm trying to get the attached "ulpt.ko" file... I get a .tmp file!
Can anyone help?
Thanks.
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.
Thanks
to solve the problem with ftp fetch:
Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/LPRng.up.tbz: No address record
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/Latest/LPRng.up.tbz' by URL
i have set the domian in freenas webgui: system->general setup from "local" to "com"
and now everythings fine.
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!
Cheers!
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;";
};
*/
END OF FILE HERE
So this should work? But it doesn't? What could be wrong here?
Any help would be appriciated!
Thanks
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!
Greets
PS.
Output:
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