# Printer support



## stream (Feb 18, 2018)

Hi there!

I have had a very hard time connecting my Canon printer (MF 4150). Tried several things outlined in the official doc, and some online threads.

The printer is connected directly to the desktop which runs Freebsd 11, via USB port.

Here is the output of the dmesg.

```
ulpt0: <Canon Inc. MF4100, class 0/0, rev 2.00/1.00, addr 5> on usbus0
ulpt1: <Canon Inc. MF4100, class 0/0, rev 2.00/1.00, addr 5> on usbus0
ugen0.6: <Canon Inc. MF4100> at usbus0 (disconnected)
ugen0.6: <Canon Inc. MF4100> at usbus0
ulpt0: <Canon Inc. MF4100, class 0/0, rev 2.00/1.00, addr 6> on usbus0
ulpt1: <Canon Inc. MF4100, class 0/0, rev 2.00/1.00, addr 6> on usbus0
```

I installed cups also, and tried adding the canon MF4150. But the Gutenprint driver does not have a specific driver. Experimented with some alternatives, such as Pixma MG 4100 series, and added printer. That didn't work-  when I print a doc (sample text file or online pdf doc), it does nothing.

 Am not really sure how to debug this, and get around this. Can you folks suggest some options, and/or alternatives to get this printer (MF4150) to work with Freebsd.

Thank you


----------



## stream (Feb 19, 2018)

One other thing I tried. Using linux compatibility mode, I extracted the linux driver RPM package, obtained from Canon site.
And then uploaded the CNCUPSMF4100ZS.ppd, directly instead of gutenprint.

But now, I get an error:  "File "/usr/local/libexec/cups/filter/pstoufr2cpca" not available: No such file or directory"

 Appreciate any help, inputs you can suggest to resolve this.


----------



## scottro (Feb 19, 2018)

Does it work with Linux?  (I know that in the past, there's been lots of problems with Canon printers and Linux). If so, you might be able to use a Linux ppd.  If it uses postscript, then you may be able to just use that.


----------



## leebrown66 (Feb 19, 2018)

There is a manual for the Linux driver here which indicates it should handle PostScript.  Maybe there's a generic PS driver you could try.


----------



## Oko (Feb 19, 2018)

stream You first stop should have being OpenPrinting database. Quick search indicates that all-in-one device should be fully supported including scanning.

http://www.openprinting.org/printer/Canon/Canon-i-Sensys_MF4150_AKA_imageCLASS

I took a clue from one of the comments and found PPD (PostScript Printer Description) file for you.

https://github.com/vicamo/cndrvcups-lb/blob/master/ppd/CNCUPSMF4100ZS.ppd

That is any easy read and it looks like that is a PostScript printer which supports PostScript level 3. The information I left you should be sufficient for you to set up the printer. If you are not following what I am taking about FreeBSD might not be for you (at least not before you do some serious studying).



stream said:


> One other thing I tried. Using linux compatibility mode, I extracted the linux driver RPM package, obtained from Canon site.
> And then uploaded the CNCUPSMF4100ZS.ppd, directly instead of gutenprint.
> 
> But now, I get an error:  "File "/usr/local/libexec/cups/filter/pstoufr2cpca" not available: No such file or directory"
> ...


You can't use Linux drivers on FreeBSD. Linux compatibility is for userland programs only and should be removed anyway. Linux and FreeBSD have also very different drivers' API.


----------



## stream (Feb 19, 2018)

Thanks guys.

Scottro- no I didn't try in linux.

Oko- apologies for not being clear in the second post. Yes, I did look at that openprinting link.  I searched for and wanted to get that CNCUPSMF4100ZS.ppd. That's what prompted me to download the linux driver from Canon website, extract the .rpm package using linux rpm command to get to that ppd file. So I went to linux compat mode, and extracted using *rpm2cpio. *

By the way, the CNCUPSMF4100ZS.ppd file you suggested is what I had previously- identical.

This time around, I turned off linux now to make sure there are no conflicts, and rebooted the machine.
After uploading  CNCUPSMF4100ZS.ppd in the CUPS administration page, I added the printer back. Tried to print a sample doc. Unfortunately, got hit with the same error "File "/usr/local/libexec/cups/filter/pstoufr2cpca" not available: No such file or directory".

This cups error logs same as last time:
E [18/Feb/2018:23:22:16 -0500] Canon_MF4100_Series: File \"/usr/local/libexec/cups/filter/pstoufr2cpca\" not available: No such file or directory
E [18/Feb/2018:23:22:16 -0500] [Job 4] Unable to start filter "pstoufr2cpca" - No such file or directory.

Maybe I'm doing something wrong?


----------



## xchris (Feb 19, 2018)

stream : if you installed the linux compat libraries, you may need too the  linux-c7-cups-libs (or linux-c6-cups-libs), I had similar issues with my samsung scx, plus I had to copy some files (filters) from the  linux driver to the linux compat directory, looks like the linux-*-cups uses them if you install the ppd file.


----------



## shepper (Feb 19, 2018)

It is not clear that the MFC 4150 is Postscript capable.  The Manufacturers website https://www.usa.canon.com/internet/...imageclass-mf4150?tab=technicalspecifications does no specifically list the supported Printer Languages.

A CNET review https://www.cnet.com/products/canon-imageclass-mf4150/specs/ gives the following


> Printer Drivers / Emulations UFRII LT



This debian page https://wiki.debian.org/PrinterDriver/Canon/UFR-II describes the UFRII driver needs 32bit linux libraries.  It also provides download links.

From this, I would suggest that you will need 32bit LInux emulation to run this in FreeBSD.


----------



## ralphbsz (Feb 19, 2018)

That printer is usable on the Mac, with a downloadable driver.  The Mac uses a version of CUPS.

Here is a suggestion: Create a very small virtual machine.  In that VM, install Linux, with CUPS, and with the downloaded Linux driver for this printer.  Then print over the network (via lpr/lpd) to that Linux virtual machine.  Another way to accomplish this would be to get a raspberry pi (about $20), install Linux on it, and use it as a printer adapter.


----------



## stream (Feb 19, 2018)

Thanks all for the suggestion.

ralphabsz:  linux VM is my last option if this doesn't work. would prefer to run FreeBSD though.

xchris: I uninstalled linux-c6, and installed linux-c7, to see if that works.

shepper: Thanks for the debian link. Strange I found  pstoufr2cpca file in the Debian part of the Canon tar file. PTo extract that I had to use deb2targz.

Anyway, now the pstoufr2cpca file error is gone. But I get a different error:

279 D [19/Feb/2018:16:21:00 -0500] [Job 13] Canon_MF4100_Series: error while loading shared libraries: libdbus-1.so.3: cannot open shared object file: No such file or directory

However, dbus is alread installed, and up to date. for example, here is the /usr/local/lib
libdbus-1.so.3 -> libdbus-1.so.3.14.10
libdbus-1.so.3.14.10


----------



## stream (Feb 19, 2018)

Actually, I also installed linux-c7-dbus-libs, that seems to be resolving the libdbus-1.so error above. 
Now, the printer just does not print, but logs show this error

pstoufr2cpca write error,9


Anything I can do here?


----------



## shepper (Feb 19, 2018)

stream said:


> Anyway, now the pstoufr2cpca file error is gone. But I get a different error:


In the Debian link, it describes installing 


> sudo apt-get install libc6-i386 libxml2:i386 lib32z1 libjpeg62:i386 libstdc++6:i386


.

Maybe the devel/linux-c7-devtools will take care of some dependencies.  Not sure where you will get "libxml2:i386"


----------



## stream (Feb 20, 2018)

shepper: Unfortunately, devel/linux-c7-devtools did not help. I get the same error.


----------



## stream (Feb 20, 2018)

Oko said:


> stream You first stop should have being OpenPrinting database. Quick search indicates that all-in-one device should be fully supported including scanning.
> 
> http://www.openprinting.org/printer/Canon/Canon-i-Sensys_MF4150_AKA_imageCLASS
> 
> ...



Oko: I'd like to make sure I haven't missed anything here for OpenPrinting. Can you elaborate on your comment. What steps are necessary to get the printer to work in FreeBSD, without any linux drivers. I uploaded the CNCUPSMF4100ZS.ppd file in the cups URL. Do you suggest nay other installation/uploading? As Shepper mentioned above, this printer does not use postscript directly. It needs conversion of ps to ufr2 format- something specific to Canon.


----------



## Oko (Feb 20, 2018)

stream said:


> Oko: I'd like to make sure I haven't missed anything here for OpenPrinting. Can you elaborate on your comment. What steps are necessary to get the printer to work in FreeBSD, without any linux drivers. I uploaded the CNCUPSMF4100ZS.ppd file in the cups URL. Do you suggest nay other installation/uploading? As Shepper mentioned above, this printer does not use postscript directly. It needs conversion of ps to ufr2 format- something specific to Canon.


If it is not PostScript printer you are out of luck my friend. Generally speaking there are few collection of open source printer drivers for Linux and BSDs. They are contained in the following packages: GhostScript,  Gutenprint, hpijs (HPLIP), and splix. There are also bunch of binary blob Linux specific drivers like those Brother provides for its cheap junk. While there are many very nice reliable non-post script printers (I used a HP LaserJet 4L for more than 10 years), rule of the thumb is that any serious device will speak PostScript and it will not need driver at all. Once you found yourself looking for a stupid driver you are better off going to local store and getting yourself a new device. I personally really like Brother monochromatic laser printers. At work I use HL-5100DN and at home I have HL-5250DN. Both printers don't require any drivers. 15-20 years ago I would recommend HP but no longer.


----------



## xchris (Feb 20, 2018)

stream said:


> Actually, I also installed linux-c7-dbus-libs, that seems to be resolving the libdbus-1.so error above.
> Now, the printer just does not print, but logs show this error
> 
> pstoufr2cpca write error,9
> ...



did you add the user to cups group?


----------



## stream (Feb 21, 2018)

xchris said:


> did you add the user to cups group?



thanks for the tip. I just did, and rebooted system, along with a fresh cups install.
Now, I dont get the write error. Instead the following in the error logs:

>>
execv failed: Exec format error
(/usr/local/libexec/cups/filter/pstoufr2cpca) stopped with status 108 (Exec format error)

The above was because I had not loaded linux in the kernel.
After kldload linux, and kldload linux64, and restarting cups:

I get the same error. 

_"pstoufr2cpca write error,9."_


----------



## ralphbsz (Feb 21, 2018)

Error 9 is EBADF.  Sounds like someone is not opening up some file-like resource.  I think it's time to pull up the source code of this utility, find the line that prints the error, and figure out what could lead to EBADF in that place.


----------



## stream (Feb 22, 2018)

ralphbsz said:


> Error 9 is EBADF.  Sounds like someone is not opening up some file-like resource.  I think it's time to pull up the source code of this utility, find the line that prints the error, and figure out what could lead to EBADF in that place.



What particular file are you referring to? The pstufr2cpca is a text file, having a bunch of paper/font setting. And in turn points to some drivers. That's way beyond me.. and even then, not sure if I'm going to be lucky with a decent solution. I like the raspberry pi idea you suggested- am going to invest some time to get that working..


----------



## Deleted member 9563 (Feb 22, 2018)

Perhaps I missed something in the thread, but if this printer doesn't have a driver and it isn't postscript, then it's not going to work. Somebody with the skills could perhaps write a driver, but barring that it's just not going to work. So, I guess my point here is "what's the point"?


----------



## stream (Feb 22, 2018)

OJ said:


> Perhaps I missed something in the thread, but if this printer doesn't have a driver and it isn't postscript, then it's not going to work. Somebody with the skills could perhaps write a driver, but barring that it's just not going to work. So, I guess my point here is "what's the point"?



You maybe right after all.. Can't tell if there is any point to all this. But my hope is someone may have thought of a simple workaround- Canon is not a nameless brand.
But am confused when you say there is no driver or that this printer is not postscript- the CNCUPSMF4100ZS.ppd file acts as the cups printer "driver", and the pstoufr2cpca file should in principle "filter" the non standard PS file into a postscript-like language that the printer understands..  Somewhere along the process something is broken. Anyway, for now, I've given up on the freebsd route for printing Canon.

Thank you all for contributing.


----------



## Deleted member 9563 (Feb 22, 2018)

stream said:


> But am confused when you say there is no driver or that this printer is not postscript


What I mean is that there is no driver for that printer. The driver has to be specifically for a Canon MF4150, not some other printer. Only that one. Either that or the printer needs to support postscript. I'm sorry, I can't make it any clearer than that. I don't know the program you pointed to, but I don't see Canon MF4150 mentioned there so I can't see it of being of any use. As for postscript, it will say in the printer docs. I checked the technical specs quickly and don't see it mentioned. I also don't see the word "linux" in the docs which is usually a quick search to see if a printer will work for open source. 

Personally, I avoid Canon like the plague. They're not friendly to us. HP is often a reasonable choice, and there are others. I think they were mentioned up above. Canon being a very well known brand is not the issue. The thing is that they have no respect for us and steadfastly make big-market proprietary drivers only. To write a driver someone needs to get some key pieces of information from Canon and they're not going to give that out - so it's just not going to happen.


----------



## ralphbsz (Feb 22, 2018)

stream said:


> What particular file are you referring to?


I was suggesting debugging the source code: Find out exactly what program / module / function prints that error message, and then figure out why it does that.  This would require reading the source code to a large part of the printer software stack (or at least grep'ing it for that message).  That's a lot of work, unless you have software development experience.  Probably not an efficient way to fix it.


----------



## shepper (Feb 22, 2018)

OJ said:


> Perhaps I missed something in the thread, but if this printer doesn't have a driver and it isn't postscript, then it's not going to work. Somebody with the skills could perhaps write a driver, but barring that it's just not going to work. So, I guess my point here is "what's the point


There is a linux driver and there are threads where linux drivers have been used in FreeBSD with a Linux emulation layer.

IMHO, this is a stitched-together, Frankenstein approach.  I recognize that not everybody can go out and drop a couple of C-notes on a printer and there is a sense of accomplishment from pounding a square peg into a round hole.

From the standpoint of fiddling, I thought the arm/rasberrypi based solution was kinda neat.  There is also a router based solution.  The LEDE/OpenWRT project has cups packages to install a printserver, with linux driver, on a router.  Just send your FreeBSD printjob as "raw" to the router print server

Edit:  After some additional thought, Pi/Arm and router solutions would not work as the binary blob from Canon is i386.


----------



## ralphbsz (Feb 22, 2018)

shepper said:


> Edit:  After some additional thought, Pi/Arm and router solutions would not work as the binary blob from Canon is i386.



Darn it, that makes it a bad idea.  Thank you for thinking about that.


----------



## stream (Mar 1, 2018)

Went ahead and ordered an HP network laser printer..

In the meantime, I have been fiddling with raspberry pi- tried couple of different operating systems- Arch linux, and Raspbian. Even though it is Debian based, the Canon driver did not install, because they are meant for x86 only, darn the pi are Arm chips! 

I also got another Canon printer MG5620 this is a wireless color inkjet. I did manage to get this working with the Pi print server. Gutenprint has some drivers for this printer, and installation was easy.  During installation, the Cups interface detected both the USB and the Network printer, and I chose the USB option, and the share-printer options.

Now  am trying to print to this network printer on my Freebsd client machine. Unfortunately, the localhost Cups does not detect the printer. During installation, the network printer shows nothing! I can ping to the Pi server just fine. 

Can the the experts here point me all the steps involved to get network printing up and running. I tried the online handbook/doc. That didnt work, I maybe doing something wrong. To recap, I'd like to print from freebsd 11 into the printer hosted in a raspbery pi print server, running raspbian.


----------



## ralphbsz (Mar 1, 2018)

With lpr/lpd this is easy: Configure lpd on the Raspbian Pi as usual, then in /etc/printcap on your "client" FreeBSD machine you just need the fields rm and rp; set them to the host name of the Raspian server and the queue name on that server.  I don't know how to do it with Cups though.


----------



## stream (Mar 4, 2018)

ralphbsz said:


> With lpr/lpd this is easy: Configure lpd on the Raspbian Pi as usual, then in /etc/printcap on your "client" FreeBSD machine you just need the fields rm and rp; set them to the host name of the Raspian server and the queue name on that server.  I don't know how to do it with Cups though.



Unfortunately, I still don't have any luck with the ras-pi print server setup.  Can you provide a concrete example of lpr/lpd. How do you setup lpd on the pi? I didn't find any online examples- they all seem to be cups based. And FreeBSD cups web site just does not list the network shared printer!

Also, my /etc/printcap follows the example laid out in http://www.wonkity.com/~wblock/docs/html/lpdprinting.html.
Am not sure that entirely applies here, because it assumes that the printer can accept raw data format. Do you suggest I do anything different?

```
lp:\
        :lp=:\
        :sh:\
        :mx#0:\
        :rm=192.168.1.33:\
        :rp=raw:\
        :sd=/var/spool/lpd/lp:\
        :lf=/var/log/lpd-errs:
```


----------



## ralphbsz (Mar 4, 2018)

stream said:


> How do you setup lpd on the pi?


It seems that Raspbian (=Debian) no longer ships lpr/lpd by default.  There is no lpd at all.  And all the other lp* utilities are part of cups.  Probably would have to first apt-get an lpr/lpd package.  A quick web search (60 seconds) didn't even find any supported version of lpd for Debian any longer.  Oops; maybe my advice to try lpr/lpd is not feasible, if Raspbian/Debian no longer supports it.



> I didn't find any online examples- they all seem to be cups based.


Here is a printcap stanza for a remote printer that uses lpd:

```
hp2055dn:\
        :lp=:\
        :rm=hp2055:rp=AUTO:\
        :sd=/var/spool/output/hp2055dn:\
        :lf=/var/log/lpd-errs:\
        :sh:
```



> Am not sure that entirely applies here, because it assumes that the printer can accept raw data format.


Why do you say that?  The "rp" string in here is name of the remote print queue, not the data format.


----------



## bxbzq (Apr 28, 2021)

I'm looking for solution to set up a canon iR2420 network printer in my office using either CUPS or lpd and this thread comes up.
Using CUPS, OP actually went further than I do as I couldn't find the pstoufr2cpca file, after looking for it on internet for half a day. I also tried to install cnrdrvcups-ufr2-uk-5.30-1.x86_64.rpm on my BSD machine and an ubuntu WSL platform, but the said file just isn't there. Maybe the installation isn't successful but I'm not sure as there was no sufficient info to tell.
Is there still some hope?


----------



## shepper (May 1, 2021)

bxbzq

In a nutshell, when you click print in an application, it generates a Postscript file that is feed through a spooler to the printer.  If the Canon iR2420 was Postscript (*.ps) capable it would print it.
According to Canon's Spec sheet under page description language:
https://www.canon.com.cy/for_work/p...ack_white/imagerunner_2420/specification.html



> Page Description Language(s)    UFRII-LT(Standard)



In order for you to print, Postscript needs to be filtered through a program, prior to the spooler, that changes *.ps to URFII-LT.
URFII-LT is proprietary and not open source.  Canon does provide Linux drivers but NO FreeBSD driver.  You may be able to use it by installing Linux emulation in FreeBSD but IMHO, that is a complex/bloated approach.


----------



## tuxador (May 1, 2021)

bxbzq said:


> I'm looking for solution to set up a canon iR2420 network printer in my office using either CUPS or lpd and this thread comes up.
> Using CUPS, OP actually went further than I do as I couldn't find the pstoufr2cpca file, after looking for it on internet for half a day. I also tried to install cnrdrvcups-ufr2-uk-5.30-1.x86_64.rpm on my BSD machine and an ubuntu WSL platform, but the said file just isn't there. Maybe the installation isn't successful but I'm not sure as there was no sufficient info to tell.
> Is there still some hope?


Normally the image runner 2420 does support apple's airprint. So using **ippeverywhere** with cusp should work out of the box.


----------



## decuser (May 1, 2021)

... and I thought my Brother MFC-8670DN was painful to set up - but at least it supports postscript, has a ppd that works, has ipp, and once you get it configured, works flawlessly since like 2008.


----------



## gpw928 (May 2, 2021)

ralphbsz said:


> It seems that Raspbian (=Debian) no longer ships lpr/lpd by default.  There is no lpd at all.  And all the other lp* utilities are part of cups.  Probably would have to first apt-get an lpr/lpd package.  A quick web search (60 seconds) didn't even find any supported version of lpd for Debian any longer.  Oops; maybe my advice to try lpr/lpd is not feasible, if Raspbian/Debian no longer supports it.


It's available on Buster:

```
[pi4.566] $ uname -a
Linux pi4 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l GNU/Linux
[pi4.567] $ cat /etc/debian_version
10.9
[pi4.568] $ apt-cache search lpd | grep "^lpr"
lpr - BSD lpr/lpd line printer spooling system
lprng - lpr/lpd printer spooling system
lprng-doc - lpr/lpd printer spooling system (documentation)
```


----------



## gpw928 (May 2, 2021)

shepper said:


> bxbzq
> In order for you to print, Postscript needs to be filtered through a program, prior to the spooler, that changes *.ps to URFII-LT.
> URFII-LT is proprietary and not open source.  Canon does provide Linux drivers but NO FreeBSD driver.  You may be able to use it by installing Linux emulation in FreeBSD but IMHO, that is a complex/bloated approach.


The latest CUPS Linux drivers for the Canon imageRUNNER 2420 support X86 and ARM.

As well as the common Linux packages, there is source code with "a CUPS filter module to convert a CUPS raster file into the UFR2/LIPSLX/UFR2 LT/CARPS2 printer readable form".  So, with some effort, it may be possible to port it to FreeBSD.

So the plausible options are:

a hardware Linux print server (if you buy a Pi4, get a CNC milled passively cooled case);
a virtual Linux print server; or
port the CUPS filter to FreeBSD.


----------



## bxbzq (May 6, 2021)

shepper said:


> bxbzq
> 
> In a nutshell, when you click print in an application, it generates a Postscript file that is feed through a spooler to the printer.  If the Canon iR2420 was Postscript (*.ps) capable it would print it.
> According to Canon's Spec sheet under page description language:
> ...


I have zero experience with linux emulator but I followed the instructions in the handbook and went as far as `# rpm2cpio < ~/cnrdrvcups-ufr2-uk-5.30-1.x86_64.rpm | cpio -id`. The message from shell is `148009 blocks`. I don't find the filter file pstoufr2cpca.
By the way, not sure if it's relevant, but the /etc/rc.d/ABI doesn't seem exist on my system. No idea why.


----------



## bxbzq (May 6, 2021)

tuxador said:


> Normally the image runner 2420 does support apple's airprint. So using **ippeverywhere** with cusp should work out of the box.



You mind sharing more? Obviously this ippeverywhere is not a port or pkg. Is it a script? How do I find and use it? Instructions would be great.


----------

