Freenas 8.0.1 Beta 4 - amd64 & Print Server

Status
Not open for further replies.

Cosmin

Cadet
Joined
Aug 18, 2011
Messages
9
Hi,

I have install lprng (using the 0.7 tutorial from http://tblog.myriad.ca/?p=46).

I had to comment kldload /mnt/Media4/app/lpdsetup/boot/kernel/ulpt.ko line because the ulpt driver is loaded at boot time (out of the box).

It won`t start automaticaly because the interface changed and i can`t do the:

Then goto System->advanced->command scripts and enter the location of the startup script
/mnt/Media4/app/lpdsetup/lpdsetup (in my system)
with the condition “postinit”


and after each reboot i have to start lpdsetup & lpd on CLI to have the printer working.

Can anyone tell me where to make this change?

Thank you
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
FreeNAS 8.x doesn't have a place where you can setup scripts like that yet. A possible work around would be to use a CRON script that looks every 15 minutes or so to see if it's loaded/running already and if not, run your lpdsetup & lpd. I'd offer to write a script to do that for you, but I'm going on a trip soon and don't have the time. That's just my idea, maybe someone else will have another one.
 

workingman

Cadet
Joined
Jun 4, 2012
Messages
3
It's actually quite easy..

Hey guys!

I set this up today on my FreeNAS box running FreeNAS-8.0.4-RELEASE-p2-x64 (11367) using info from http://tblog.myriad.ca/?p=46 as my starting point.

Previously I added mpd (music player daemon) to make my NAS always stream music out to my LAN so I already knew where to put config files and start scripts to make the system happy after a reboot but I figured a quick how-to would probably help others. Here's what I did to get this going.

1. mount -uw / (make root writeable)
2. pkg_add -r LPRng (I actually downloaded LPRng and it's dependencies in case I need to do it again.. see below)
3. vi /usr/local/etc/lpd.conf - added one line.

# default longnumber@ (FLAG off)
Longnumber # <-- not sure what this does exactly but it was the only change I made

lpd.perms needed no modification.

4. vi /usr/local/etc/printcap - make lp line like this (or similar):

lp|laserjet:lp=/dev/ulpt0:tc=.common

I did not change the .common blurb above this.

5. Put config files where the system expects them to be at boot time.

cp /usr/local/etc/lpd.* /conf/base/etc/local/
cp /usr/local/etc/printcap* /conf/base/etc/

6. Put startup script where system expects it to be.

cp /usr/local/etc/rc.d/lprng /conf/base/etc/local/rc.d/

7. Enable startup script

vi /conf/base/etc/rc.conf

add at the bottom:

#for print server
lpd_enable="NO"
lprng_enable="YES"

8. Reboot!

If you don't want to reboot and just want to start it up right now do this:

cp /usr/local/etc/printcap* /etc/
/usr/local/etc/rc.d/lprng onestart

If you want to save packages locally:

wget ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/LPRng-3.8.32_2.tbz
wget ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/gdbm-1.8.3_3.tbz
wget ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/libiconv-1.13.1_1.tbz
wget ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/gettext-0.18.1.1.tbz

That's it. That's all. I think anyway. Let me know if I missed something! :)

Ah yes.. of course I did miss something. Add this to the end of /conf/base/etc/devfs.conf

Code:
# Fix ulpt0 print spool permissions
perm	ulpt0	0666
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
You missed the part of the FreeNAS documentation that warns against installing apps like this. You will totally bork your FreeNAS installation and risk possibly corrupting your data when your system crashes....
 

workingman

Cadet
Joined
Jun 4, 2012
Messages
3
maybe I did..

But my system is working great.

I always keep a backup of my config and have even upgraded the OS without issue. (you do need to reapply these changes after an upgrade)
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
You certainly did. Try using a FreeBSD jail. It's how the developers have handled it in FreeNAS 8.2.
 

workingman

Cadet
Joined
Jun 4, 2012
Messages
3
Did it in a jail...

So I noticed 8.2 was released and following your advice I tried a jail.

I used the generic jail from http://sourceforge.net/projects/freenas/files/FreeNAS-8.2.0/RELEASE/x64/plugins/ as my starting point.

Well it works, but it wasn't fun.

Still had to get a bit hacky anyway... first to allow my jail to access the files on my NAS (mpd needs music to play) then to allow the jail to access the printer at /dev/ulpt0. I mean actually have the device node within the jail.

Here's what I did for the printer.

Add this to /conf/base/etc/devfs.rules
Code:
[devfsrules_jail=10]
add path 'ulpt*' mode 0666


And like before this to /conf/base/etc/devfs.conf
Code:
# Fix ulpt0 print spool permissions
perm    ulpt0   0666


Before I made those changes the jail had very little in it's /dev now it seems to have everything so I don't really know if there's a better way but again... it works.

Maybe someone wiser can point out the error of my ways.

Hope that helps somebody.
 
Status
Not open for further replies.
Top