Monday, 10 December 2018

Filter failed error for Kyocera printers in Linux is caused by a BUG in the device driver

I recently got a new Kyocera FS-1025MFP unit and the print jobs would stop if there are Chinese characters in the job title. The OS is Ubuntu 16.04. Specifically, the error message was either "filter failed" or "filter crashed". Upon checking the CUPS error messages, I discovered that this was due to an error signal 6 returned by the "rastertokpsl" program shipped with the Kyocera driver.

To correct this problem:

1. Download, and install the Kyocera driver by running install.sh as root. This will copy the printer's PPD file to /usr/share/cups/model/Kyocera/ and the rastertokpsl program to /usr/lib/cups/filter/.

2. Create a wrapper for rastertokpsl by:
sudo nano /usr/lib/cups/filter/rastertokpsl-fixed
and then insert the following text:
#!/bin/bash
jobname=$(echo $3 | egrep -o '[[:alnum:]]' | tr -d '\n' | tail -c 20)
path=/usr/lib/cups/filter
$path/rastertokpsl "$1" "$2" "$jobname" "$4" "$5"
3. Make sure that the wrapper has execution permission:
sudo chmod a+x /usr/lib/cups/filter/rastertokpsl-fixed
4. Edit the PPD file specific to your printer model as found in /usr/share/cups/model/Kyocera/. For instance, mine is an FS-1025MFP and the file name is Kyocera_FS-1025MFPGDI.ppd. The only modification that should be made is the cupsFilter line (line 55 in my case):
Find:
*cupsFilter: "application/vnd.cups-raster 0 /usr/lib/cups/filter/rastertokpsl"
and replace the line with:
*cupsFilter: "application/vnd.cups-raster 0 /usr/lib/cups/filter/rastertokpsl-fixed"
The above steps should fix the problem. Alternatively, you may edit the PPD file shipped with the installation package and create the rastertokpsl-fixed wrapper for the installation files, and add the wrapper into install.sh so that you can be able to install the corrected driver with a single command.

I think the problem also affects FS-1040, FS-1060DN, FS-1020MFP, FS-1120MFP and FS-1125MFP, since they are using the same rastertokpsl program.

6 comments:

  1. printing of pdfs ok with this fix. however , faxes are not printed automatically upon reception when applying this fix.

    ReplyDelete
  2. Hello my friend. i have a similar printer. Kyocera FS-1325MFP. I have installed CUPS on my Raspberry Pi OS Lite (32-bit) and also installed the driver using install.sh. The printer is connected to my Pi via USB. My printer is also recognised. when I print a test page, the error message "filter failed" appears.

    I tried your instructions, created a rastertokpsl-fixed file and pasted the contents. I then modified my PPD file under /usr/share/cups/model/Kyocera/.

    I hope you can give me a tip. Greetings

    Translated with www.DeepL.com/Translator (free version)

    ReplyDelete
    Replies
    1. Did you remember to modify the printer setting in CUPS interface? Or just simply delete and add it back again

      Delete
  3. That was helpful. Thanks!

    ReplyDelete
  4. That works great for my Kyocera FS-1061DN as a network printer on MX Linux 21.3 (Debian Version 11.6) on KDE Plasma. Thank you very much for that instruction!

    ReplyDelete
  5. Hello, there is an Open Source Kyocera KPSL filter for CUPS on Github @ https://github.com/Fe-Ti/rastertokpsl-re/

    Just "apt install libcupsimage2-dev libcups2-dev" as root
    run "git clone https://github.com/Fe-Ti/rastertokpsl-re.git" in directory of your choice as user
    Run "cmake -B_build -H." as user
    Run "cmake --build _build/" as user
    Run "./install.sh" as root

    And in CUPS Web interface you can Load the original PPD of you printer Provide by Kyocera (For me is a french/Kyocera_FS-1041GDI.ppd)

    Thx!

    ReplyDelete