2

I have a setup that worked fine (on Synology NAS), until a recent update.

lp can apparently not print, even though the printer seems to exist okay:

$ lpstat -p -d
printer HP8210 is idle.  enabled since Fri 25 Feb 2022 11:35:36 AM CET
printer HP8740 is idle.  enabled since Mon 28 Feb 2022 10:28:47 AM CET

$ ls -l /opt/bin/lp 
-rwxr-xr-x 1 root root 18568 Oct  7  2018 /opt/bin/lp

$ /opt/bin/lp -d HP8740
/opt/bin/lp: No such file or directory

$ echo "foo" | /opt/bin/lp -d HP8740 2>&1
/opt/bin/lp: No such file or directory

I assume that "No such file or directory" means that something is incorrect regarding the printer/device configuration? It is reported here as an incorrect/inadequate output: https://bugzilla.redhat.com/show_bug.cgi?id=1811716

Looks lpr works fine, though.

How can that be troubleshot?

Edit: Added ls output, lpr output, and link to issue reported against lp on the output message.

Dennis Thrysøe
  • 121
  • 1
  • 4
  • output of `which lp` please – mashuptwice Feb 28 '22 at 11:57
  • The fact that the `lpstat` command exists suggests that the `lp` command is very likely present too, however after the update it may no longer be located at `/opt/bin/lp`. Try `type lpstat lp`: it should reveal the full pathname of `lpstat`, and also of `lp` if it is in any directory listed in the `PATH` environment variable. – telcoM Feb 28 '22 at 12:12
  • 1
    Have you tried using just `lp` instead of `/opt/bin/lp`? What is the output of `type -a lp` and what is the output of `type -a lpstat`? – terdon Feb 28 '22 at 12:26
  • @mashuptwice which lp gives no output, but it exists in /opt/bin and it works when invoked without -d. – Dennis Thrysøe Feb 28 '22 at 12:59
  • @telcoM lp is not in the path, but it does exist in /opt/bin – Dennis Thrysøe Feb 28 '22 at 13:00
  • @terdon output of "type -a lp" is "type: lp: not found" – Dennis Thrysøe Feb 28 '22 at 13:03
  • Please [edit] your question and add the answers to any questions in the comments. Also, if you say `lp` is there in `/opt/bin`, please show us the output of `ls -l /opt/bin/lp`. – terdon Feb 28 '22 at 13:13
  • I think a better command to run would be `find / -name lp`, just in case it's not where it is expected. – Bib Feb 28 '22 at 13:14
  • @Bib of course, but since that can take several hours on large disks (and this is a NAS, so almost certainly both large and slow), that is a last resort. – terdon Feb 28 '22 at 13:22

1 Answers1

1
/opt/bin/lp: No such file or directory

This says that there was an error trying to execute that program. At first glance, the error appears to say the program does not exist, but since you showed that it does, the other way you can get this error is if one of the shared libraries the program depends on does not exist. You can run ldd /opt/bin/lp to get a list of the shared libraries it needs and figure out which one of those is missing.

psusi
  • 17,007
  • 3
  • 40
  • 51
  • Interesting. Unfortunately ldd is not present on the system, and I don't see a way to get it there. So I am unable to solve it that way. However in this specific case it turns out `/bin/lpr` does seem to work, so that is a workaround in this case. – Dennis Thrysøe Mar 01 '22 at 12:59
  • @DennisThrysøe, you might try running `LD_DEBUG=libs /opt/bin/lp` and see what that says. – psusi Mar 03 '22 at 19:47
  • that doesn't say much. Looks like normal and successful finding of libraries, calling init, and then calling fini on all libraries. The message "No such file or directory" is output during `lp` running - after the last init, before the first fini. Hmm. – Dennis Thrysøe Mar 04 '22 at 20:51
  • @DennisThrysøe, oh, that is weird. Maybe try running it under `strace`? – psusi Mar 07 '22 at 15:34
  • `strace`is unfortunately not available on the system. Quite a weird case. But since I found a workaround in using `lpr`in this case, I am not going to put more work into it. – Dennis Thrysøe Mar 09 '22 at 07:33