Page 2 of 2
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Wed Jun 17, 2020 2:33 am
by mapsware
With GhostBSD reinstalled, just configure your printer and set as default destination (in CUPS)
If the option "Copy" of XSane doesn't work out of the box, then create the environment variable PRINTER, edit your ~/.xsession and add the next line
export PRINTER=HP_LaserJet_200_color_M251nw
For the changes to take effect, logout from your session and login again
To validate the change, open a terminal and run the command echo $PRINTER it should display
HP_LaserJet_200_color_M251nw
GhostBSD came with CUPS installed/enable by default, if you enable LPD/LPR, you have to disable CUPS (only one print system should be enable), and maybe an update to GhostBSD may revert all your configurations
In the terminal run which lpr It should display /usr/bin/lpr, this mean that every time you run lpr, is running the lpr from CUPS
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Wed Jun 17, 2020 11:49 am
by christophe60_fr
With GhostBSD reinstalled, just configure your printer and set as default destination (in CUPS)
My printer has always been configured as my default printer.
edit your ~/.xsession and add the next line
export PRINTER=HP_LaserJet_200_color_M251nw
Done.
# echo $PRINTER
PRINTER: Variable pas définie.
# which lpr
/usr/bin/lpr
No error message when using the "copy" function but no printing.
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Wed Jun 17, 2020 10:42 pm
by mapsware
Did you logged out and in after modifying ~/.xsession?
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Thu Jun 18, 2020 9:46 am
by christophe60_fr
Yes, I did.
One thing that could possibly work is that the lpd service would be activated automatically at startup, which is not the case when adding lpd_enable="YES" to the "/etc/rc.conf" file. However, a manual "# service lpd start" activates the service and xsane works.
So how to activate the lpd service automatically?
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Thu Jun 18, 2020 3:29 pm
by mapsware
If you enable LPD/LPR, you need to disable CUPS, also need to make sure that when using
lpr it is the
/usr/bin/lpr
GhostBSD use OpenRC, I recently solve my problem about SSH not running when the PC boot
mapsware wrote: ↑Sat Jun 06, 2020 1:05 am
Para que el servicio de SSH inicie al arrancar GhostBSD, ejecutamos el siguiente comando como root (o con sudo)
Esto es debido a que GhostBSD utiliza
OpenRC
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Thu Jun 18, 2020 5:24 pm
by christophe60_fr
Yes, it works !
"rc-update add lpd" allows to automatically activate the lpd service at boot (I had stupidly tried rc-service add lpd, of course without success ...).
So, I deleted the content of "~/.xsession", removed "lpd_enable="YES"" from the file "/etc/rc.conf", from the file "/etc/rc.conf.ghostbsd" and from the file "/etc/defaults/rc.conf ", etc ...
Running # which lpr :
/usr/bin/lpr
I also rewrote "/etc/printcap" as follows on one line :
lp:lp=:rm=<ip-of-my-printer>:rp=raw:sh:mx#0:sd=/var/spool/lpd/lp:lf=/var/log/lpd-errs:
which allows me to have a blank "chkprintcap".
It is not very clear to me, but the fact is that xsane and its "copy" function are now operational.
So, a big thank you to both of you.
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Thu Jun 18, 2020 6:14 pm
by mapsware
It should be
/usr/local/bin/lpr, this mean that XSane was using
/usr/bin/lpr from LPD/LPR instead
/usr/local/bin/lpr from CUPS
Renaming
/usr/bin/lpr to
/usr/bin/lpr.bsd should make XSane work
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Fri Jun 19, 2020 2:05 pm
by christophe60_fr
Not sure if the solution is very clean, but it works.
It should be /usr/local/bin/lpr, this mean that XSane was using /usr/bin/lpr from LPD/LPR instead /usr/local/bin/lpr from CUPS
Renaming /usr/bin/lpr to /usr/bin/lpr.bsd should make XSane work
And I don't understand. How to rename ?
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Fri Jun 19, 2020 6:52 pm
by mapsware
I am not sure it's going to work since the environment variable PRINTER is not defined
To rename, you need to be root and run the next commands
Code: Select all
root@computer ~/# cd /usr/bin
root@computer /usr/bin/# mv lpr lpr.bsd
Re: How to make a photocopy using a USB scanner and a network printer
Posted: Sat Jun 20, 2020 11:29 am
by christophe60_fr
OK understood !
Result:
ls /usr/bin/lp
lp* lpq* lpr.bsd.save lpr.bsd* lprm*
ls /usr/local/bin/lp
lp_solve* lpoptions* lpr-cups@ lprm* lpstat*
lp* lpq* lpr* lprsetup.sh*
So,
# which lpr
/usr/local/bin/lpr
And you're right, it's all good for the xsane "copy" function to work.
So I deleted everything I done before.
I can consider this problem as solved (finally !)
Many thanks.