Thermal printer service doesn't start

After installing and upgrading a bunch of packages on my A06 in order to get Blender working, I found that my thermal printer no longer works. I found that the devterm-printer service is failing to start. My dmesg log contains the following:

/etc/systemd/system/devterm-printer.service:3: Failed to add dependency on devterm-socat, ignoring: Invalid argument

The devterm-socat service (which creates a virtual serial port for the printer) does appear to be working as normal. My devterm-printer.err.log contains this:

Oops: Unable to determine board revision from /proc/device-tree/system/linux,revision
or from /proc/cpuinfo
→ No “Hardware” line
→ You’d best google the error to find out why.

I’ve looked into this and it seems it’s an error with wiringPi. After hours of looking through various logs, recompiling and reinstalling the devterm-printer driver, the cups driver, and wiringPi, from the ClockworkPi github, I have kind of hit a brick wall. I probably need to look deeper and learn more about wiringPi if I want to solve this, but if anybody has any wisdom to share about why this might be happening–or maybe how to find all the dependencies of the thermal printer–I would appreciate it!

just run

/usr/local/bin/devterm_thermal_printer.elf

and paste the errors here, let’s find out why

Thanks for the guidance! It gives the same error as the log:

Oops: Unable to determine board revision from /proc/device-tree/system/linux,revision
or from /proc/cpuinfo
→ No “Hardware” line
→ You’d best google the error to find out why.

This does seem to be a wiringPi error, I think?

where you install the wiringPI ?

is it from
sudo apt install devterm-wiringpi-cpi -y ?

Oops! No, I compiled it with ./build from the ClockworkPi github. I removed it and installed it from apt now per your instructions. Now the driver gives me this error:

/usr/local/bin/devterm_thermal_printer.elf: error while loading shared libraries: libwiringPi.so.2: cannot open shared object file: No such file or directory

Getting closer! I’ll keep looking, and I’ll appreciate your help if you have any other tips!

try

ldd /usr/local/bin/devterm_thermal_printer.elf

and paste the results

let’s find out where the .so will be loaded

Here’s the output:

linux-vdso.so.1 (0x0000ffff7ff6d000)
libwiringPi.so.2 => not found
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffff7fe57000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff7fcda000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff7ff3a000)

I do have libwiringPi.so.2.50 in /lib, but not libwiringPi.so.2.

OK, I made a link to libwiringPi.so.2.50 and restarted devterm-printer, then did echo -en “\x12\x54” > /tmp/DEVTERM_PRINTER_IN. It worked! Test print successful.

However, I still can’t print from the shell (from the “Print” command in Firefox, for example.) In the Printers menu, any print jobs become “Held” and it shows an error message that the printer “may not be connected.”

I don’t know where to begin with this one–I guess this is an issue with the cups driver?–so any help would be much appreciated. And thanks so much for your help so far, @guu !

1 Like

perhaps reinstall

devterm-thermal-printer-cups ?

sudo apt install -y devterm-thermal-printer-cups 

Don’t use this GitHub - clockworkpi/WiringPi: Gordon's Arduino wiring-like WiringPi Library for the Raspberry Pi (Unofficial Mirror for WiringPi bindings) I don´t know why its added to the repo.

As you can see the error comes from here , and the CPI WiringPi has those values hardcoded

Use this WiringPi cd into wiringPi and make install

cd wiringPi
make install
2 Likes

I have the same issue with printer from the system/browser GUI, but I can still echo something to /tmp/DEVTERM_PRINTER_IN and it prints correctly.

I got frustrated and reimaged, then found out installing snapd can cause this(I don’t know how yet).

@guu So far I haven’t had any luck uninstalling and reinstalling devterm-thermal-printer-cups and/or cups itself. Thanks for the tips, though!

@Petrakis Oh, interesting! I’ll give this a try. Thanks!

@marrrk Wow, I would have never guessed it was an issue with snapd. I’ll be looking into it too, I’ll let you know if I figure anything out.

Ok for the snapd case I think it’s the apparmor(snapd dependent package) causing cups not working properly,

[ 26.259166] audit: type=1400 audit(1638854668.916:29): apparmor=“DENIED” operation=“capable” profile="/usr/sbin/cupsd" pid=1787 comm=“cupsd” capability=12 capname=“net_admin”

I fixed the apparmor issue by adding

# devterm printer
/tmp/DEVTERM_PRINTER_IN wr,
/dev/pts/1 wr,

to /etc/apparmor.d/usr.sbin.cupsd within block

/usr/sbin/cupsd flags=(attach_disconnected) {}

Devterm should ship that apparmor rule as part of the printer package

7 Likes

nice tips ,marked ,thanks bro

1 Like

Amazing, thank you so much @marrrk!

Very happy I posted this topic, I appreciate all the assistance.

2 Likes

Ah! This got it to work, Thank you : >!

Hi marrrk, I tried to update the file, but I dont have the permission (readonly). how to do that?

Use sudo in order to open it!

I fixed it with chmod 777

1 Like