Register for the iXsystems Community to get an ad-free experience

Problems with installing CUPS in Plugin Jail

Status
Not open for further replies.

Raven9810

Dabbler
Joined
Jul 20, 2014
Messages
24
Hello,

I am fairly new to FreeNAS, but I am loving it so far. I am attempting to install CUPS, to try and get a print server function working. I created a Plugin Jail and named it Print. I left the default settings checked when I created the jail. I then opened the Shell, and typed pkg install CUPS. The Package downloads everything just fine, but when it attempts to install everything from the package, every item in the package fails with a message like so:

pkg: WARNING: locally installed gcc47-4.7.4.20140118 conflicts on /usr/local/lib
/gcc47/include/c++/gnu/javax/crypto/keyring/IPrivateKeyring.h with: - gcc-4.7.3_1

I don't know why this is happening and what the work around for this issue is. Hoping someone can help me out.

Thanks.
 
D

dlavigne

Guest
Try doing a force delete of gcc, then repeat the pkg install. To determine the name of the pkg to delete:

pkg info gcc (note name and version number)

pkg delete -f gcc-versionnumber (the -f forces the delete)
 

Raven9810

Dabbler
Joined
Jul 20, 2014
Messages
24
Thanks for the commands. I will try it tonight and see what happens.
Just to make sure... When I do the deletion of the current gcc, this is only deleting it from the particular Jail that I am in the shell of, correct?
 

Raven9810

Dabbler
Joined
Jul 20, 2014
Messages
24
Using the commands listed I was able to get CUPS to install in my jail. After it was installed, I followed what the freeBSD documentation says to do here http://www.freebsd.org/doc/en/articles/cups/printing-cups-configuring-server.html. When I get to the part about restarting devfs, I get a few warnings and it does not restart. I will post the warnings later tonight when I get home, but is there a step I am missing between installing CUPS and following the configuration changes listed int he link above?
 

Raven9810

Dabbler
Joined
Jul 20, 2014
Messages
24
Here are the Warnings I receive when attempting to restart devfs after making the configuration changes that the FreeBSD documentation includes:

devfs rule: ioctl DEVFSIO_RGETNEXT: Operation not permitted
/etc/rc.d/devfs: WARNING: devfs_init_rulesets: could not read rules from /etc/de
faults/devfs.rules
/etc/rc.d/devfs: WARNING: devfs_set_ruleset: you must specify a ruleset number
/etc/rc.d/devfs: WARNING: devfs_apply_ruleset: you must specify a ruleset

Why are these warning coming up and not allowing the restart?
 
D

dlavigne

Guest
Does this thread help? It goes on for a few responses looking at perms and rc.conf settings.
 

Raven9810

Dabbler
Joined
Jul 20, 2014
Messages
24
Unfortunately, that thread did not help me. I have adjusted the devfs.rule and rc.conf trying what that thread was using and I have also tried what the freebsd thread (mentioned above) said to do. I was finally able to get Cups to start correctly and get access to the web interface. I just cant start the /etc/rc.d/devfs correctly without those errors/warnings coming up. I may just look into a different solution for a print server.

Thanks.
 

Sethro

Cadet
Joined
Jan 16, 2015
Messages
3
Unfortunately, that thread did not help me. I have adjusted the devfs.rule and rc.conf trying what that thread was using and I have also tried what the freebsd thread (mentioned above) said to do. I was finally able to get Cups to start correctly and get access to the web interface. I just cant start the /etc/rc.d/devfs correctly without those errors/warnings coming up. I may just look into a different solution for a print server.

Thanks.

I apologize for responding to a somewhat old thread but I am fighting this same issue had also used the same install procedure you indicated. I've tried implementing the instructions suggested by several different "CUPS in Jails" articles for FreeBSD and FreeNAS (even NAS4Free). Unfortunately, I am not a power user as of yet to troubleshoot effectively.

Were you able to find a fix or did you discover a different print server port? Appreciate it very much and thanks!
 

maxbet

Dabbler
Joined
Oct 4, 2014
Messages
12

Sethro

Cadet
Joined
Jan 16, 2015
Messages
3
I had similar problems and solved with p910nd.

see this post : https://forums.freenas.org/index.php?threads/simple-print-server-how-to.23898/

Thank you for that!! I gave it a shot and failed then swung again and failed. Pretty sure it is a flaw within my lack of understanding. However, I gave that good ole CUPS another 10 hours of my life and my print device is talking!!! I successfully printed from the CUPS webgui and from an http printer via an MS Surface.

Everything I did is noted down and will gladly share if interested. It was literally all about those crazy "dev" permissions. Think it's going to require CRON if one reboots their NAS or unplugs the printer from USB often.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,946
Another option that requires less hacking.
If you have a DD-WRT WiFi router/acces point, or a WiFi Router/Access Point that you can flash DD-WRT on (I highly suggest it), and it has a USB port.
Just plug your printer into it, then on the Services tab enabled USB and Printer support. That'll start p910nd on the there. You then point your computer to DD-WRT's IP, and it interfaces over IP with the native driver.

I've setup Linux/Windows/and OSX using this method before. I prefer it because the spooling/native driver is on the client computer, and it's actually pretty simple elegant once you get it setup.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Everything I did is noted down and will gladly share if interested. It was literally all about those crazy "dev" permissions. Think it's going to require CRON if one reboots their NAS or unplugs the printer from USB often.
I would absolutely want to see your process. I have CUPS working in a 9.2 jail, but have only used it to print to pdf. If enjoy being able to print to the actual printer.
 

Sethro

Cadet
Joined
Jan 16, 2015
Messages
3
Alright gang, my notes are below regards to CUPS via a Jail. Look, I am no expert here so feel free to point out anything that is wrong. I have printed all sorts of documents from various programs without a hiccup thus far from my Windows 8.1 tablet. If anyone has a suggestion on how to systematically apply the permissions directly below (since /etc/devfs.rules seem to never work - at least for me), it would be much appreciated!

root@printsvr:/dev # chmod -R 0770 usb*
root@printsvr:/dev # chmod -R 0660 ugen*
root@printsvr:/dev # chmod -R 0660 unlpt*
root@printsvr:/dev # chmod -R 0660 ulpt*
root@printsvr:/dev # chown -R root:cups ugen*
root@printsvr:/dev # chown -R root:cups usb*
root@printsvr:/dev # chown -R root:cups unlpt*
root@printsvr:/dev # chown -R root:cups ulpt*


Here we go and assuming one can use the VI text editor:
Print Server (CUPS):

New Jail & SSH-Enable (via Jail Shell - NOT FreeNAS Core Shell ):
  • Create "standard" Jail
  • Set new 'root' password via passwd
CUPS Installation (via Jail Shell):
  • Execute pkg upgrade
  • Execute portsnap fetch
  • Execute portsnap extract
  • Execute pkg install print/cups-pstoraster
  • Execute pkg install print/cups-base
  • Execute pkg install cups
  • Execute pkg install print/gutenprint-cups
  • Execute pkg install print/hplip
  • Validate the ‘cups’ group exists by executing pw group show cups (if not then create)
  • Execute pw group mod cups -m root
  • Execute vi /etc/devfs.rules (this is questionable)
    • Copy and paste the following, save file:
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
add path 'usb*' mode 0770 group cups
add path 'ugen*' mode 0660 group cups

  • Execute vi /etc/rc.conf
    • Set devfs_system_ruleset="system"
    • Set cupsd_enable="YES"
    • Set hostname accordingly
  • Execute /etc/rc.d/devfs restart (will most likely return a permission error as noted by Raven9810 a few threads above)
  • Execute vi /usr/local/etc/cups/mime.types
    • Uncomment application/octet-stream
    • Save changes
  • Execute vi /usr/local/etc/cups/mime.convs
    • Uncomment application/octet-stream
    • Save changes
  • Execute vi /usr/local/etc/cups/cupsd.conf
    • Insert all lines as seen in bold below within the correct code blocks:
Listen *:631
...
# Restrict access to the server...
<Location />
Order allow,deny
Allow @LOCAL
</Location>
# Restrict access to the admin pages...
<Location /admin>
Order allow,deny
Allow @LOCAL
</Location>
# Restrict access to configuration files...
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow @LOCAL
</Location>

  • Execute /usr/local/etc/rc.d/cupsd restart
  • Apply permissions as seen directly below. This will need done when the server is rebooted, when the print device is power cycled, or when the usb cable is unplugged. I havent figured out how to automate intelligently yet. :)
  1. Execute /dev # chmod -R 0770 usb*
  2. Execute /dev # chmod -R 0660 ugen*
  3. Execute /dev # chmod -R 0660 unlpt*
  4. Execute /dev # chmod -R 0660 ulpt*
  5. Execute /dev # chown -R root:cups ugen*
  6. Execute /dev # chown -R root:cups usb*
  7. Execute /dev # chown -R root:cups unlpt*
  8. Execute /dev # chown -R root:cups ulpt*
  • You should be able to bring up the CUPS webgui and configure a printer and hopefully lay some ink.
I downloaded the HPLIP tarball for FreeBSD, click here, and used 7Zip to find\extract the PPD for my HP Deskjet 1660. I used this PPD when setting up the printer in CUPS as none of the "built-in" drivers seemed to play nicely. Here is where I found that PPD file inside the .tar: **\hplip-3.14.10.tar\hplip-3.14.10\hplip-3.14.10\ppd\hpcups

GOOD LUCK!!!

Sources:
https://www.freebsd.org/doc/en/articles/cups/index.html
http://www.freshports.org/print/cups/
https://www.kaisblog.de/2014/08/27/airprint-jail-freenas/
https://forums.pcbsd.org/showthread.php?t=12140
 

keithg

Explorer
Joined
May 15, 2013
Messages
75
Thank you for that!! I gave it a shot and failed then swung again and failed. Pretty sure it is a flaw within my lack of understanding. However, I gave that good ole CUPS another 10 hours of my life and my print device is talking!!! I successfully printed from the CUPS webgui and from an http printer via an MS Surface.

Everything I did is noted down and will gladly share if interested. It was literally all about those crazy "dev" permissions. Think it's going to require CRON if one reboots their NAS or unplugs the printer from USB often.
Please list your solution. I am pulling my hair out getting this running. I can see the cups web interface and have configured a PDF printer as a start, but nothing prints. I want to print to a parallel printer and also have a shared PDF printer so that I can print pdfs to a cifs shared folder.

I have read and executed all this faithfully but cannot get even a PDF to show up in the spool folder. From the CUPS interface, I get "stopped "Filter failed"" in the job list and nothing shows in /var/spool/cups-pdf/root or ANONYMOUS. The logs do not seem to show any errors other than:

...
D [18/Mar/2015:08:34:54 -0500] [Client 13] GET /admin/log/error_log HTTP/1.1
D [18/Mar/2015:08:34:54 -0500] cupsdSetBusyState: newbusy="Active clients", busy="Not busy"
D [18/Mar/2015:08:34:54 -0500] [Client 13] No authentication data provided.

Any help?

Keith
 
Last edited:

keithg

Explorer
Joined
May 15, 2013
Messages
75
Reinstalled and tried again following every step. The only difference is that I also installed cups-pdf. I get to the admin screen, try to print a PDF and get:

D [18/Mar/2015:14:38:19 -0500] [Job 3] End of messages
D [18/Mar/2015:14:38:19 -0500] [Job 3] printer-state=3(idle)
D [18/Mar/2015:14:38:19 -0500] [Job 3] printer-state-message="Filter failed"
D [18/Mar/2015:14:38:19 -0500] [Job 3] printer-state-reasons=none
E [18/Mar/2015:14:43:20 -0500] [Job 3] Stopping unresponsive job.

Looks like a permissions problem, but I am stumped as to how to diagnose it.

EDIT - Tried it again and am now getting PDFs. Previously, I was trying to put it in my vbox virtual machine and it did not work. Put it in my freebsd jail and it works, though I am still getting filter failed though the prints are being made as pdfs...
 
Last edited:

keithg

Explorer
Joined
May 15, 2013
Messages
75
Update: it looks like /dev/lp driver is no longer loaded with 9.3. I have a usb/parallel adapter and was able to print to my lj6l using these instructions. The devices are loaded at start of the jail, but the permissions need to be reset every time it is booted. I will try to figure out how to automate this so every time it reboots that we get the printer served.

Next issue - get it to advertise on the network. Avahi has some issue and the dnssd package does as well.

Keith
 

keithg

Explorer
Joined
May 15, 2013
Messages
75
So, googled around and found that if you create an /etc/rc.local in the jail with teh following lines in it, cups survives a restart

# change permissions in jail for printer
chmod -R 0770 /dev/usb*
chmod -R 0660 /dev/ugen*
chmod -R 0660 /dev/unlpt*
chmod -R 0660 /dev/ulpt*
chown -R root:cups /dev/ugen*
chown -R root:cups /dev/usb*
chown -R root:cups /dev/unlpt*
chown -R root:cups /dev/ulpt*
 

keithg

Explorer
Joined
May 15, 2013
Messages
75
And... We're back!!! Latest update for FreeNas breaks it for me. Been working since 2013. The problem I am having is getting the usb devices shared with the jail. My printer shows up in the log on the host as:
Code:
ulpt0: <vendor 0x1a86 USB2.0-Print, class 0/0, rev 1.10/2.54, addr 2> on usbus2
...
ugen2.2: <vendor 0x1a86> at usbus2 (disconnected)
ulpt0: at uhub2, port 1, addr 2 (disconnected)
ugen2.2: <vendor 0x1a86> at usbus2
ulpt0: <vendor 0x1a86 USB2.0-Print, class 0/0, rev 1.10/2.54, addr 2> on usbus2
ulpt0: using bi-directional mode

In the Jail, no USB devices show up. My configs in the jail have not changed. Based on this thread My configs on the host are currently:
/etc/devfs.rules
Code:
[usbrules=100]
add path 'usbctl' mode 660 group uucp
add path 'usb/*' mode 660 group uucp
add path 'ttyU*' mode 660 group uucp

[jail_devfs=110]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
add path 'usb/2.2.0' mode 0660 group cups

/etc/rc.conf
Code:
...
jail_FreeBSD_devfs_ruleset="110"
devfs_load_rulesets="YES"


when I restart devfs (service devfs restart) I get no errors and still no usb devices in the jail. WHen I use LP and print to the printer fron the host, it works. I just need to figure out why my host will not show the USB devices to the jail.
 
D

dlavigne

Guest
There was a commit, which is being reverted for U2, which broke jails. I suspect this is what is biting you.
 
Status
Not open for further replies.
Top