*New 11.3 series Release:
2019-10-05: XigmaNAS 11.3.0.4.6928 - released, 11.2 series are soon unsupported!

*New 12.0 series Release:
2019-10-05: XigmaNAS 12.0.0.4.6928 - released!

*New 11.2 series Release:
2019-09-23: XigmaNAS 11.2.0.4.6881 - released!

We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

[HOWTO] - OLD FreeNAS Print Server Setup Giude

Only Admin's or Moderators can move thread's to this sub-forum.
Nobody should start a new thread on this sub-forum.
Anybody can reply to a thread on this sub-forum.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
ldkraemer
Starter
Starter
Posts: 53
Joined: 26 Jun 2012 22:35
Status: Offline

[HOWTO] - OLD FreeNAS Print Server Setup Giude

#1

Post by ldkraemer » 05 Jul 2012 15:54

FreeNAS Print Server Setup Guide
These instructions have been compiled to improve on the core work previously done by SGRIZZI with additional material by TAU_ZERO. I have tried to simplify this process to the minimum required to get the system working, adding and changing things that I found during my setup.

Description of System

I currently have a FreeNAS system which is used to support data sharing with other family members. This is running Slimserver/Slimnas to serve music & radio services around the house.
I am using an HP C3180 multi-function printer with USB interface.
The server is to carry out spooling functionality only – no formatting.
Print formatting is to be carried out by the clients, all running Windows XP in my case.
There are no changes required to the FreeNAS system hardware setup.
I am using the embedded version with FreeNAS running from a 128Mb Compact Flash card with a 500Gb data disk (mnt/mountname).
I have used exactly the same instructions as described previously by contributors who use the LiveCD boot version.
The spooler software is to be stored on the data disk (/mnt/mountname)
Startup of the system aims to be totally automatic (not totally achieved - see the note at the end of this document).

Important Notes

These instructions are for FreeNAS version 0.69 (and recently added 0.7.1)

To setup the required printing services on XP clients you must have access to your original Microsoft installation disk.
Your actual HD mount name should be substituted where I have used mountname
You will need to use an SSH connection to access the FreeNAS system during the build. I used a Windows version of PuTTy on my XP Pro client.
When you connect using the SSH console you should login as root. Your password will be the same as used during a normal FreeNAS login.
These instructions are based on your printer connecting via a USB connection.

1 – Download & Setup LPRng Spooler.

The spooler software is retrieved from FreeBSD website and stored on the RAID disk.
Use the following FreeBSD commands from the SSH console.
Set the temporary storage area
setenv PKG_TMPDIR /mnt/mountname/temp

Invoke pkg_add to download the software to your mounted disk.
pkg_add –r lprng –P /mnt/mountname/app/

2 – Setup LPRng Configuration Files

You can just copy the attached files to their required destinations. If you need to make any changes I suggest using the FreeNAS file editor (from the Advanced menu) to do this.

Listings for all these files are in the Reference Section.

Please note – These files should all be placed in the /mnt/mountname/app/lpdsetup/etc directory, this is not where the original sample files were found.

printcap

This is to be stored on the HD in /mnt/mountname/app/lpdsetup/etc and will be loaded after boot as /etc/printcap.

Please refer to the manual if you need to modify this configuration file to meet your requirements. I followed previous contributors’ suggestion to setup the spool queue in RAM. A dedicated space on ramdisk will be used. No printer filter is being used as the spooler will print a pre-processed flat file.

lpd.perms

This is to be stored on the HD in /mnt/mountname/app/lpdsetup/etc and will be loaded after boot as /usr/local/etc/lpd.perms. This is a straight copy of the sample file from the LPRng package.

lpd.conf

This is to be stored on the HD in /mnt/mountname/app/lpdsetup/etc and will be loaded after boot as /usr/local/etc/lpd.conf . Again this is a straight copy of the sample file from the LPRng package.

3 – Setup The USB Printer Driver

When you connect the printer to the USB port on the FreeNAS server it is recognized as a generic USB system. You need to load ulpt.ko the ‘ulpt0’ printer driver. This is not packaged with FreeNAS and is very difficult to track down. I have attached a copy to this article. I believe it is available in boot/kernel in the FreeBSD 7.1 implementation.

Copy the driver to the /mnt/mountname/app/lpdsetup/boot/kernel/ directory by using
kldload /mnt/mountname/app/lpdsetup/boot/kernel/ulpt.ko


Now Ulpt0 should be loaded. Connect your printer to your FreeNAS system.

Prepare a print file for your printer - If you are using a windows system select the print to file checkbox, and send it to a directory somewhere on the FreeNAS Server instead of sending to the physical printer. Remember where you store this. I suggest calling it printest.prn. Keep this file for for use later on.

Now undertake the following steps from the SSH console :-

ll /dev/u*
This should show that your driver is there. Look for ulpt0 in the listing.

chmod 666 /dev/ulpt0
This ensures the driver is set up for write access.

Now copy the test file to the printer port - assuming that you have put your printest.prn file in /mnt/mountname/testprintdir/

cp /mnt/mountname/testprintdir/printest.prn /dev/ulpt0
Your printer should now turn on and start printing.

4 – Prepare The File Needed To Start The Spooler Daemon (lpd).

The devd.conf file will react to the “printer insertion” event, and start the daemon. It will also give a unique musical “beep” so that you know that the spooler is up and running.

devd.conf is to be stored on the HD in /mnt/mountname/app/lpdsetup/etc and will be loaded after boot as /usr/local/etc/devd/devd.conf

5 – Script To Automate The Process

This carries out all the necessary actions, sets up links for the printer-spooler commands, and gives ulpt0 the right capabilities. Please note that the “lpd” spooler daemon, starts as “root” but runs as “daemon”. Please note the instruction further in this section to change the access permissions to ulpt0 or you will get an access denied error.

/mnt/ramdisk is the spool queue area
/mnt/mountname is the HD
/app is the application directory
/lprng is the location where the spooler application is installed
/lpdsetup and /lpdsetup/* are the storage areas for the various support files and those that will be copied to the main areas in ram.
lpdsetup is the new script file (do not confuse with the lpdsetup directory)

lpdsetup

This is the script file which must be stored in /mnt/mountname/app/lpdsetup/
The file sets up a 20Mb ramdisk which is large enough for most printing. Some contributors suggest upping this to 40Mb for printing very large files. If you want to increase this, just change the “20m” in line seven to “40m”.

(Don’t forget to change the HD mount name to your HD name in all the relevant lines).
You now need to give the right permissions to ulpt0 or you will get an access denied error. To do this from your SSH console do the following :-

cd /mnt/mountname/app/lpdsetup/
chmod +x lpdsetup


6 – Setup The Needed Variables and Startup Script in FreeNAS

Logon to the FreeNAS GUI

Select System | Advanced | rc.conf and add the following lines
Add variable lpd_enable with value NO
Add variable lprng_enable with value YES
Now go to System | Advanced | Command scripts

Add the new Command /mnt/mountname/app/lpdsetup/lpdsetup with the Type set to postinit

7 – Final Checks

Reboot FreeNAS. When you hear the normal ‘beep’ to indicate FreeNAS is up and running, unplug your printer and plug it in again so that the system will “see” it again. If everything is setup properly, after about 3 seconds, you should hear a different musical “bleep” which is the acknowledgement that the lpd daemon is running.

Now use the SSH console to check out a few things:

checkpc –V
This should show if any configuration file is not correct or not loaded properly.

top
You should be able to see the lpd daemon running. Ctrl+C will stop this.

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.

ll /dev/u*
should show ulpt0 setup for read-write for user, group, root. These command will also give you a hint on where problems might be – in case you have any.

Now try and print a file. Using your file we printed earlier at step 4, enter the following:

lpr /mnt/mountname/testprintdir/printest.prn
If after a few seconds your printer starts printing then you have now completed the server & spooler setup work on the FreeNAS box.

If you are using Vista skip to section 10.

8 – Add Required Windows Components on A Windows XP Client PC


Note - Vista client PCs are covered in Section 10.

This assumes you are using Windows XP with Service Pack 3 loaded.
The printer driver you use here are the Windows drivers.
Windows XP does provide a built-in Unix LPR client, however you have to load some additional facilities from the XP setup disk.

(This is where these instructions differ from previous documentation).

On your XP machine select Start | Control Panel | Add or Remove Programs.
Select Add or Remove Windows Components (it is an icon on the left task bar).
Tick the option for Management & Monitoring Tools.
Tick the option for Other Network File & Print Services and click Next
You will probably be asked to insert your XP disk at this stage.
Once the additional components have been loaded, click Finish.
This should install the Unix LPR port that we need.

9 – Setup A New Printer - For Windows XP Client PCs

Note - Vista client PCs are covered in Section 11.

I suggest leaving old printers unchanged and add a new printer.

You need to setup your XP machine to use its Windows driver. This will prepare the necessary print file on your Win XP client and spool it over the network to your FreeNAS print server.

On your XP machine select Start | Control Panel | Printers & Faxes.

Step 1 – Add a new printer – Using the Local Printer option
s1a.jpg

Step 2 – Select a port

If you can’t add LPR – either you have already set this up and need to use the existing LPR with the required FreeNAS IP address, or you haven’t loaded the LPR facility from the Windows setup disk.
s2a.jpg


Step 3 – Setup LPR parameters – Inserting the FreeNAS network address and “lp”.
s3a.jpg

Now choose a pre-defined printer, or insert your manufacturers disk. Remembering this is the Windows driver you are adding.

Step 4 – Naming your printer
s4a.jpg

Now select Sharing or not.
Finally check the printer test page works correctly.

Now try and print something from your Windows XP client, using the newly added printer. If your printer connected to FreeNAS now prints correctly, then this is the task completed.

10 – Add Required Windows Components on A Vista Client PC

The printer drivers you use here are the Windows drivers.

Vista like XP does provide a built-in Unix LPR client, however you have to load some additional facilities.

On the Vista machine select Start | Control Panel | Programs.
Select Turn Windows Features On/Off.
Go to Print Services and expand the + box.
Select (by adding a tick) LPR Port Monitor and click Next
V1a.jpg

You will now have to wait whilst Vista adds the required components (it can take a while).

Once the additional components have been loaded, click Finish.

The Unix LPR port will now be installed.

11 – Setup A New Printer - For Vista Client PCs

I suggest leaving old printers unchanged and add a new printer.

You need to setup the Vista machine to use its Windows driver. This will prepare the necessary print file on your client and spool it over the network to your FreeNAS print server.

On the Vista PC select Start | Control Panel | Programs.

Step 1 – Add a new printer – Using the Local Printer option
V2a.jpg

Step 2 – Select a port

If you can’t add LPR – either you have already set this up and need to use the existing LPR with the required FreeNAS IP address, or you have missed the step to add the LPR facility from the Vista system.
V3a.jpg

Step 3 – Setup LPR parameters – Inserting the FreeNAS network address and “lp”.

V4a.jpg

Now choose a pre-defined printer, or insert your manufacturers disk. Remembering this is the Windows driver you are adding.

Step 4 – Naming your printer
V5a.jpg

Now select Sharing or not.

Finally check the printer test page works correctly.

Now try and print something from your Vista client, using the newly added printer. If your printer connected to FreeNAS now prints correctly, then this is the task completed.


Appendix - File Listings

printcap

This is to be stored on the HD in /mnt/mountname/app/lpdsetup/etc and will be loaded after boot as /etc/printcap.

# @(#)printcap HP C3180
lp|deskjet:\
:sd=/mnt/ramdisk/spool/lpd/bare:\
:sh:\
:lp=/dev/ulpt0:

lpd.perms

This is to be stored on the HD in /mnt/mountname/app/lpdsetup/etc and will be loaded after boot as /usr/local/etc/lpd.perms. This is a straight copy of the sample file from the LPRng package.

ACCEPT SERVICE=C SERVER REMOTEUSER=root,papowell
ACCEPT SERVICE=C LPC=lpd,status,printcap
REJECT SERVICE=C
ACCEPT SERVICE=M SAMEHOST SAMEUSER
ACCEPT SERVICE=M SERVER REMOTEUSER=root
REJECT SERVICE=M
DEFAULT ACCEPT

lpd.conf

This is to be stored on the HD in /mnt/mountname/app/lpdsetup/etc and will be loaded after boot as /usr/local/etc/lpd.conf . Again this is a straight copy of the sample file from the LPRng package.

# 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)
Longnumber

devd.conf

This is to be stored on the HD in /mnt/mountname/app/lpdsetup/etc and will be loaded after boot as /usr/local/etc/devd/devd.conf

# 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;
echo 'o5L25fgfab' > /dev/speaker;";
};
*/

lpdsetup

This is the script file which must be stored in /mnt/mountname/app/lpdsetup/

The file sets up a 20Mb ramdisk which is large enough for most printing. Some contributors suggest upping this to 40Mb for printing very large files. If you want to increase this, just change the “20m” in line seven to “40m”.
(Don’t forget to change the HD mount name to your HD name in all the relevant lines).

#!/bin/sh
#
# 20090412
#
# Install the spool area - a 10MB RAM disk md8 mounted on /mnt/ramdisk
test ! -d /mnt/ramdisk && mkdir /mnt/ramdisk && mdmfs -s 20m md8 /mnt/ramdisk
#
# copy printer configuration files
#
cp -R -p -i /mnt/mountname/app/lpdsetup/etc/printcap /etc/
cp -R -p -i /mnt/mountname/app/lpdsetup/etc/lpd.conf /usr/local/etc/
cp -R -p -i /mnt/mountname/app/lpdsetup/etc/lpd.perms /usr/local/etc/
#
mkdir /usr/local/etc/devd
cp -R -p -i /mnt/mountname/app/lpdsetup/etc/devd.conf /usr/local/etc/devd/
#
# prepare spool directory entries
mkdir -p -m 700 /mnt/ramdisk/spool/lpd/bare
chown 1:1 /mnt/ramdisk/spool/lpd/bare
#
# run checkpc and fix any missing files and permissions
/mnt/mountname/app/lprng/sbin/checkpc -f
#
# load printer drivers
kldload /mnt/mountname/app/lpdsetup/boot/kernel/ulpt.ko
#
# set r/w mode for ulpt0
chown 0:0 /dev/ulpt0
chmod 666 /dev/ulpt0
#
devfs ruleset 10
devfs rule add path ulpt0 mode 666
devfs rule applyset
#
cd /usr/sbin
ln -s /mnt/mountname/app/lprng/sbin/lpd
ln -s /mnt/mountname/app/lprng/sbin/lpc
ln -s /mnt/mountname/app/lprng/sbin/checkpc
ln -s /mnt/mountname/app/lprng/bin/lpr
ln -s /mnt/mountname/app/lprng/bin/lpq
ln -s /mnt/mountname/app/lprng/bin/lprm
ln -s /mnt/mountname/app/lprng/bin/lpstat
#
# restart devd
/etc/rc.d/devd stop
devd
#

11 - Summary

The simplicity of FreeNAS remains intact and the boot sequence is completely automatic. You can turn this facility on or off by adding or removing the commands from FreeNAS.

It has the bonus of giving wireless printing capability if you have a wireless router in the setup.

Important Warnings

You must remember to start the FreeNAS server before powering up your printer, or alternatively just turn the printer off and on to register the printer with the spooler daemon.

If the printer is started before FreeNAS the printing service will not start until you either power it off and back on again or you disconnect and re-connect the printers USB lead.

This note is a collation of material from a number of sources. I have just distilled this to hopefully provide a simplified setup guide.

Good Luck – Wezzer
files.zip
ulpt.zip

Copied to NAS4Free 07-05-2012 - Larry - Updated files.zip for typo corrections!
You do not have the required permissions to view the files attached to this post.
Last edited by ldkraemer on 14 Jul 2012 23:30, edited 2 times in total.

ldkraemer
Starter
Starter
Posts: 53
Joined: 26 Jun 2012 22:35
Status: Offline

Re: [HOWTO] - OLD FreeNAS Print Server Setup Giude

#2

Post by ldkraemer » 05 Jul 2012 16:24

Solution to FreeNAS Print Server Problem after 0.7.1 Embedded Upgrade

This modification is only required when FreeNAS embedded has been upgraded after the print server system has been installed.

The newest embedded version of FreeNAS uses FreeBSD 7.2, the older version was using 6.9. The upgrade has dealt with all the FreeNAS files, but not the subsiduary packages such as the pre-built LPRng package, which has changed.

This is the solution which has resolved the problem. I am not claiming it is the most efficient, but it does avoid some of the hacks I have seen recently. This is the process I followed.

Please replace your actual mount name where you see the directory /mountname/ specified.

Before you start take a copy of all the files and directories in and below /mnt/moutname/app/lpdseup.

1. On the FreeNAS GUI go into System | Advanced

Go to the RC.Conf menu and change variable lprng to No. Save and apply the changes.
Go to the Command Scripts menu and remove the lpdsetup entry with type postinit.


2. Stop FreeNAS and then restart - This will have stopped the printing services.

3. Open a terminal session from a separate PC (I use PuTTy on a Windows PC connected to the network).

4. Log on to the FreeNAS box as root - Your password will be the same as for normal FreeNAS login.

5. Check the currently loaded package

pkg_info | grep LPRng
Write down the details of the response (it should probably be similar to LPRng-3.8.32_1).

6. Delete the LPRng package

pkg_delete LPRng-3.8.32_1 (or whatever the response was).

This leaves all the original files in the /mnt/mountname/app/ directory on your share (and Windows will not let you delete them via explorer).


7. Remove the old app directory and all its files - Please be extremely carefull with the syntax of this command.

rm -rf /mnt/mountname/app/

8. Check the old directory has gone

cd /mnt/mountname/
ls -l
Check the app directory no longer shows.


9. Get FreeBSD to reinstall the newer LPRng package and any dependencies.

pkg_add -r LPRng -P /mnt/mountname/app/

10. Now install the extra directories for the lpdsetup processes.

cd /mnt/mountname/app/LPRng/
md lpdsetup
cd lpdsetup
md etc
md boot
cd boot
md kernel


11. Replace the original setup files as follows :-

lpdsetup in the /mnt/mountname/app/lpdsetup directory.
ulpt0.ko in the /mnt/mountname/app/lpdsetup/boot/kernel/ directory
lpd.conf, lpd.perms, devd.conf and printcap in the /mnt/mountname/app/lpdsetup/etc/ directory


12. Change the permissions on lpdsetup

cd /mnt/mountname/app/lpdsetup
chmod +x lpdsetup


13. Reinstate the FreeNAS startup scripts

On the FreeNAS GUI go into System | Advanced

Go to the RC.Conf menu and change variable lprng to YES. Save and apply the changes.
Go to the Command Scripts menu and add a new entry /mnt/mountname/app/lpdsetup/lpdsetup with type postinit.
Save all changes.


14. Stop FreeNAS and then re-start again (don't use reboot).

15. From a new PuTTY session

ll /dev/u* and check that ulpt0 is showing.
chmod 666 /dev/ulpt0


16. Carry out any necessary checks from the original article and then create and send a testprint document

All should now be sorted.

Good Luck - Wezzer

Copied to NAS4Free 07-05-2012 - Larry

ldkraemer
Starter
Starter
Posts: 53
Joined: 26 Jun 2012 22:35
Status: Offline

Re: [HOWTO] - OLD FreeNAS Print Server Setup Giude

#3

Post by ldkraemer » 05 Jul 2012 16:34

Folks,
My FreeNAS embedded system was running from a CF that had system only partition. I wanted to try out the Print Server
that is an Addon for FreeNAS. There wasn't enough Memory remaining on the CF to allow me to install the Print Server,
so I purchased an 8 Gig Transcend CF, and installed FreeNAS, making a System Partition, a DATA Partition, and a Swap Partition
from the following Menu Selections:
9). Install/Upgrade to Hard Drive/Flash device, etc.
2). Install 'embedded' OS on HDD/Flash/USB + DATA + SWAP Partitions
My newly installed system was larger (about 70 meg) and a 7+ Gig data partition. 0.7.2 Sabanda (revision 5252)
I have a 500 Gig Drive installed for testing. My FreeNAS IP is 192.168.1.250 and I have CIFS, NFS, SSH, and FTP enabled and
working. Here are the steps I am using to set up the Print Server on my embedded system.

I found that I needed to: Create subdirectories on the Hard Drive, Add DNS Servers via the WebGUI, tunnel into FreeNAS
and become root, Verify the Gateway Address, ping an internet address, search for the LPRng*.tbz file, set two environment
variables, and edit the rc.conf file, before going to step #2 of the original guide.

The first step is shown as below, and sounds easy......but after four days I was ready to give up.......:
1 – Download & Setup LPRng Spooler.

The spooler software is retrieved from FreeBSD website and stored on the RAID disk.
Use the following FreeBSD commands from the SSH console.
Set the temporary storage area
setenv PKG_TMPDIR /mnt/mountname/temp

Invoke pkg_add to download the software to your mounted disk.
pkg_add –r lprng –P /mnt/mountname/app/
Initially I couldn't get the file to download, because of a few setup problems like
wrong Gateway, no DNS Servers assigned, didn't know how to SSH into FreeNAS, and
I couldn't find the proper file name for version 7.2

Here are my steps:
1. Use SSH to tunnel into Freenas and become root from my Laptop:

Code: Select all

    ssh loginname@192.168.1.250
    #enter password
    su root
    #enter password
2. Verify the Gateway Address:

Code: Select all

    netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
129.253.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0

Gateway is 192.168.1.1
3. Set OpenDNS Servers in the WebGUI:
208.67.222.222
208.67.220.220

4. Ping http://www.yahoo.com
Yes, it pings OK, so I am connected to internet.

5. Look for my 7+ Gig Data Partition on my CF???

Code: Select all

    df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/md0 174M 156M 18M 90% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ad0s1a 69M 62M 7.3M 90% /cf
procfs 4.0K 4.0K 0B 100% /proc
/dev/ad2p1 451G 109G 306G 26% /mnt/mysata
/dev/md1 31M 1.1M 27M 4% /var
I haven't found my DATA Partition yet. What commands can I use to locate it and access it?

6. Searched for the LPRng Package for version 7.2
Use Firefox browser to go to:
ftp://ftp.freebsd.org/pub/FreeBSD/ports ... lease/All/
Search for the package LPRng*

7. Created my subdirectories on the Hard Drive, and set two environment variables:

Code: Select all

    cd /mnt/mysata
    mkdir apps
    cd apps
    mkdir temp
    mkdir lprng
    cd /
    setenv PKG_TMPDIR /mnt/mysata/apps/temp/
    env
    setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.2-release/print/
    env
    cd /
    pkg_add -rv LPRng -P /mnt/mysata/apps/lprng/
    #
    #If you are getting ERRORS look carefully at the -r & -P as the DASH isn't the correct character..........It's too long.......
    #pkg_add -rv LPRng -P /mnt/mysata/apps/lprng/  this is correct
    #
    # NOTE: The manual states to not use the version numbers in the filename as shown above.   
    #
    #Options:
    #-v    Turn on verbose output.
    #-r    Use the remote fetching feature. This will determine the appropriate obj format and release and then fetch and install the package.
    #-P  prefix
    #    Does the same as the -p option, except that the given prefix is also used recursively for the dependency packages, if any.
    #      If the -P flag appears after any -p flag on the command line, it overrides it’s effect, causing pkg_add to use the given prefix recursively.
    #
    #
    #
    #
    #LPRng uses the printcap, lpd.conf, and lpd.perms configuration files
    #
    #For further information, see the LPRng Documentation:
    #  /usr/local/share/doc/LPRng
    #
    #The LPRng Web Site is http://www.lprng.com
    #
    #
    #
My question is:
1. How do I locate my DATA partition on the Compact Flash (CF)?
Nothing I have tried shows the 7+ Gig Data Partition, or how to access it.

ANSWER
1. RESCAN the drives.
2. Add the CF Data Partition (Partition #2) as MBR Type.
3. Add a Mount Point.
4. cd /mnt to verify the Partition.

LPRng appears to be installed now, and I just need to configure & test the install. Maybe some of the above
steps could be incorporated into the original Step #1 for us folks new to FreeBSD & FreeNAS. For the
experts it's simple, but it threw me a couple of curves.

THANKS for the Guide. I think I can make it work now with the extra added information. On to Step #2!



Copied to NAS4Free 07-05-2012 - Larry

ldkraemer
Starter
Starter
Posts: 53
Joined: 26 Jun 2012 22:35
Status: Offline

Re: [HOWTO] - OLD FreeNAS Print Server Setup Giude

#4

Post by ldkraemer » 05 Jul 2012 16:41

Folks,
I've got everything installed, but I still have one problem. When I do a:
checkpc –V
This should show if any configuration file is not correct or not loaded properly.
I get the following error message:

Code: Select all

    ldkfreenas:/# checkpc -V
    /libexec/ld-elf.so.1: Shared object "libintl.so.8" not found, required by "checkpc"
    ldkfreenas:/#

I finally found a solution, which creates the proper link:
http://forums.freebsd.org/showthread.php?t=14672
http://forums.freebsd.org/showthread.php?t=14655

Code: Select all

    cd /usr/local/lib
    ls -alt
    ln -s libintl.so.9 libintl.so.8
I added the following lines to the lpdsetup script so the link would be created at Powerup/reboot:

Code: Select all

    #
    cd /usr/bin
    ln -s /mnt/mysata/apps/lprng/sbin/lpd
    ln -s /mnt/mysata/apps/lprng/sbin/lpc
    ln -s /mnt/mysata/apps/lprng/sbin/checkpc
    ln -s /mnt/mysata/apps/lprng/bin/lpr
    ln -s /mnt/mysata/apps/lprng/bin/lpq
    ln -s /mnt/mysata/apps/lprng/bin/lprm
    ln -s /mnt/mysata/apps/lprng/bin/lpstat
    #
    #added a symbolic link that loads each time a reboot/powerup is done.
    cd /usr/local/lib
    ln -s libintl.so.9 libintl.so.8
    #

To test and correct your setup use:

Code: Select all

    checkpc -V -f
Ref:
LPRng-Reference.pdf

I also made this change in devd.conf to have the sound:

Code: Select all

    # devd.conf 
    # devd is used to provide a way to get user programs or commands to run when certain kernel events happen
    #
    # the printer using ulpt0 has the higher pitch (the 5) sounds and ulpt1 has the lower pitch (the 3) sounds
    #
    # start action when USB printer1 is plugged in
    # wait 3 seconds and then start the spooler daemon
    # after plugging in printer1 sleep 1 then beep
    # then run checkpc sleep 1 and beep
    #
    # this is for printer1 using ulpt0
    attach 100 {
    device-name "ulpt0";
    action "sleep 3; lpd;
    echo 'o5L10fgfabbafgf' > /dev/speaker;
    checkpc -f;
    sleep 1;
    echo 'o5L10bafgffgfab' > /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";
    };
    # this is for printer2 using ulpt1
    #attach 100 {
    #device-name "ulpt1";
    #action "sleep 3; lpd;
    #echo 'o3L10bafgffgfab' > /dev/speaker;
    #checkpc -f;
    #sleep 1;
    #echo 'o3L10fgfabbafgf' > /dev/speaker";
    #};
    #
    # this will cause a beep when you unplug the usb printer2
    #detach 100 {
    #device-name "ulpt1";
    #action "sleep 1;
    #echo 'o3L10fgfabbafgf' > /dev/speaker;
    #sleep 1;
    #echo 'o3L10bafgffgfab' > /dev/speaker";
    #};

UBUNTU NETWORK PRINTER SETUP:
For setting up your LPR printer in Ubuntu go to SYSTEM -> ADMINISTRATION -> PRINTING
then ADD a new LPD/LPR Network Printer using the following Printer information from FreeNAS:

Code: Select all

    lpq
my result shows:
ldkfreenas:/mnt/mysata/apps/lprng/sbin# lpq
Printer: lp@ldkfreenas 'HL-2140'
Queue: no printable jobs in queue
ldkfreenas:/mnt/mysata/apps/lprng/sbin#
My FreeNAS Box is named ldkfreenas.local and I insert the following in my Ubuntu Setup page:
Host: = lp@ldkfreenas.local
Queue: = lp
and finish by selecting the default drivers for my Brother HL-2140 Printer.

You should now be able to print any document right from your Wifi Ubuntu Laptop or Desktop.

HOWTO REF with Photo's:
http://sourceforge.net/apps/phpbb/freen ... =94&t=7413

THANK YOU!!!!! It's PERFECT!!!!!


Copied to NAS4Free 07-05-2012 - Larry

ramanvda
NewUser
NewUser
Posts: 4
Joined: 07 Mar 2014 18:35
Status: Offline

Re: [HOWTO] - OLD FreeNAS Print Server Setup Giude

#5

Post by ramanvda » 07 Mar 2014 18:37

I can't see jpg images attached in your post.... :?

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4921
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: [HOWTO] - OLD FreeNAS Print Server Setup Giude

#6

Post by raulfg3 » 07 Mar 2014 22:17

sorry some jpg are corrupted when n4f moves to new provider
12.0.0.4 (revision 6766)+OBI on SUPERMICRO X8SIL-F 8GB of ECC RAM, 12x3TB disk in 3 vdev in RaidZ1 = 32TB Raw size only 22TB usable

Wiki
Last changes

ramanvda
NewUser
NewUser
Posts: 4
Joined: 07 Mar 2014 18:35
Status: Offline

Re: [HOWTO] - OLD FreeNAS Print Server Setup Giude

#7

Post by ramanvda » 08 Mar 2014 17:20

works on Nas4free 9.2 with some minor changes.

I don't have beep when I plug the printer but it works like that.

and the step about ulpt.ko seem to be not necessary: already built in freebsd 9.2?

THANK YOU VERY MUCH! :P
see you,

jamaroney
Advanced User
Advanced User
Posts: 217
Joined: 13 Aug 2012 17:32
Location: Stroudsburg, PA
Status: Offline

Re: [HOWTO] - OLD FreeNAS Print Server Setup Giude

#8

Post by jamaroney » 04 Jan 2016 12:36

Works well with N4F 10.2 embedded. Easy to set up, and many steps now can be eliminated, esp. if you don't mind using mount_unionfs, as I have been doing for the last couple years w/ no problems.

User avatar
F8BOE
experienced User
experienced User
Posts: 106
Joined: 03 Jun 2013 23:09
Location: France
Status: Offline

Re: [HOWTO] - OLD FreeNAS Print Server Setup Giude

#9

Post by F8BOE » 08 Jan 2016 07:19

Hello,

That looks great. Seems to work also on embedded systems and that's really cool.
I'll try it on my RPi2 NAS.

Ciao @+

jamaroney
Advanced User
Advanced User
Posts: 217
Joined: 13 Aug 2012 17:32
Location: Stroudsburg, PA
Status: Offline

Re: [HOWTO] - OLD FreeNAS Print Server Setup Giude

#10

Post by jamaroney » 09 Jan 2016 00:22

Here are the important differences doing an embedded install on N4F 10.2:

(The following two PostInit commands assume that you have already made /mnt/YOUR DRIVE/YOUR DIRECTORY and folders /usr/local/ and /var/db/ within)
In Command Scripts (as PostInit):
mount_unionfs -o w /mnt/YOUR DRIVE/YOUR DIRECTORY/usr/local/ /usr/local/
mount_unionfs -o w /mnt/YOUR DRIVE/YOUR DIRECTORY/var/db/ /var/db/

Reboot N4F

Via SSH: pkg install lprng

Create printcap file as noted in first post. Edit name of printer if you want. Save file in /usr/local/etc/

DO NOTHING TO/ABOUT ulpt.ko, lpd.perms, lpd.conf and devd.conf (disregard all info in first post about them)

In Command Scripts (all Postinit):
cp /usr/local/etc/printcap /etc/printcap
/usr/local/etc/rc.d/lpdsetup

In rc.conf:
Add variable lprng_enable with value YES
DO NOT add variable "lpd_enable" AT ALL (disregard info in first post about it)

Here's my lpdsetup file (stripped to its essentials with some minor modifications at the end):
#!/bin/sh
#
#
# Install the spool area - a 40MB RAM disk md8 mounted on /mnt/ramdisk
test ! -d /mnt/ramdisk && mkdir /mnt/ramdisk && mdmfs -s 40m md8 /mnt/ramdisk
#
# prepare spool directory entries
mkdir -p -m 700 /mnt/ramdisk/spool/lpd/bare
chown 1:1 /mnt/ramdisk/spool/lpd/bare
#
# run checkpc and fix any missing files and permissions
/usr/local/sbin/checkpc -f
#
# set r/w mode for ulpt0
chown 0:0 /dev/ulpt0
chmod 666 /dev/ulpt0
#
devfs ruleset 10
devfs rule add path ulpt0 mode 666
devfs rule applyset
#
# restart devd & start lpd
/etc/rc.d/devd restart
lpd
#
save file to /usr/local/etc/rc.d/ and make executable (chmod +x)

I hope I didn't forget anything....

Post Reply

Return to “[HowTo]”