Open Pyrestone opened 2 years ago
Hi.
Thanks for reporting.
Zenity is showing the "proceed" window in manual_duplex_linux/usr/lib/cups/backend/duplex-print on line 68
I would bet something is wrong with zenity:
Let us know how it goes. Regards.
Same issue on Fedora 38. When i ran:
zenity --question --title="$title" \ --text="<big><b>Flip and reinsert the entire paper stack when printing has finished,\n\n then press Procceed.</b></big>\n\n\n\n Finding my work usefull? <a href='https://www.paypal.com/paypalme2/nanonetK3'>Click here to buy me a cofee.</a>"\ --icon-name="document-print" \ --window-icon "/usr/share/manual_duplex_linux/printer.png"\ --ok-label="Proceed" --cancel-label="Cancel" --display=:0.0 --no-wrap This option is not available. Please see --help for all possible usages.
The output was : This option is not available. Please see --help for all possible usages.
However, when i modified the command to this:
zenity` --question --title="$title" \ --text="<big><b>Flip and reinsert the entire paper stack when printing has finished,\n\n then press Procceed.</b></big>\n\n\n\n Finding my work usefull? <a href='https://www.paypal.com/paypalme2/nanonetK3'>Click here to buy me a cofee.</a>"\ --ok-label="Proceed" --cancel-label="Cancel" --no-wrap
It actually shows the window, but when i apply the same modifications to the backend file, it refuses to work.
So I tried making a shell script to test zenity.
When i ran this script:
``#!/bin/bash
if zenity --question --title="$title" \ --text="Flip and reinsert the entire paper stack when printing has finished,\n\n then press Procceed.\n\n\n\n Finding my work usefull? Click here to buy me a cofee."\ --ok-label="Proceed" --cancel-label="Cancel"; then echo 'test' fi``
It showed the windows and when i clicked proceed it printed "test". But when I changed it to this:
#!/bin/bash if sudo -u $user zenity --question --title="$title" \ --text="<big><b>Flip and reinsert the entire paper stack when printing has finished,\n\n then press Procceed.</b></big>\n\n\n\n Finding my work usefull? <a href='https://www.paypal.com/paypalme2/nanonetK3'>Click here to buy me a cofee.</a>"\ --ok-label="Proceed" --cancel-label="Cancel"; then echo 'test' fi
The output was:
sudo: unrecognized option '--question' usage: sudo -h | -K | -k | -V usage: sudo -v [-ABkNnS] [-g group] [-h host] [-p prompt] [-u user] usage: sudo -l [-ABkNnS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command [arg ...]] usage: sudo [-ABbEHkNnPS] [-r role] [-t type] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-T timeout] [-u user] [VAR=value] [-i | -s] [command [arg ...]] usage: sudo -e [-ABkNnS] [-r role] [-t type] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-T timeout] [-u user] file ...
At this point I don't know what to do.
Hi. Thanks for reporting. I found a situation where the zenity window wasn't displaying and updated the code. Please check if this solves your issue and let me know.
Thanks for such a fast response :smiley: I tried again, and unfortunately it still isn't working. Here is a log:
Tue May 9 12:00:03 AM CEST 2023 --- Starting duplexer job
Tue May 9 12:00:03 AM CEST 2023 --- Script called by nxmbit
Tue May 9 12:00:03 AM CEST 2023 --- Running on display number
Tue May 9 12:00:03 AM CEST 2023 --- page count: 2
Tue May 9 12:00:03 AM CEST 2023 --- more than one page was sent. printing odd pages
Tue May 9 12:00:03 AM CEST 2023 --- Will Show user interface.
I have a suspicion that it might be related to the fact, that I'm running dual monitor setup on Wayland, because when i removed the code related to display in the script that i mentioned earlier, the zenity windows appeared on screen. Also in the logs it doesn't show display number.
EDIT: I just logged in to xorg session and it still doesn't work however it is now showing display number in the log:
Tue May 9 12:13:03 AM CEST 2023 --- Starting duplexer job
Tue May 9 12:13:03 AM CEST 2023 --- Script called by nxmbit
Tue May 9 12:13:03 AM CEST 2023 --- Running on display number :0
Tue May 9 12:13:03 AM CEST 2023 --- page count: 2
Tue May 9 12:13:03 AM CEST 2023 --- more than one page was sent. printing odd pages
Tue May 9 12:13:03 AM CEST 2023 --- Will Show user interface.
Looks like it's something about the display. We need to find a more robust way to get the display number. Please show the result of command "who" on your multi monitor setup.
I added logging for zenity command and updated the code. Please check it and post if any error.
Hi. Sorry for the delay. Here is the new log:
Fri May 19 02:55:56 PM CEST 2023 --- Script called by nxmbit
Fri May 19 02:55:56 PM CEST 2023 --- Running on display number
Fri May 19 02:55:56 PM CEST 2023 --- page count: 2
Fri May 19 02:55:56 PM CEST 2023 --- more than one page was sent. printing odd pages
Fri May 19 02:55:56 PM CEST 2023 --- Will Show user interface.
/usr/lib/cups/backend/duplex-print: line 71: sudo: command not found
Fri May 19 02:55:56 PM CEST 2023 --- User interface has been shown.
Fri May 19 02:55:56 PM CEST 2023 --- User aborted print job
Hi. It looks like the script isn't finding the sudo command. Are you sure nxmbit user has sudo access? Please post the result of commands:#who and#groups nmxbit
On Friday, 19 May 2023 at 16:02:22 EEST, nxmbit ***@***.***> wrote:
Hi. Sorry for the delay. Here is the new log: Fri May 19 02:55:56 PM CEST 2023 --- Script called by nxmbit Fri May 19 02:55:56 PM CEST 2023 --- Running on display number Fri May 19 02:55:56 PM CEST 2023 --- page count: 2 Fri May 19 02:55:56 PM CEST 2023 --- more than one page was sent. printing odd pages Fri May 19 02:55:56 PM CEST 2023 --- Will Show user interface. /usr/lib/cups/backend/duplex-print: line 71: sudo: command not found Fri May 19 02:55:56 PM CEST 2023 --- User interface has been shown. Fri May 19 02:55:56 PM CEST 2023 --- User aborted print job
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
Hi, here's the output:
who: nxmbit seat0 2023-05-23 19:42 (login screen) nxmbit tty2 2023-05-23 19:42 (tty2)
groups nxmbit: nxmbit : nxmbit wheel
Hi. You need to add nmxbit to sudo group. I'm on vacation now and can't do much.When I get back I'll make some revision - maybe it makes more sense to have the user to be member of LP group than sudo group. We also need to see what's with the multiple monitors. Thanks for helping.
I've updated the code including the installer - i was confusing who
command with w
. Seems they're 2 different programs.
You should install the driver again and paste the installation script output.
Then check if printing works as expected. If not, post output of
who -su
and relevant entries from /var/log/cups/error_log
Hi, I tried printing after installing the updated driver, unfortunately it still doesn't work.
Here's the log:
Wed Jun 7 11:32:52 AM CEST 2023 --- Script called by nxmbit and runs as root with logname
Wed Jun 7 11:32:52 AM CEST 2023 --- page count: 4
Wed Jun 7 11:32:52 AM CEST 2023 --- more than one page was sent. printing odd pages
Wed Jun 7 11:32:52 AM CEST 2023 --- Will Show user interface.
Wed Jun 7 11:32:52 AM CEST 2023 --- Running on display number
/usr/lib/cups/backend/duplex-print: line 73: sudo: command not found
Wed Jun 7 11:32:52 AM CEST 2023 --- User interface has been shown.
Wed Jun 7 11:32:52 AM CEST 2023 --- User aborted print job
who -su:
nxmbit seat0 2023-06-07 11:54 (login screen)
nxmbit tty2 2023-06-07 11:54 (tty2)
I also tried printing from terminal using lpr but it still doesn't work. I then logged to xorg session, but besides showing correct display number in the log, everything is the same.
One thing, that I forgot to tell earlier, is that you might also consider changing this line in the install script:
all_printers=$(lpstat -s | tail +2 | awk '{print $3}' | sed 's/.$//')
In my case, for the installer to recognize my printers i had to change tail +2
to tail -n +2
(https://stackoverflow.com/questions/6185543/is-tail-2-supported-by-linux)
Thanks for your help.
hi.
I don't understand how nmxbit runs the script with as root without sudo.
I also don't understand why the script isn't picking up the display number since the output of who -su
seems correct.
Maybe you're doing something unexpected or i'm not paying attention to something?
At this point i would try to install Fedora in virtualbox and test it there, but i need to find a bit of free time to fiddle around a new linux distro.
If you do find a solution to this which can be generically applied to all linux distros, i would happily include it in the code.
Hi, I am not experienced with shell scripting but i have found that there is no way to display any sort of message box with the script, i have tried zenity, yad, kdialog. with no success.
#show user interface
LOG $(date) --- Will Show user interface.
#export display for zenity to use
# kdialog --warningcontinuecancel "Flip the pages to continue printing" --wait
LOG $(date) --- Starting to display
yad
export dialog_result=$?;
LOG $(date) --- Finished
LOG $(date) --- User interface has been shown resulted: $dialog_result.
if (($dialog_result==0)); then
LOG $(date) --- printing even pages
lp -s -d $USE_PRINTER -n "$numcopies" $lp_args -o page-set=even -o collate=true -o outputorder=normal \
-o orientation-requested=6 -t "$title"-even "$filename"
Nothing ever ends up on screen, but if i try it from the console it works just fine:
Hi. I'm not experienced with yad. Zenity is preinstalled on Ubuntu/ Debian, that's why I'm using it. Make sure you have it installed and show the log generated by the original script.
W [17/Sep/2023:13:58:49 +0200] Printer drivers are deprecated and will stop working in a future version of CUPS. See https://github.com/OpenPrinting/cups/issues/103
W [18/Sep/2023:18:13:48 +0200] Printer drivers are deprecated and will stop working in a future version of CUPS. See https://github.com/OpenPrinting/cups/issues/103
W [19/Sep/2023:18:53:49 +0200] Printer drivers are deprecated and will stop working in a future version of CUPS. See https://github.com/OpenPrinting/cups/issues/103
---
Tue Sep 19 07:26:06 PM CEST 2023 --- Starting duplexer job
Tue Sep 19 07:26:06 PM CEST 2023 --- Script called by tomasz and runs as root with logname
Tue Sep 19 07:26:06 PM CEST 2023 --- page count: 2
Tue Sep 19 07:26:06 PM CEST 2023 --- more than one page was sent. printing odd pages
Tue Sep 19 07:26:06 PM CEST 2023 --- Will Show user interface.
Tue Sep 19 07:26:06 PM CEST 2023 --- Running on display number
(zenity:27193): Gtk-WARNING **: 19:26:06.181: cannot open display:
Tue Sep 19 07:26:06 PM CEST 2023 --- User interface has been shown.
Tue Sep 19 07:26:06 PM CEST 2023 --- User aborted print job
--END--
This is the log, and i definitely have installed zenity.
The script can't get the proper display number. Which distribution you're using? Post the output of "who -su"
╰─λ who -su tomasz tty2 2023-09-21 18:30 (:0) tomasz pts/0 2023-09-21 18:30 (:0)
Which distribution are you using? How are you logging in ?
Now I see the output of " who -su " isn't consistent among Linux distributions.
The quick and dirty way to make it work for you is to find the line containing "who -su" and adapt it to extract the display number. Then It will work.
I use Garuda Linux (an arch based distro), and i login with sddm.
There is actually another problem. If i set a display number manually to :0 it still won't work. The error returned is Invalid MIT-MAGIC-COOKIE-1 key. But i have found i need to enable the cups group to interact with my X session. *I have read that this is not secure but the command to add is xhost +local:cups
and xhost -local:cups
to revoke.
Maybe there is an option for the printing script to automatically toggle that?
I have made a fork and I have tried to make it happen but with no success, like I sad I am not a very experienced in shell scripting
My interest is to build something generic. If i can't make it generic, i'll support the distribution i'm using, which is debian. Garuda and sddm are unknown to me. If you find a way which can be applied to all linux distributions, i'm happy to adapt the code.
Until then maybe we can have different forks and maintainers for different distributions.
Hi, I am on Linux Mint 21.3 and I am facing the same issue. The odd pages print normally but there is no window to print the even pages and the print completes after printing only odd pages.
Hi. Please follow the steps in this thread and let me know where things differ.
I'm on Ubuntu 20.04 with an HP Laserjet 1102 and don't get the proceed window, so it only prints one half of the pages