Jump to content

ArchLinux systemd printer configuration


amenditman

Recommended Posts

I just replaced my old HP All-In-One which has been giving me fits for about 3 years. It finally died and let me off the merry-go-round.

 

I got a Brother (they have a huge library of Linux drivers) DCP-7065DN monochrome laser with scan and copy. It sets up easy under Mepis because Brother provides rpm and deb packages with instructions and the Mepis wiki entry is easy to follow. I am now up to installing it on my Arch pure systemd desktop, and even though there is a great ArchWiki entry for this printer, it does not yet apply to systemd.

 

 

 

Editing files to make it work with Arch

 

Arch Linux uses its own file system organization, so you have to edit some files. Use your text editor (i.e. vi) to open the file named cupswrapperDCP7065DN-2.0.4 If you created the temporary directory "tmp" in your home, this file will be in /home/(your user)/tmp/usr/local/Brother/Printer/DCP7065DN/cupswrapper/cupswrapperDCP7065DN-2.0.4

In this file, you must replace all the /etc/init.d/ occurrences by /etc/rc.d/ and /etc/init.d/cups by /etc/rc.d/cupsd.

I need to replace all the

/etc/init.d/ and /etc/init.d/cups

instances in the file with something designed for the Arch filesystem and systemd, not the

/etc/rc.d and /etc/rc.d/cupsd

in the instructions.

 

Any suggestions about what to use or where to find instructions? I've looked at the systemd homepage and links, the ArchWiki pages associated with systemd and cups, and the mandatory internet search without finding anything really helpful.

 

My best guess, and it is huge guess, in to use

/etc/systemd to replace /etc/init.d

and

/etc/systemd/cups.service to replace /etc/init.d/cups

Link to comment
Share on other sites

V.T. Eric Layton

If you're running pure systemd, you can ignore init.d and rc.d.

 

Instead:

 

# systemctl enable cups.service

 

After enabling, either reboot or start the service manually:

 

 # systemctl start cups.service

 

If you're running a sysvinits/systemd hybrid, then just add cups to your old style daemons list in /etc/rc.conf.

  • Like 1
Link to comment
Share on other sites

securitybreach

If you're running pure systemd, you can ignore init.d and rc.d.

 

Instead:

 

# systemctl enable cups.service

 

After enabling, either reboot or start the service manually:

 

 # systemctl start cups.service

 

If you're running a sysvinits/systemd hybrid, then just add cups to your old style daemons list in /etc/rc.conf.

 

I am at work right now but I believe Eric is correct. :thumbsup:

Link to comment
Share on other sites

V.T. Eric Layton

Then it's not an Arch/cups issue. It's a driver issue. Have you tried the pre-installed cups support for that printer (if there is any)?

 

Rebooting into Arch. I'll be back...

Link to comment
Share on other sites

It is definitely a printer driver issue. Brother provides Linux drivers in rpm, deb, and probably source. Problem is, the instructions for making them work are for the deb and rpm. The ArchWiki article I listed in my first post is a way to make the rpm work in Arch, but is written for systems using rc.d.

Here's the text of the file in question. Pretty typical printer driver file.

 

#! /bin/sh

#

# Brother Print filter

# Copyright © 2005 Brother. Industries, Ltd.

 

# This program is free software; you can redistribute it and/or modify it

# under the terms of the GNU General Public License as published by the Free

# Software Foundation; either version 2 of the License, or (at your option)

# any later version.

#

# This program is distributed in the hope that it will be useful, but WITHOUT

# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for

# more details.

#

# You should have received a copy of the GNU General Public License along with

# this program; if not, write to the Free Software Foundation, Inc., 59 Temple

# Place, Suite 330, Boston, MA 02111-1307 USA

#

 

if [ "$1" = '-e' ]; then

lpadmin -x DCP7065DN

rm -f /usr/share/cups/model/DCP7065DN.ppd

rm -f /usr/lib/cups/filter/brlpdwrapperDCP7065DN

rm -f /usr/lib64/cups/filter/brlpdwrapperDCP7065DN

rm -f /usr/local/Brother/Printer/DCP7065DN/cupswrapper/brcupsconfig4

if [ -f /usr/share/ppd/DCP7065DN.ppd ];then

rm -f /usr/share/ppd/DCP7065DN.ppd

fi

if [ -e /etc/init.d/cups ]; then

/etc/init.d/cups restart

fi

if [ -e /etc/init.d/cupsys ]; then

/etc/init.d/cupsys restart

fi

exit 0

fi

if [ "$1" = "-r" ]; then

lpadmin -x DCP7065DN

if [ -e /etc/init.d/cups ]; then

/etc/init.d/cups restart

fi

if [ -e /etc/init.d/cupsys ]; then

/etc/init.d/cupsys restart

fi

exit 0

fi

if [ "$1" = "help" ] || [ "$1" = "-h" ]; then

echo 'option -h : help'

echo ' -i : install'

echo ' -e : uninstall'

echo ' -r : remove printer'

exit 0

fi

mkdir -p /usr/lib/cups/filter

 

if [ -e "/usr/local/Brother/Printer/DCP7065DN/lpd/filterDCP7065DN" ]; then

:

else

echo "ERROR : Brother LPD filter is not installed."

fi

rm -f /usr/share/cups/model/DCP7065DN.ppd

ppd_file_name=/usr/share/cups/model/DCP7065DN.ppd

if [ ! -e /usr/share/cups/model ]; then

ppd_file_name=/usr/share/ppd/DCP7065DN.ppd

fi

 

cat <<ENDOFPPDFILE >$ppd_file_name

 

 

Bunch of boring stuff removed to save space (PPD File)

 

 

ENDOFPPDFILE

 

chmod 755 $ppd_file_name

if [ -e '/usr/share/ppd' ];then

if [ -e '/usr/share/cups/model' ];then

cp $ppd_file_name /usr/share/ppd

fi

fi

 

brotherlpdwrapper=/usr/lib/cups/filter/brlpdwrapperDCP7065DN

brotherlpdwrapper64=/usr/lib64/cups/filter/brlpdwrapperDCP7065DN

rm -f $brotherlpdwrapper

if [ ! -e /usr/lib/cups/filter ];then

if [ -e /usr/lib64/cups/filter ];then

brotherlpdwrapper=/usr/lib64/cups/filter/brlpdwrapperDCP7065DN

fi

fi

 

 

cat <<!ENDOFWFILTER! >$brotherlpdwrapper

#! /bin/sh

#

# Brother Print filter >> $brotherlpdwrapper

# Copyright © 2005 Brother. Industries, Ltd.

# Ver1.00

 

# This program is free software; you can redistribute it and/or modify it

# under the terms of the GNU General Public License as published by the Free

# Software Foundation; either version 2 of the License, or (at your option)

# any later version.

#

# This program is distributed in the hope that it will be useful, but WITHOUT

# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for

# more details.

#

# You should have received a copy of the GNU General Public License along with

# this program; if not, write to the Free Software Foundation, Inc., 59 Temple

# Place, Suite 330, Boston, MA 02111-1307 USA

#

LOGFILE="/dev/null"

LOGCLEVEL="7"

DEBUG=0

NUPENABLE=1

ENABLECOPY=0

LOG_LATESTONLY=1

errorcode=0

 

set +o noclobber

if [ "\`echo \$5 | grep 'debug-noprint=1'\`" != '' ]; then

DEBUG=1

fi

if [ "\`echo \$5 | grep 'debug-noprint=2'\`" != '' ]; then

DEBUG=2

fi

if [ "\`echo \$5 | grep 'debug-noprint=3'\`" != '' ]; then

DEBUG=3

fi

if [ \$DEBUG != 0 ]; then

LOGFILE=/tmp/br_cupsfilter_debug_log

fi

 

PRINTER=DCP7065DN

 

 

if [ "\$PPD" = "" ]; then

PPD="/usr/share/cups/model/DCP7065DN.ppd"

fi

 

 

if [ \$LOGFILE != "/dev/null" ]; then

if [ \$LOG_LATESTONLY == "1" ]; then

rm -f \$LOGFILE

date >\$LOGFILE

else

if [ -e \$LOGFILE ]; then

date >>\$LOGFILE

else

date >\$LOGFILE

fi

fi

echo "arg0 = \$0" >>\$LOGFILE

echo "arg1 = \$1" >>\$LOGFILE

echo "arg2 = \$2" >>\$LOGFILE

echo "arg3 = \$3" >>\$LOGFILE

echo "arg4 = \$4" >>\$LOGFILE

echo "arg5 = \$5" >>\$LOGFILE

echo "arg6 = \$6" >>\$LOGFILE

echo "PPD = \$PPD" >>\$LOGFILE

fi

 

INPUT_TEMP_PS=\`mktemp /tmp/br_input_ps.XXXXXX\`

 

nup="cat"

if [ "\`echo \$5 | grep 'Nup='\`" != '' ] && [ \$NUPENABLE != 0 ]; then

 

if [ "\`echo \$5 | grep 'Nup=64'\`" != '' ]; then

nup="psnup -64"

elif [ "\`echo \$5 | grep 'Nup=32'\`" != '' ]; then

nup="psnup -32"

elif [ "\`echo \$5 | grep 'Nup=25'\`" != '' ]; then

nup="psnup -25"

elif [ "\`echo \$5 | grep 'Nup=16'\`" != '' ]; then

nup="psnup -16"

elif [ "\`echo \$5 | grep 'Nup=8'\`" != '' ]; then

nup="psnup -8"

elif [ "\`echo \$5 | grep 'Nup=6'\`" != '' ]; then

nup="psnup -6"

elif [ "\`echo \$5 | grep 'Nup=4'\`" != '' ]; then

nup="psnup -4"

elif [ "\`echo \$5 | grep 'Nup=2'\`" != '' ]; then

nup="psnup -2"

elif [ "\`echo \$5 | grep 'Nup=1'\`" != '' ]; then

nup="cat"

fi

echo "NUP=\$nup" >>\$LOGFILE

if [ -e /usr/bin/psnup ]; then

if [ \$# -ge 7 ]; then

cat \$6 | \$nup > \$INPUT_TEMP_PS

else

cat | \$nup > \$INPUT_TEMP_PS

fi

else

if [ \$# -ge 7 ]; then

cp \$6 \$INPUT_TEMP_PS

else

cat > \$INPUT_TEMP_PS

fi

fi

else

if [ \$# -ge 7 ]; then

cp \$6 \$INPUT_TEMP_PS

else

cat > \$INPUT_TEMP_PS

fi

fi

 

if [ "\$ENABLECOPY" != 0 ];then

if [ "\$4" -ge 2 ];then

options="\$5"" ""Copies=\$4"

else

options="\$5"

fi

else

options="\$5"

fi

 

 

if [ -e "/usr/local/Brother/Printer/\$PRINTER/lpd/filter\$PRINTER" ]; then

:

else

echo "ERROR: /usr/local/Brother/Printer/\$PRINTER/lpd/filter\$PRINTER does not exist" >>\$LOGFILE

errorcode=30

exit $errorcode

fi

 

if [ -e "/usr/local/Brother/Printer/DCP7065DN/cupswrapper/brcupsconfig4" ]; then

if [ \$DEBUG = 0 ]; then

/usr/local/Brother/Printer/DCP7065DN/cupswrapper/brcupsconfig4 \$PRINTER \$PPD 0 "\$options" >> /dev/null

else

/usr/local/Brother/Printer/DCP7065DN/cupswrapper/brcupsconfig4 \$PRINTER \$PPD \$LOGCLEVEL "\$options" >>\$LOGFILE

fi

fi

 

 

if [ \$DEBUG -le 2 ]; then

cat \$INPUT_TEMP_PS | /usr/local/Brother/Printer/\$PRINTER/lpd/filter\$PRINTER

fi

 

if [ \$DEBUG -ge 2 ]; then

if [ \$LOGFILE != "/dev/null" ]; then

echo "" >>\$LOGFILE

echo " ------PostScript Data-------" >>\$LOGFILE

cat \$INPUT_TEMP_PS >>\$LOGFILE

fi

fi

rm -f \$INPUT_TEMP_PS

 

exit \$errorcode

 

!ENDOFWFILTER!

 

 

chmod 755 $brotherlpdwrapper

if [ -e /usr/lib/cups/filter ]; then

if [ -e /usr/lib64/cups/filter ]; then

cp $brotherlpdwrapper $brotherlpdwrapper64

fi

fi

 

chmod a+w /usr/local/Brother/Printer/DCP7065DN/inf/brDCP7065DNrc

chmod a+w /usr/local/Brother/Printer/DCP7065DN/inf

if [ -e /etc/init.d/lpd ]; then

/etc/init.d/lpd stop

fi

if [ -e /etc/init.d/lprng ]; then

/etc/init.d/lprng stop

fi

if [ -e /etc/init.d/cups ]; then

/etc/init.d/cups restart

fi

if [ -e /etc/init.d/cupsys ]; then

/etc/init.d/cupsys restart

fi

sleep 2s

port2=`lpinfo -v | grep -i 'usb://Brother/DCP7065DN' | head -1`

if [ "$port2" = '' ];then

port2=`lpinfo -v | grep -i 'usb://Brother/' | head -1`

if [ "$port2" = '' ];then

port2=`lpinfo -v | grep 'usb://' | head -1`

fi

fi

port=`echo $port2| sed s/direct//g`

if [ "$port" = '' ];then

port=usb:/dev/usb/lp0

fi

lpadmin -p DCP7065DN -E -v $port -P $ppd_file_name

exit 0

Edited by amenditman
Link to comment
Share on other sites

Yes, Cups acts like it is all set up but the printer does not respond to jobs sent.

 

I have tried from scratch, fully removing everything cups related from the system, and rebuilt it step by step. Tested at each step. Have tried cups web interface, kde system settings printer setup, and now am at the point of trying the ArchWiki setup article. Have not tried my best guess yet, hoping for some inspiration (here, Arch forums, systemd IRC, and Brother support).

Link to comment
Share on other sites

The logs show

DCP-7065DN: File "/usr/lib/cups/filter/brlpdwrapperDCP7065DN" not available: No such file or directory
E [11/Sep/2012:22:29:56 +0000] DCP-7065DN: File "/usr/lib/cups/filter/brlpdwrapperDCP7065DN" not available: No such file or directory
E [11/Sep/2012:22:34:22 +0000] [Job 10] Stopping unresponsive job.
E [11/Sep/2012:23:10:50 +0000] [cups-deviced] PID 2707 (dnssd) stopped with status 1!
E [11/Sep/2012:23:12:06 +0000] [cups-driverd] Bad driver information file "/usr/share/cups/drv/cupsfilters.drv"!
E [11/Sep/2012:23:12:15 +0000] Returning IPP client-error-not-possible for CUPS-Add-Modify-Printer (ipp://localhost/printers/DCP-7065DN) from localhost
E [11/Sep/2012:23:14:13 +0000] [cups-driverd] Bad driver information file "/usr/share/cups/drv/cupsfilters.drv"!
E [11/Sep/2012:23:14:19 +0000] DCP-7065DN: File "/usr/lib/cups/filter/brlpdwrapperDCP7065DN" not available: No such file or directory
E [11/Sep/2012:23:14:34 +0000] DCP-7065DN: File "/usr/lib/cups/filter/brlpdwrapperDCP7065DN" not available: No such file or directory
E [11/Sep/2012:23:14:34 +0000] [Job 10] Unable to start filter "brlpdwrapperDCP7065DN" - Is a directory.
E [11/Sep/2012:23:14:34 +0000] [Job 10] Stopping job because the scheduler could not execute a filter.
E [12/Sep/2012:02:36:39 +0000] [Job 10] Stopping unresponsive job.
E [12/Sep/2012:02:37:24 +0000] Returning IPP client-error-not-possible for Cancel-Job (ipp://localhost/jobs/10) from localhost

It's looking for the printer filter file (cups idea of what to call a driver file) which I am trying to edit. See post #1 this thread.

Link to comment
Share on other sites

securitybreach

Why not just install the driver from AUR?

╔═ comhack@Cerberus 09:59 PM

╚═══ ~-> yaourt -Ss brother-dcp7065

aur/brother-dcp7065dn-cupswrapper 2.0.4_2-1 (3)

CUPS driver for Brother laser printer DCP-7065DN

aur/brother-dcp7065dn-lpr 2.1.0_1-1 (3)

LPR driver for Brother laser printer DCP-7065DN

 

http://aur.archlinux...65&do_Search=Go

Link to comment
Share on other sites

Sorry, forgot to mention that I had already tried that. Same result, no communication. But it might have been after other things were tried and not cleaned out.

 

I will try removing everything and installing those on a fresh cups with no other stuff and let you know. Tomorrow.

Link to comment
Share on other sites

securitybreach

Sorry, forgot to mention that I had already tried that. Same result, no communication. But it might have been after other things were tried and not cleaned out.

 

I will try removing everything and installing those on a fresh cups with no other stuff and let you know. Tomorrow.

 

Sounds good :thumbsup:

Link to comment
Share on other sites

Why not just install the driver from AUR?

 

 

http://aur.archlinux...65&do_Search=Go

Alrighty, here's what I think is going on.

I have done a clean install after doing a wipe of everything remotely related to cups, sane, printer drivers, kde integration, and all their associated config files.

I installed only the cups package, the two packages from the aur you mention and whatever dependencies were required.

Everything installs just fine. Used the Cups web interface to set up the printer. The printer was auto-detected and The Brother Printer drivers were right there at the top of the list as the recommended driver. I set it up using the settings recommended by both the ArchWiki article and the Brother Printer Driver installation page.

The test page does not print. No print job prints.

Here is what I think is happening. The two aur packages are just the files downloaded from the Brother site with all reference to init.d removed and replaced by rc.d. Looking in the files produced by the install confirms this. If I was running a init based install it would work.

 

More research into systemd settings and configs required to get it working.

At least I have it all set up on my wife and son's Mepis computers. Easy peasy using dpkg and the .debs provided by the manufacturer.

Link to comment
Share on other sites

securitybreach

Is cups running:

# systemctl status cups.service

 

 

At least I have it all set up on my wife and son's Mepis computers. Easy peasy using dpkg and the .debs provided by the manufacturer.

 

Well it would of been just as easy to install/setup on Arch if you were still using rc.d instead of systemd.

Link to comment
Share on other sites

securitybreach

This may help but you would need to change the folder location as they are using a different version of Brother driver but this what they did on systemd

Problem solved, after the installation i have to go to the "/usr/local/Brother/Printer/mfc295cn/cupswrapper/" dir and run a "sudo ./cupswrappermfc295cn". Looks like only this makes available the driver to cups, but installs the printer over usb (not my case, i'm using ethernet).

After that, i changed the printer uri to "lpd://printer_ip/BINARY_P1"...

https://bbs.archlinu...c.php?id=148409

 

And of course, su to root and then run the command instead of sudo.

Link to comment
Share on other sites

Is cups running:

# systemctl status cups.service

 

 

 

 

Well it would of been just as easy to install/setup on Arch if you were still using rc.d instead of systemd.

True, the price I pay for trying to be modern.
Link to comment
Share on other sites

I bet you could change the aur PKGBUILDs to reflect systemd instead but I am not for sure how. I am trying look around and see if I could find anything for you.

 

Maybe something here: https://bbs.archlinu...c.php?id=146154

Looked thru that, no help.

systemctl
....
cups.service				   loaded active running	   CUPS Printing Service
....

Definitely not a problem with systemd or the cups.service.

Definitely is a problem with how to modify the script, which is what those aur files you mention are, to remove rc.d references and make it work with systemd. It might not be possible to do without a major rewrite, which I am not qualified to do.

 

Those scripts setup the filters and ppd files for cups to use to properly access the printer. The cupswrapper one has 4 or 5 if loops which ask about init.d and init.d/cups status. The aur packages have already been modified to work on Arch by changing those references from init.d/cups to rc.d/cupsd.

 

I am having trouble finding out how to change them from rc.d/cupsd to something which will work in systemd. Have a post over at the Arch Forums, asked Brother tech support (for Linux users believe it or not, they have native rpm's and .debs), and have been on IRC with systemd developers (no help there since it really isn't a problem in systemd).

Edited by amenditman
Link to comment
Share on other sites

This may help but you would need to change the folder location as they are using a different version of Brother driver but this what they did on systemd

 

https://bbs.archlinu...c.php?id=148409

 

And of course, su to root and then run the command instead of sudo.

That looks semi-promising.

Will try it out. What's the worst thing that could happen? My printer stops working? :D

Link to comment
Share on other sites

Not good!

 

[root@arch-amend cupswrapper]#pwd
/home/amenditman/Downloads/usr/local/Brother/Printer/DCP7065DN/cupswrapper
[root@arch-amend cupswrapper]#cp -r /home/amenditman/Downloads/usr/* /usr
[root@arch-amend cupswrapper]#cp -r /home/amenditman/Downloads/var/* /var
[root@arch-amend cupswrapper]#cd /usr/local/Brother/Printer/DCP7065DN/cupswrapper/
[root@arch-amend cupswrapper]#pwd
/usr/local/Brother/Printer/DCP7065DN/cupswrapper
[root@arch-amend cupswrapper]#ls -al
total 68
drwxr-xr-x 2 root root  4096 Sep 13 18:03 .
drwxr-xr-x 5 root root  4096 Sep 13 18:03 ..
-rwxr-xr-x 1 root root 19144 Sep 13 18:03 brcupsconfig4
-rwxr-xr-x 1 root root 18847 Sep 13 18:03 cupswrapperDCP7065DN-2.0.4
-rwxr-xr-x 1 root root 18873 Sep 13 18:03 cupswrapperDCP7065DN-2.0.4~
[root@arch-amend cupswrapper]#./cupswrapperDCP7065DN-2.0.4
/etc/rc.d/cupsd: line 5: /etc/rc.conf: No such file or directory
/etc/rc.d/cupsd: line 6: /etc/rc.d/functions: No such file or directory
/etc/rc.d/cupsd: line 5: /etc/rc.conf: No such file or directory
/etc/rc.d/cupsd: line 6: /etc/rc.d/functions: No such file or directory
/etc/rc.d/cupsd: line 38: stat_busy: command not found
/etc/rc.d/cupsd: line 48: rm_daemon: command not found
/etc/rc.d/cupsd: line 49: stat_done: command not found
/etc/rc.d/cupsd: line 5: /etc/rc.conf: No such file or directory
/etc/rc.d/cupsd: line 6: /etc/rc.d/functions: No such file or directory
/etc/rc.d/cupsd: line 15: stat_busy: command not found
/etc/rc.d/cupsd: line 28: add_daemon: command not found
/etc/rc.d/cupsd: line 29: stat_done: command not found

That's a lot of errors and possible script file edits.

 

Testing printer now anyway.

 

Printer filter failed error.

Edited by amenditman
Link to comment
Share on other sites

The network connection is good. When I ping it I get responses.

 

Weird, when I try to print the Test Page nothing happens but when I try to print the Self-Test Page the panel on the printer lights up but does nothing.

 

Communicating with the printer works, it just doesn't know what I'm saying.

Edited by amenditman
Link to comment
Share on other sites

  • 2 weeks later...

Well, I only have one thing to say about all this...

 

Hewlett-Packard.

 

Sorry. Couldn't resist. ;)

Hoolit-Pakurd

What finally happened with this, Bob? You've kept us in suspense long enough. :(

 

I have not solved the problem of editing the necessary filter file for Cups (not for lack of trying).

Answers to my post at ArchLinux forums = zero

Answers to my questions at systemd IRC = zero

 

I am currently running Mepis on my desktop system for general usefulness and printing specifically and Arch on the laptop for systemd, GRUB2, and UEFI experience.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...