[Solved]How to make a photocopy using a USB scanner and a network printer

Need support for GhostBSD. Ask here if your question does not fit elsewhere.
mapsware
Posts: 25
Joined: Tue May 07, 2019 11:22 pm
Location: Hermosillo, Son. Mexico
Has thanked: 2 times
Been thanked: 1 time

Re: How to make a photocopy using a USB scanner and a network printer

Post 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

christophe60_fr
Posts: 48
Joined: Thu Oct 29, 2015 3:05 pm
Has thanked: 0
Been thanked: 0

Re: How to make a photocopy using a USB scanner and a network printer

Post 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.

mapsware
Posts: 25
Joined: Tue May 07, 2019 11:22 pm
Location: Hermosillo, Son. Mexico
Has thanked: 2 times
Been thanked: 1 time

Re: How to make a photocopy using a USB scanner and a network printer

Post by mapsware »

Did you logged out and in after modifying ~/.xsession?

christophe60_fr
Posts: 48
Joined: Thu Oct 29, 2015 3:05 pm
Has thanked: 0
Been thanked: 0

Re: How to make a photocopy using a USB scanner and a network printer

Post 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?

mapsware
Posts: 25
Joined: Tue May 07, 2019 11:22 pm
Location: Hermosillo, Son. Mexico
Has thanked: 2 times
Been thanked: 1 time

Re: How to make a photocopy using a USB scanner and a network printer

Post 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)

Code: Select all

rc-update add sshd
Esto es debido a que GhostBSD utiliza OpenRC

christophe60_fr
Posts: 48
Joined: Thu Oct 29, 2015 3:05 pm
Has thanked: 0
Been thanked: 0

Re: How to make a photocopy using a USB scanner and a network printer

Post 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.

mapsware
Posts: 25
Joined: Tue May 07, 2019 11:22 pm
Location: Hermosillo, Son. Mexico
Has thanked: 2 times
Been thanked: 1 time

Re: How to make a photocopy using a USB scanner and a network printer

Post by mapsware »

christophe60_fr wrote:
Wed Jun 17, 2020 11:49 am
# which lpr
/usr/bin/lpr
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

christophe60_fr
Posts: 48
Joined: Thu Oct 29, 2015 3:05 pm
Has thanked: 0
Been thanked: 0

Re: How to make a photocopy using a USB scanner and a network printer

Post 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 ?

mapsware
Posts: 25
Joined: Tue May 07, 2019 11:22 pm
Location: Hermosillo, Son. Mexico
Has thanked: 2 times
Been thanked: 1 time

Re: How to make a photocopy using a USB scanner and a network printer

Post 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

christophe60_fr
Posts: 48
Joined: Thu Oct 29, 2015 3:05 pm
Has thanked: 0
Been thanked: 0

Re: How to make a photocopy using a USB scanner and a network printer

Post 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.

Post Reply