Giving a VM USB access, OR porting CUPS print server to a plugin?

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
I want to do some very, very light print serving (extremely light)

I've got this tiny handy little OrangePi Zero doing CUPS now and it's great, but I'd love to continue to remove devices from the house.
I googled a few months ago and I think I saw it being impossible to do CUPS easily on FreeNAS, however I'm wondering if 11.3 improved anything in that regard?

Anyone done this?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Why wouldn't you be able to install the standard FreeBSD CUPS package in a standard FreeNAS jail?

Kind regards,
Patrick
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
Can you do so? I could've sworn I read a thread, outlining why there's issues with it.
Any guides?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Setup Jail with VNET (i.e. dedicated network interface and IP address), configure until you can ssh into it or use iocage console, then pkg install cups and work from there.

I expect that the messy part will be how to get the USB device for your printer into the jail. Iocage has been a bit hard to convince to use user defined devfs rulesets and FreeNAS does not persist changes to /etc/devfs.rules, but nothing a small post-startup script won't be able to fix automatically on every boot.

Kind regards
Patrick
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
I'll look into this, hopefully it's not too difficult.

I feel like this should on the plugin list
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Which works great, BTW. I install avahi-app in all my jails, so I can simply ssh myjail.local

Kind regards,
Patrick
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
Taking a crack at this now, has anyone done it recently, some of these guides are over 6 years old.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Guide:

Create standard jail
Login to jail as root
pkg install cups
sysrc cupsd_enable=YES
service cupsd start

What sort of guide do you expect for basic FreeBSD system administration? As soon as the jail is up and running, inside the jail you have a standard FreeBSD system. That is the point. So to give you a more detailled guide:

HTH,
Patrick
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
Well so far I'm getting there.

Cups is installed, cups starts on reboot, the web interface is working, The devfs_ruleset is now 3.
However, I'm a little stuck adding my printer and actually knowing cups can 'see' it.



On the OLD system (linux, OrangePi Zero)
root@opizero:~# lpinfo -v
direct usb://DYMO/LabelWriter%20450%20Turbo?serial=XXXXXXXX

(Also, lsusb shows the device.)



On the FreeNAS jail.
root@cups:~ # lsusb
Bus /dev/usb Device /dev/ugen0.3: ID 0922:0021 Dymo-CoStar Corp.


Unfortunately, lpinfo -v produces no USB device?
root@cups:~ # lpinfo -v
network http
network lpd
network socket
network ipps
network https
network ipp
network beh
network lpd://BRWE89EB44D487B/BINARY_P1

I strongly suspect this is why I'm not getting anywhere.

Any tips? I recall the lpinfo -v string, being required at some point to help me add the device to Cups?
 
Last edited:

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Probably - I don't know and I honestly said I consider getting USB to work the tricky part ;) - you will need the ulpt driver for your printer. On the FreeNAS system (not the jail!) try
Code:
kldstat
kldload ulpt
kldstat
dmesg

To see if that does something reasonable. Then continue to tweak your devfs rules until you see the /dev/ulpt? device inside the jail.

If that gets you one step further, the loading of the kernel module can be automated via the UI.

HTH,
Patrick
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
Ok so got somewhere.

root@freenas[~]# kldstat
Id Refs Address Size Name
1 81 0xffffffff80200000 2566ff0 kernel
2 1 0xffffffff82768000 100ee8 ispfw.ko
3 1 0xffffffff82869000 fa60 ipmi.ko
4 2 0xffffffff82879000 2d70 smbus.ko
5 1 0xffffffff8287c000 32cc8 if_bnxt.ko
6 1 0xffffffff828af000 2243e8 if_qlxgbe.ko
7 1 0xffffffff82ad4000 f1440 ocs_fc.ko
8 1 0xffffffff82bc6000 22150 smartpqi.ko
9 1 0xffffffff82be9000 8a40 freenas_sysctl.ko
10 1 0xffffffff83111000 330048 vmm.ko
11 1 0xffffffff83442000 a84 nmdm.ko
12 1 0xffffffff83443000 2ec dtraceall.ko
13 9 0xffffffff83444000 39a78 dtrace.ko
14 1 0xffffffff8347e000 5c0 dtmalloc.ko
15 1 0xffffffff8347f000 1898 dtnfscl.ko
16 1 0xffffffff83481000 1d61 fbt.ko
17 1 0xffffffff83483000 53240 fasttrap.ko
18 1 0xffffffff834d7000 bcc sdt.ko
19 1 0xffffffff834d8000 6af0 systrace.ko
20 1 0xffffffff834df000 6ac8 systrace_freebsd32.ko
21 1 0xffffffff834e6000 f9c profile.ko
22 1 0xffffffff834e7000 39f4 geom_multipath.ko
23 1 0xffffffff834eb000 14320 hwpmc.ko
24 1 0xffffffff83500000 7140 t3_tom.ko
25 2 0xffffffff83508000 aa8 toecore.ko
26 1 0xffffffff83509000 f8d0 t4_tom.ko
27 1 0xffffffff83519000 12c8 ulpt.ko
28 1 0xffffffff8351b000 2420 ums.ko

but then:

root@freenas[~]# kldload ulpt
kldload: can't load ulpt: module already loaded or in kernel

The fact that ulpt.ko is in kldstat, means I don't need kldload ulpt to work, right? So that second command, not so bad that it failed?

This works

root@freenas[~]# dmesg | grep DYMO
ugen0.3: <DYMO DYMO LabelWriter 450 Turbo> at usbus0
ulpt0: <DYMO DYMO LabelWriter 450 Turbo, class 0/0, rev 2.00/1.12, addr 2> on usbus0
ugen0.3: <DYMO DYMO LabelWriter 450 Turbo> at usbus0 (disconnected)
ugen0.3: <DYMO DYMO LabelWriter 450 Turbo> at usbus0
ulpt0: <DYMO DYMO LabelWriter 450 Turbo, class 0/0, rev 2.00/1.12, addr 8> on usbus0
ugen0.3: <DYMO DYMO LabelWriter 450 Turbo> at usbus0 (disconnected)
ugen0.3: <DYMO DYMO LabelWriter 450 Turbo> at usbus0
ulpt0: <DYMO DYMO LabelWriter 450 Turbo, class 0/0, rev 2.00/1.12, addr 9> on usbus0



But dmesg doesn't work, in the cups jail.
dmesg: sysctl kern.msgbuf: Operation not permitted


Remember though

root@cups:~ # lsusb
Bus /dev/usb Device /dev/ugen0.3: ID 0922:0021 Dymo-CoStar Corp.

The cups jail, can see the dymo device


Finally, I just gooogled and found this command


root@cups:~ # lpinfo -m
lsb/local/cupsfilters/Fuji_Xerox-DocuPrint_CM305_df-PDF.ppd Fuji Xerox
drv:///sample.drv/dymo.ppd Dymo Label Printer
drv:///sample.drv/epson9.ppd Epson 9-Pin Series
drv:///sample.drv/epson24.ppd Epson 24-Pin Series
drv:///cupsfilters.drv/pwgrast.ppd Generic IPP Everywhere Printer
drv:///sample.drv/generpcl.ppd Generic PCL Laser Printer
lsb/local/cupsfilters/Generic-PDF_Printer-PDF.ppd Generic PDF Printer
drv:///sample.drv/generic.ppd Generic PostScript Printer
drv:///cupsfilters.drv/textonly.ppd Generic Text-Only Printer
lsb/local/cupsfilters/HP-Color_LaserJet_CM3530_MFP-PDF.ppd HP Color LaserJet CM3530 MFP PDF
lsb/local/cupsfilters/pxlcolor.ppd HP Color LaserJet Series PCL 6 CUPS
drv:///cupsfilters.drv/dsgnjt600pcl.ppd HP DesignJet 600 pcl, 1.0
drv:///cupsfilters.drv/dsgnjt750cpcl.ppd HP DesignJet 750c pcl, 1.0
drv:///cupsfilters.drv/dsgnjt1050cpcl.ppd HP DesignJet 1050c pcl, 1.0
drv:///cupsfilters.drv/dsgnjt4000pcl.ppd HP DesignJet 4000 pcl, 1.0
drv:///cupsfilters.drv/dsgnjtt790pcl.ppd HP DesignJet T790 pcl, 1.0
drv:///cupsfilters.drv/dsgnjtt1100pcl.ppd HP DesignJet T1100 pcl, 1.0
drv:///sample.drv/deskjet.ppd HP DeskJet Series
drv:///sample.drv/laserjet.ppd HP LaserJet Series PCL 4/5
lsb/local/cupsfilters/pxlmono.ppd HP LaserJet Series PCL 6 CUPS
drv:///sample.drv/intelbar.ppd Intellitech IntelliBar Label Printer, 2.1
drv:///sample.drv/okidata9.ppd Oki 9-Pin Series
drv:///sample.drv/okidat24.ppd Oki 24-Pin Series
raw Raw Queue
lsb/local/cupsfilters/Ricoh-PDF_Printer-PDF.ppd Ricoh PDF Printer
drv:///sample.drv/zebracpl.ppd Zebra CPCL Label Printer
drv:///sample.drv/zebraep1.ppd Zebra EPL1 Label Printer
drv:///sample.drv/zebraep2.ppd Zebra EPL2 Label Printer
drv:///sample.drv/zebra.ppd Zebra ZPL Label Printer
everywhere IPP Everywhere



Dunno if that's a good thing or not? I get the impression at least from my successful Armbian linux configuration, that it's best to have cups use HP Jetdirect via RAW (I think?!?!) to USB devices, then install the driver itself into Windows. I THINK ...?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
So the system probably loaded the ulpt.ko automatically when you plugged in your printer. Good. As far as the rest of your setup goes I am at the end of my wits without access to some similar hardware. If you have the device in your jail and CUPS installed, you should be able to make things work somehow.

Kind regards,
Patrick
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
Hmmmm it sounds like you've exhausted your ability to help, I do appreciate it though, thank you. I must be half way there.

I'll write a small guide when I get it going, but this last part is becoming time consuming sadly.


Almost tempted to do it all again on my orangepi, just to recall what's required.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
You probably found this already?
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
Well thank you, more information revealed, might be just a BSD vs linux thing, I dunno.

Either way, I got my answer, the device's 'private' USB url is identical to the linux machine after all
You actually want to head to here in the jail.
cd /usr/local/libexec/cups/backend/

Then run ./usb which is an executable (I had no idea)


DEBUG: Loading USB quirks from "/usr/local/share/cups/usb".
DEBUG: Loaded 95 quirks.
DEBUG: list_devices
DEBUG: libusb_get_device_list=8
DEBUG2: Printer found with device ID: MFG:DYMO;CMD: ;MDL:LabelWriter 450 Turbo;CLASS:PRINTER;DESCRIPTION:DYMO LabelWriter 450 Turbo;SERN:11041914265243; Device URI: usb://DYMO/LabelWriter%20450%20Turbo?serial=11041914265243
direct usb://DYMO/LabelWriter%20450%20Turbo?serial=XXXXXXXXX "DYMO LabelWriter 450 Turbo" "DYMO LabelWriter 450 Turbo" "MFG:DYMO;CMD: ;MDL:LabelWriter 450 Turbo;CLASS:PRINTER;DESCRIPTION:DYMO LabelWriter 450 Turbo;SERN:11041914265243;" ""



So the URL exists, now all that remains is confirming that the printer can actually be spoken to by cups, lots of people mention permissions issues, of which I have done _no_ work yet, so I'm expecting that'll be what's holding me back.
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
I have done further testing, making me more confident I'm doing the right thing.
Removed printer from Windows and the OrangePi entirely.

Re-added the printer on the Pi, settings are correct - USB path, raw mode, etc.
Added printer on Windows via "https://192.168.0.132:631/printers/Dymo" chose Dymo driver
Printed fine.

Same thing on the Cups jail, removed printer, re-added, same for Windows.

"processing since
Mon Feb 10 23:55:19 2020
"Waiting for printer to become available."

So I'm going to guess it's a permissions issue.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
I bet there's a debug flag to cupsd that produces more detailled logging ... ;)
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,374
Man the debug logs are massive :/ trawling through
 

racera4

Cadet
Joined
Feb 24, 2020
Messages
4
Have you figured it out?
I'm completely new to FreeBSD, much more experience in Linux, but I'm wanting to do the same thing as you.
Hope you're having some success that you can share!

Man the debug logs are massive :/ trawling through
 
Top